当我使用Selenium运行测试时,我的一步失败了,页面在浏览器中看起来像这样:
Internal Server Error
can't convert nil into String
WEBrick/1.3.1 (Ruby/1.9.2/2010-08-18) at 127.0.0.1:50752
当我用culerity运行它时,我得到的输出是:
Broken pipe (Errno::EPIPE)
/Users/yuval/.rvm/gems/ruby-1.9.2-p0/gems/culerity-0.2.15/lib/culerity/remote_object_proxy.rb:47:in `write'
etc...
当我在没有js驱动的情况下运行它时,它在那一点上根本不会失败(相反,它在使用js时失败,这就是为什么我试图用js驱动程序运行它)。
任何想法?
我刚刚遇到了同样的问题,但找到了解决方案。
如果您尝试在开发模式下以"http://127.0.0.1:3000"而不是"http://localhost:3000"打开浏览器,您应该面临相同的问题。
在我的情况下,问题是造成的,因为在我的视图文件中,我使用了"请求"。域",如果请求以类ip格式给出,则返回nil。"http://127.0.0.1:50752"。
因此,如果在你的helper方法视图中有这样的内容
link_to "Click me", :host => subdomain + "." + request.domain + request.port_string
你可以把它改成using helper方法,像这样:
link_to "Click me", :host => with_host(subdomain)
和帮助器如下:
def with_host(subdomain)
if request.domain.present?
subdomain + "." + request.domain + request.port_string
end
end
这对我来说是最简单的解决方案。