devise: undefined method `user' for nil:NilClass when test sign in with rspec, warden is nil

Rails 4.2 & Mongoid 4.0.1 & devise 3.4.1 This occured when I test the sign_in method by Rspec in file sessions_controller_spec.rb, and the error is at …gem/…/devise/controller/sign_in_out.rb at line 36:

elsif warden.user(scope) == resource && !options.delete(:force)

it seems that something wrong and result in “warden” is nil the demo repo is here: https://github.com/veetase/smarto

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 19 (4 by maintainers)

Most upvoted comments

I am aware of some of these issues. It is also on my to do list. Thanks for pointing them out. I will work on fixing them.