debian-mirror-gitlab/spec/support/devise_helpers.rb
2017-09-10 17:25:29 +05:30

14 lines
401 B
Ruby

module DeviseHelpers
# explicitly tells Devise which mapping to use
# this is needed when we are testing a Devise controller bypassing the router
def set_devise_mapping(context:)
env =
if context.respond_to?(:env_config)
context.env_config
elsif context.respond_to?(:env)
context.env
end
env['devise.mapping'] = Devise.mappings[:user] if env
end
end