diff options
author | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-03-18 14:31:33 +0200 |
---|---|---|
committer | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-03-18 14:31:33 +0200 |
commit | 4d3e8ceea562683a8ee3a87a45ece6c476558446 (patch) | |
tree | a83c195a72ac7e32edb4888e733792302c13505f /spec/lib/gitlab/ldap/user_spec.rb | |
parent | 11dda8db29a4843026464c0a61f65ada20646e3b (diff) | |
parent | dadd28e317ace1e3d3a2a02926eb352832b97f08 (diff) | |
download | gitlab-ce-4d3e8ceea562683a8ee3a87a45ece6c476558446.tar.gz |
Merge branch 'master' into docs_select_version_to_install
Diffstat (limited to 'spec/lib/gitlab/ldap/user_spec.rb')
-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). |