我无法弄清楚为什么这些测试没有突然传递:
Failure/Error: @user = test_sign_in(Factory(:user))
NoMethodError:
undefined method `test_sign_in' for #<RSpec::Core::ExampleGroup::Nested_3::Nested_1::Nested_2:0x00000100a908e8>
有一堆在test_sign_in上失败,然后是另一个失败的测试:
1) SessionsController POST 'create' with valid email and password should sign the user in
Failure/Error: controller.should be_signed_in
NoMethodError:
undefined method `authenticate?' for nil:NilClass
# ./spec/controllers/sessions_controller_spec.rb:51:in `block (4 levels) in <top (required)>'
2) SessionsController DELETE 'destroy' should sign a user out
Failure/Error: controller.should_not be_signed_in
NoMethodError:
undefined method `authenticate?' for nil:NilClass
# ./spec/controllers/sessions_controller_spec.rb:66:in `block (3 levels) in <top (required)>'
3) UsersController POST 'create' success should sign the user in
Failure/Error: controller.should be_signed_in
NoMethodError:
undefined method `authenticate?' for nil:NilClass
# ./spec/controllers/users_controller_spec.rb:171:in `block (4 levels) in <top (required)>'
4) Users sign in/out success should sign a user in and out
Failure/Error: controller.should be_signed_in
expected signed_in? to return true, got false
# ./spec/requests/users_spec.rb:68:in `block (4 levels) in <top (required)>'