Devise provides Devise::Test::IntegrationHelpers for testing purposes. The documentation defines a helper method for signing in but forces a nil to the basic method login_as scope.
# Signs in a specific resource, mimicking a successful sign in operation through +Devise::SessionsController#create+.
# * +resource+ - The resource that should be authenticated
# * +scope+ - An optional +Symbol+ with the scope where the resource should be signed in with.
def sign_in(resource, scope: nil)
scope ||= Devise::Mapping.find_scope!(resource)
login_as(resource, scope: scope)
end
The goal is to create a helper method that will login with a host scope, where hostis an attribute of the Site class and thus a fixture ( i.e. sites(:one) )
However, login_as is a method internal to devise and not accessible to the testing enviornment AFAIK.
What helper method could be written to set a host upon sign_in ?