module Devise::Test::ControllerHelpers
def sign_in(resource, deprecated = nil, scope: nil)
sign_in users(:alice)
Examples:
should be signed in with.
* +scope+ - An optional +Symbol+ with the scope where the resource
* +resource+ - The resource that should be authenticated
This method bypass any warden authentication callback.
sign_in a given resource by storing its keys in the session.
def sign_in(resource, deprecated = nil, scope: nil) if deprecated.present? scope = resource resource = deprecated ActiveSupport::Deprecation.warn <<-DEPRECATION.strip_heredoc [Devise] sign_in(:#{scope}, resource) on controller tests is deprecated and will be removed from Devise. Please use sign_in(resource, scope: :#{scope}) instead. DEPRECATION end scope ||= Devise::Mapping.find_scope!(resource) warden.instance_variable_get(:@users).delete(scope) warden.session_serializer.store(resource, scope) end