diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/controllers/omniauth_callbacks_controller_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/controllers/omniauth_callbacks_controller_spec.rb')
-rw-r--r-- | spec/controllers/omniauth_callbacks_controller_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/controllers/omniauth_callbacks_controller_spec.rb b/spec/controllers/omniauth_callbacks_controller_spec.rb index 4a47a4a2a53..9a142559fca 100644 --- a/spec/controllers/omniauth_callbacks_controller_spec.rb +++ b/spec/controllers/omniauth_callbacks_controller_spec.rb @@ -293,6 +293,18 @@ RSpec.describe OmniauthCallbacksController, type: :controller do expect(request.env['warden']).to be_authenticated end + + it 'sets the username and caller_id in the context' do + expect(controller).to receive(:atlassian_oauth2).and_wrap_original do |m, *args| + m.call(*args) + + expect(Gitlab::ApplicationContext.current) + .to include('meta.user' => user.username, + 'meta.caller_id' => 'OmniauthCallbacksController#atlassian_oauth2') + end + + post :atlassian_oauth2 + end end context 'for a new user' do @@ -454,6 +466,18 @@ RSpec.describe OmniauthCallbacksController, type: :controller do it 'doesn\'t link a new identity to the user' do expect { post :saml, params: { SAMLResponse: mock_saml_response } }.not_to change { user.identities.count } end + + it 'sets the username and caller_id in the context' do + expect(controller).to receive(:saml).and_wrap_original do |m, *args| + m.call(*args) + + expect(Gitlab::ApplicationContext.current) + .to include('meta.user' => user.username, + 'meta.caller_id' => 'OmniauthCallbacksController#saml') + end + + post :saml, params: { SAMLResponse: mock_saml_response } + end end end |