diff options
author | Drew Blessing <drew@gitlab.com> | 2016-06-16 15:11:09 -0500 |
---|---|---|
committer | Drew Blessing <drew@gitlab.com> | 2016-06-22 16:10:55 -0500 |
commit | 938f2b9979e8aae74307571d2c56df3f9b2981f5 (patch) | |
tree | d413a6f5a993e7aee6fe48f4e960b85b35f80037 /spec/lib | |
parent | 98cede7ebeae9dac994b35b66be6aab14eb932b3 (diff) | |
download | gitlab-ce-938f2b9979e8aae74307571d2c56df3f9b2981f5.tar.gz |
Fix subsequent SAML sign ins
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/saml/user_spec.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/lib/gitlab/saml/user_spec.rb b/spec/lib/gitlab/saml/user_spec.rb index 84c21ceefd9..2753aecc1f4 100644 --- a/spec/lib/gitlab/saml/user_spec.rb +++ b/spec/lib/gitlab/saml/user_spec.rb @@ -164,7 +164,14 @@ describe Gitlab::Saml::User, lib: true do end context 'and LDAP user has an account already' do - let!(:existing_user) { create(:omniauth_user, email: 'john@mail.com', extern_uid: 'uid=user1,ou=People,dc=example', provider: 'ldapmain', username: 'john') } + before do + create(:omniauth_user, + email: 'john@mail.com', + extern_uid: 'uid=user1,ou=People,dc=example', + provider: 'ldapmain', + username: 'john') + end + it 'adds the omniauth identity to the LDAP account' do saml_user.save @@ -177,6 +184,15 @@ describe Gitlab::Saml::User, lib: true do { provider: 'saml', extern_uid: uid } ]) end + + it 'saves successfully on subsequent tries, when both identities are present' do + saml_user.save + local_saml_user = described_class.new(auth_hash) + local_saml_user.save + + expect(local_saml_user.gl_user).to be_valid + expect(local_saml_user.gl_user).to be_persisted + end end context 'user has SAML user, and wants to add their LDAP identity' do |