2012-11-12 22 views
5

我剛剛升級到水豚2.0.0.beta4 rspec-rails 2.11.4和我移動我的請求規範(我只有一個)spec/features建議由Capybara-Readme在RSpec-Rails存儲庫。 當我現在運行測試時,它找不到任何路徑。因此,對於下面的測試塊:水豚2.0.0.beta4有未定義的路徑

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 "/"運行測試它工作正常。其他寶石版本:

  • 軌3.2.1
  • rspec的2.11.0
  • 機架測試0.6.2

是有原因的路徑問題的任何想法?

+0

如果您不使用rspec,也可以添加命名的路由:http://stackoverflow.com/questions/9475857/rspec-and-named-routes – cbron

回答

11

運行「bundle update rspec-rails」以獲得版本2.12.0解決了同樣的問題。

+0

是的!這樣做!謝謝Nils! – jlstr

+0

輝煌。謝謝。 – Ted

相關問題