Commit 869246d0 authored by Blair Lunceford's avatar Blair Lunceford

Apply suggested changes

- Add additional test
- Rename variable in auto_link_user? setting
parent 686b1dd9
......@@ -273,11 +273,11 @@ module Gitlab
end
def auto_link_user?
providers = Gitlab.config.omniauth.auto_link_user
if providers.is_a?(Array)
providers.include?(auth_hash.provider)
auto_link = Gitlab.config.omniauth.auto_link_user
if auto_link.is_a?(Array)
auto_link.include?(auth_hash.provider)
else
providers
auto_link
end
end
end
......
......@@ -207,7 +207,19 @@ RSpec.describe Gitlab::Auth::OAuth::User do
stub_omniauth_config(auto_link_user: ['saml'])
end
include_examples "to verify compliance with allow_single_sign_on"
context "and a current GitLab user with a matching email" do
let!(:existing_user) { create(:user, email: 'john@mail.com', username: 'john') }
it "adds the OmniAuth identity to the GitLab user account" do
oauth_user.save
expect(gl_user).not_to be_valid
end
end
context "and no current GitLab user with a matching email" do
include_examples "to verify compliance with allow_single_sign_on"
end
end
context "with auto_link_user enabled for the correct provider" do
......
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