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

后端 未结 10 2015
陌清茗
陌清茗 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条回答
  •  萌比男神i
    2020-12-09 15:16

    In Rails 5 you must include Devise::Test::IntegrationHelpers instead Devise::Test::ControllerHelpers:

    # rails_helper.rb
    config.include Devise::Test::IntegrationHelpers, type: :feature
    

    See more:

    • https://github.com/plataformatec/devise/issues/3913#issuecomment
    • https://github.com/plataformatec/devise/pull/4071

提交回复
热议问题