summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-05-24 12:47:26 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-05-24 12:47:26 +0000
commit05170e0d4731da2bd1920c91f1e9c9cbed3c4f17 (patch)
tree99a71a075f67cb5339d949482c5d4f744915105a /spec
parent942fe5fe79f512b4c801fc887a1240a963b827d0 (diff)
parentb98a88cfe9033b5d694ac237a50ad4fe923ad95d (diff)
downloadgitlab-ce-05170e0d4731da2bd1920c91f1e9c9cbed3c4f17.tar.gz
Merge branch 'ce-jej/saml-failure-messages' into 'master'
[CE] Backport helpers from GroupSAML failure messages See merge request gitlab-org/gitlab-ce!19064
Diffstat (limited to 'spec')
-rw-r--r--spec/support/helpers/login_helpers.rb8
-rw-r--r--spec/support/helpers/routes_helpers.rb7
2 files changed, 15 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
diff --git a/spec/support/helpers/routes_helpers.rb b/spec/support/helpers/routes_helpers.rb
new file mode 100644
index 00000000000..c4129606418
--- /dev/null
+++ b/spec/support/helpers/routes_helpers.rb
@@ -0,0 +1,7 @@
+module RoutesHelpers
+ def fake_routes(&block)
+ @routes = @routes.dup
+ @routes.formatter.clear
+ ActionDispatch::Routing::Mapper.new(@routes).instance_exec(&block)
+ end
+end