Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/omniauth_callbacks_controller_spec.rb')
-rw-r--r--spec/controllers/omniauth_callbacks_controller_spec.rb24
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