Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 3 Capybara 2.0.0.beta4具有未定义的路径_Ruby On Rails 3_Capybara_Rspec Rails - Fatal编程技术网

Ruby on rails 3 Capybara 2.0.0.beta4具有未定义的路径

Ruby on rails 3 Capybara 2.0.0.beta4具有未定义的路径,ruby-on-rails-3,capybara,rspec-rails,Ruby On Rails 3,Capybara,Rspec Rails,我刚刚用rspec rails 2.11.4升级到Capybara 2.0.0.beta4,并根据rspec rails存储库中的建议,将请求规范(我只有一个)移动到spec/features。 当我现在运行测试时,它找不到任何路径。因此,对于以下试块: it "should be able to access the signup page through the front page" do visit root_path click_link "Signup For Free No

我刚刚用rspec rails 2.11.4升级到Capybara 2.0.0.beta4,并根据rspec rails存储库中的建议,将请求规范(我只有一个)移动到
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...>
故障/错误:访问根路径
NameError:未定义的局部变量或方法“根路径”#
当我尝试使用
visit”/“
运行测试时,效果很好。其他gem版本包括:

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

有什么办法可以解释路径问题吗?

运行“bundle update rspec rails”让2.12.0版为我解决了同样的问题。

有!就是这样!谢谢你,尼尔斯!如果不使用rspec,也可以添加命名路由: