summaryrefslogtreecommitdiff
path: root/spec/support/helpers/login_helpers.rb
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2018-04-23 00:17:49 +0100
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2018-05-21 16:43:12 +0100
commitb98a88cfe9033b5d694ac237a50ad4fe923ad95d (patch)
tree445d5f468de49850cc067f6cc39566eac6645ccc /spec/support/helpers/login_helpers.rb
parentad9e00917fdff0c311f4755e8be764016ddd18e1 (diff)
downloadgitlab-ce-b98a88cfe9033b5d694ac237a50ad4fe923ad95d.tar.gz
Backport helpers from GroupSAML failure messagesce-jej/saml-failure-messages
Diffstat (limited to 'spec/support/helpers/login_helpers.rb')
-rw-r--r--spec/support/helpers/login_helpers.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/support/helpers/login_helpers.rb b/spec/support/helpers/login_helpers.rb
index 72e5c2d66dd..f7b71bf42e3 100644
--- a/spec/support/helpers/login_helpers.rb
+++ b/spec/support/helpers/login_helpers.rb
@@ -132,6 +132,14 @@ module LoginHelpers
env['omniauth.auth'] = OmniAuth.config.mock_auth[provider.to_sym]
end
+ def stub_omniauth_failure(strategy, message_key, exception = nil)
+ env = @request.env
+
+ env['omniauth.error'] = exception
+ env['omniauth.error.type'] = message_key.to_sym
+ env['omniauth.error.strategy'] = strategy
+ end
+
def stub_omniauth_saml_config(messages)
set_devise_mapping(context: Rails.application)
Rails.application.routes.disable_clear_and_finalize = true