Cucumber 错误:REST API 中测试环境主机的套接字错误
我将其发布到 Cucumber 小组但没有回复,这让我想知道这是否实际上是 Cucumber 问题。我对黄瓜还很陌生,对于如何在测试环境中设置和执行黄瓜环境,有很多事情我真的不太明白。
我有一个 REST API Rails 应用程序,正在使用 Cucumber 进行测试,使用 RestClient gem 生成控制器创建操作的帖子。当我使用指向正在运行的本地主机服务器(我的本地开发服务器环境)的硬编码 URL 运行该功能时;将 Ticket_url 替换为“http:// localhost/tickets”),我的 Cucumber 步骤按预期执行。但是,当资源 URL 解析为我声明的 Cucumber 主机时,我收到套接字错误异常。
getaddrinfo: nodename 或 servname 提供,或未知(SocketError)
从步骤文件:(
When /^POS Adapter sends JSON data to the Tickets resource$/ do ticket = { :ticket => { ... } } host! "test.host" puts tickets_url RestClient.post tickets_url, ticket.to_json, :content_type => :json, :accepts => :json end
“puts”语句打印“http://test .host/tickets")
使用以下 gems:
- cucumber-0.6.1
- webrat-0.6.0
- rest-client-1.2.0
我还应该说我在另一个 Rails 应用程序中使用 test 进行了类似的设置。主机作为我的主机,它似乎工作正常,我希望了解我的配置中可能缺少的内容或可能与之相关的内容。
I posted this to the Cucumber group with no replies, which makes me wonder if this is actually a cucumber issue or not. I'm pretty new to cucumber, and there are a number of things I really don't quite understand about how the cucumber environment is set up and executed within the test environment.
I have a REST API rails app I'm testing with cucumber, using the RestClient gem to generate a post to controller create action. When I run the feature with a hard-coded URL pointing to a running localhost server (my local dev server environment; replacing tickets_url with "http://
localhost/tickets" in the snippet below), my cucumber steps execute as expected. However, when the resource URL resolves to the cucumber host I'm declaring, I get a socket error exception.
getaddrinfo: nodename nor servname provided, or not known (SocketError)
From the steps file:
When /^POS Adapter sends JSON data to the Tickets resource$/ do ticket = { :ticket => { ... } } host! "test.host" puts tickets_url RestClient.post tickets_url, ticket.to_json, :content_type => :json, :accepts => :json end
(the "puts" statement prints "http://test.host/tickets")
Using the following gems:
- cucumber-0.6.1
- webrat-0.6.0
- rest-client-1.2.0
I should also say I have a similar set up in another rails app, using test.host as my host, and it seems to work fine. I'd appreciate any insight on what I might be missing in my configuration or what this could be related to.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用什么端口号?类似的问题已于 2009 年 10 月修复。该问题与使用的较大端口号有关。这是轻型房屋门票: https://rspec.lighthouseapp.com/projects/16211/tickets/502-wire-protocol-features-fail-with-os-x-snowy
What port number are you using? A similar problem was patched back in Oct. 2009. The issue was related to a large port number being used. Here's the light houseticket: https://rspec.lighthouseapp.com/projects/16211/tickets/502-wire-protocol-features-fail-with-os-x-snowy