【问题标题】:Capybara 2.0.0.beta4 has undefined pathsCapybara 2.0.0.beta4 有未定义的路径
【发布时间】:2012-11-12 08:28:13
【问题描述】:

我刚刚使用 rspec-rails 2.11.4 升级到 Capybara 2.0.0.beta4,并且按照 RSpec-Rails 存储库中的 Capybara-Readme 的建议,我将我的请求规范(我只有一个)移动到了 spec/features。 当我现在运行测试时,它找不到任何路径。所以对于下面的测试块:

it "should be able to access the signup page through the front page" do
  visit root_path
  click_link "Signup For Free Now"
  page.should have_content("Signup")
end

我收到错误消息:

Failure/Error: visit root_path
NameError: undefined local variable or method `root_path' for #<RSpec...>

当我尝试使用visit "/" 运行测试时,它工作正常。其他 gem 版本是:

  • 导轨 3.2.1
  • rspec 2.11.0
  • 机架测试 0.6.2

对于路径问题的原因有什么想法吗?

【问题讨论】:

标签: ruby-on-rails-3 capybara rspec-rails


【解决方案1】:

运行“bundle update rspec-rails”来获取版本 2.12.0 为我解决了同样的问题。

【讨论】:

  • 是的!这样做!谢谢尼尔斯!
猜你喜欢
  • 2016-05-30
  • 2016-08-22
  • 1970-01-01
  • 2021-01-10
  • 1970-01-01
  • 2020-03-07
  • 2018-09-02
  • 2018-08-29
  • 2021-03-28
相关资源
最近更新 更多