2011-12-05 23 views
6

我有這個在我的users_spec.rbRails 3 rspec + capybara - current_path是否爲零?

scenario "Go to contact page" do 
    visit "/contact" 
    current_path.should == contact_path 
    end 

RSpec的運行之後,我得到

Failure/Error: current_path.should == contact_path 
     expected: "/contact" 
      got: nil (using ==) 

出於某種原因,似乎的current_path要返回nil。有沒有我失蹤的配置?

+0

事實證明,因爲webrat也包含在內,所以出現了某種衝突。我從我的gem文件中註釋掉了我的'webrat'(我沒有使用它)。它早些時候被包括在其他一些測試中(並且由於許多過時的教程)。 –

回答

1

作者回答:

Min Ming Lo

事實證明,因爲還包括webrat,有某種衝突 。我從我的寶石文件中註釋掉了我的webrat(我仍然不使用它)。它早些時候被包括在其他一些測試中 (也因爲許多過時的教程)。

相關問題