diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-01-20 14:53:41 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-01-20 14:53:41 +0100 |
commit | c23ca0b0b5640d9cbf3fbfd446916a228b581b2f (patch) | |
tree | 1aa14035e6484f0f1c16e71746391d6e6a0277b1 /spec/lib | |
parent | 701513dcc7afb403372bc738642a9a52e9be5983 (diff) | |
parent | 481644ca7c9f763d4646ad557cc3bcf8f4f71816 (diff) | |
download | gitlab-ce-c23ca0b0b5640d9cbf3fbfd446916a228b581b2f.tar.gz |
Merge branch 'master' into issue_3945
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/ldap/user_spec.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/lib/gitlab/ldap/user_spec.rb b/spec/lib/gitlab/ldap/user_spec.rb index 1e755259dae..03199a2523e 100644 --- a/spec/lib/gitlab/ldap/user_spec.rb +++ b/spec/lib/gitlab/ldap/user_spec.rb @@ -37,7 +37,7 @@ describe Gitlab::LDAP::User, lib: true do end it "dont marks existing ldap user as changed" do - create(:omniauth_user, email: 'john@example.com', extern_uid: 'my-uid', provider: 'ldapmain') + create(:omniauth_user, email: 'john@example.com', extern_uid: 'my-uid', provider: 'ldapmain', ldap_email: true) expect(ldap_user.changed?).to be_falsey end end @@ -110,6 +110,32 @@ describe Gitlab::LDAP::User, lib: true do end end + describe 'updating email' do + context "when LDAP sets an email" do + it "has a real email" do + expect(ldap_user.gl_user.email).to eq(info[:email]) + end + + it "has ldap_email set to true" do + expect(ldap_user.gl_user.ldap_email?).to be(true) + end + end + + context "when LDAP doesn't set an email" do + before do + info.delete(:email) + end + + it "has a temp email" do + expect(ldap_user.gl_user.temp_oauth_email?).to be(true) + end + + it "has ldap_email set to false" do + expect(ldap_user.gl_user.ldap_email?).to be(false) + end + end + end + describe 'blocking' do def configure_block(value) allow_any_instance_of(Gitlab::LDAP::Config). |