Commit c4716d42 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'ce-11278-fix-flaky-order-dependent-specs' into 'master'

Revert Rails.application.env_config after using mock_auth_hash

See merge request gitlab-org/gitlab-ce!27596
parents 6a0e9a91 a16d7e41
...@@ -9,10 +9,14 @@ describe OmniauthCallbacksController, type: :controller do ...@@ -9,10 +9,14 @@ describe OmniauthCallbacksController, type: :controller do
let(:user) { create(:omniauth_user, extern_uid: extern_uid, provider: provider) } let(:user) { create(:omniauth_user, extern_uid: extern_uid, provider: provider) }
before do before do
mock_auth_hash(provider.to_s, +extern_uid, user.email) @original_env_config_omniauth_auth = mock_auth_hash(provider.to_s, +extern_uid, user.email)
stub_omniauth_provider(provider, context: request) stub_omniauth_provider(provider, context: request)
end end
after do
Rails.application.env_config['omniauth.auth'] = @original_env_config_omniauth_auth
end
context 'when the user is on the last sign in attempt' do context 'when the user is on the last sign in attempt' do
let(:extern_uid) { 'my-uid' } let(:extern_uid) { 'my-uid' }
......
...@@ -25,9 +25,13 @@ shared_context 'Ldap::OmniauthCallbacksController' do ...@@ -25,9 +25,13 @@ shared_context 'Ldap::OmniauthCallbacksController' do
described_class.define_providers! described_class.define_providers!
Rails.application.reload_routes! Rails.application.reload_routes!
mock_auth_hash(provider.to_s, uid, user.email) @original_env_config_omniauth_auth = mock_auth_hash(provider.to_s, uid, user.email)
stub_omniauth_provider(provider, context: request) stub_omniauth_provider(provider, context: request)
allow(Gitlab::Auth::LDAP::Access).to receive(:allowed?).and_return(valid_login?) allow(Gitlab::Auth::LDAP::Access).to receive(:allowed?).and_return(valid_login?)
end end
after do
Rails.application.env_config['omniauth.auth'] = @original_env_config_omniauth_auth
end
end end
...@@ -118,7 +118,10 @@ module LoginHelpers ...@@ -118,7 +118,10 @@ module LoginHelpers
response_object: response_object response_object: response_object
} }
}) })
original_env_config_omniauth_auth = Rails.application.env_config['omniauth.auth']
Rails.application.env_config['omniauth.auth'] = OmniAuth.config.mock_auth[provider.to_sym] Rails.application.env_config['omniauth.auth'] = OmniAuth.config.mock_auth[provider.to_sym]
original_env_config_omniauth_auth
end end
def saml_xml(raw_saml_response) def saml_xml(raw_saml_response)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment