diff options
author | Horatiu Eugen Vlad <horatiu@vlad.eu> | 2018-03-26 11:23:54 +0200 |
---|---|---|
committer | Horatiu Eugen Vlad <horatiu@vlad.eu> | 2018-03-27 09:21:17 +0200 |
commit | 7d01792614e48c8f94307d660298014cd01cb79c (patch) | |
tree | c5981e90b915ee09871a6505193f4c9fc5ab65dd /spec | |
parent | 391732a2c1b04baf565c77f2788a1ec035b1d85e (diff) | |
download | gitlab-ce-7d01792614e48c8f94307d660298014cd01cb79c.tar.gz |
Fix LDAP login without user in DB
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/auth_spec.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/lib/gitlab/auth_spec.rb b/spec/lib/gitlab/auth_spec.rb index f969f9e8e38..18cef8ec996 100644 --- a/spec/lib/gitlab/auth_spec.rb +++ b/spec/lib/gitlab/auth_spec.rb @@ -315,13 +315,19 @@ describe Gitlab::Auth do it "tries to autheticate with db before ldap" do expect(Gitlab::Auth::LDAP::Authentication).not_to receive(:login) - gl_auth.find_with_user_password(username, password) + expect(gl_auth.find_with_user_password(username, password)).to eq(user) + end + + it "does not find user by using ldap as fallback to for authentication" do + expect(Gitlab::Auth::LDAP::Authentication).to receive(:login).and_return(nil) + + expect(gl_auth.find_with_user_password('ldap_user', 'password')).to be_nil end - it "uses ldap as fallback to for authentication" do - expect(Gitlab::Auth::LDAP::Authentication).to receive(:login) + it "find new user by using ldap as fallback to for authentication" do + expect(Gitlab::Auth::LDAP::Authentication).to receive(:login).and_return(user) - gl_auth.find_with_user_password('ldap_user', 'password') + expect(gl_auth.find_with_user_password('ldap_user', 'password')).to eq(user) end end |