在 Rails 3 上安装并运行 Capybara(未初始化常量 Object::Rack (NameError))
我尝试按照此处的说明进行安装水豚。但每次我尝试运行集成测试时,我都会得到:
/Users/rambo/.rvm/gems/ruby-1.9.2-p180/bundler/gems/capybara-6641fddcfc33/lib/capybara/rails.rb:4:in `<top (required)>': uninitialized constant Object::Rack (NameError)
from /Users/rambo/Code/ror/witsvale_app/test/integration_test_helper.rb:1:in `require'
from /Users/rambo/Code/ror/witsvale_app/test/integration_test_helper.rb:1:in `<top (required)>'
from test/integration/capy_test.rb:1:in `require'
from test/integration/capy_test.rb:1:in `<top (required)>'
from /Users/rambo/.rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
导致问题的行是 require capybara/rails
。
任何想法将不胜感激。
I'm trying to follow the instructions here to install Capybara. But each time I try to run the integration test, I get:
/Users/rambo/.rvm/gems/ruby-1.9.2-p180/bundler/gems/capybara-6641fddcfc33/lib/capybara/rails.rb:4:in `<top (required)>': uninitialized constant Object::Rack (NameError)
from /Users/rambo/Code/ror/witsvale_app/test/integration_test_helper.rb:1:in `require'
from /Users/rambo/Code/ror/witsvale_app/test/integration_test_helper.rb:1:in `<top (required)>'
from test/integration/capy_test.rb:1:in `require'
from test/integration/capy_test.rb:1:in `<top (required)>'
from /Users/rambo/.rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
The line that is causing the problem is require capybara/rails
.
Any ideas will be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我感觉自己像个傻瓜。
无论如何,我已经解决了。结果我在“test”文件夹中丢失了“test_helper.rb”。加入后,就可以了!
I feel like a dum dum.
Anyway, I've solved it. Turns out I was missing 'test_helper.rb' in the 'test' folder. After including that, it works!