当我使用Selenium运行我的测试时,我的一步失败,页面在浏览器中显示如下: Internal Server Errorcan't convert nil into StringWEBrick/1.3.1 (Ruby/1.9.2/2010-08-18) at 127.0.0.1:50752 当我用culerity运行它时,我得到
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”,则应该遇到同样的问题.
在我的情况下导致问题,因为在我的View文件中,我使用了“request.domain”,如果以类似IP的格式提供请求,则返回nil,即“http://127.0.0.1:50752”.
因此,如果您在辅助方法视图中的某个地方有这样的东西
link_to "Click me", :host => subdomain + "." + request.domain + request.port_string
您可以将其更改为使用辅助方法,如下所示:
link_to "Click me", :host => with_host(subdomain)
和帮手如下:
def with_host(subdomain) if request.domain.present? subdomain + "." + request.domain + request.port_string end end
这是最适合我的解决方案.也许,你有类似的东西.