“undefined method `env' for nil:NilClass” in 'setup_controller_for_warden' error when testing Devise using Rspec

后端 未结 10 2033
陌清茗
陌清茗 2020-12-09 14:31

I\'m trying to create a spec for a sign out flow by using factorygirl to create a user and then use Devise\'s sign_in method to authenticate the user, then use

10条回答
  •  清歌不尽
    2020-12-09 15:10

    Here's my solution:

    class ActiveSupport::TestCase
      # all the normal stuff
    end
    
    class ActionController::TestCase
      include Devise::TestHelpers    
    end
    

提交回复
热议问题