在 Rails 3 上安装并运行 Capybara(未初始化常量 Object::Rack (NameError))

发布于 2024-11-26 18:09:29 字数 847 浏览 1 评论 0原文

我尝试按照此处的说明进行安装水豚。但每次我尝试运行集成测试时,我都会得到:

/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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

阳光①夏 2024-12-03 18:09:29

我感觉自己像个傻瓜。

无论如何,我已经解决了。结果我在“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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文