我測試test/models/user_test.rb
與軌測試中無法識別路徑
test "should validate login" do
visit new_user_session
fill_in "email", with: '[email protected]'
fill_in "password", with: 'testtest'
click_button "Sign in"
assert_equal some_url, current_path
end
當我運行ruby -Itest test/models/user_test.rb
,如果我改變new_user_session
任何其他path
是rake routes
提供我收到此錯誤信息
UserTest#test_should_validate_login:
NameError: undefined local variable or method `new_user_session' for #<UserTest:0x007fcbd8e98378>
test/models/user_test.rb:22:in `block in <class:UserTest>'
,我得到了相同的信息,即undefined local variable or method
path'`。有人可以幫忙嗎?
是的,我誤導了謝謝 – user1611830