summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-03-27 07:59:35 +0000
committerDouwe Maan <douwe@gitlab.com>2018-03-27 07:59:35 +0000
commitab8f13c3ef6e07eb8d44805dc9eef4b008e1bbe9 (patch)
tree69458b928b5ba00318093af86e3f0c24251e7d4a /spec
parent0efbcc6c12f821606763569e2ac6c5038269436f (diff)
parent7d01792614e48c8f94307d660298014cd01cb79c (diff)
downloadgitlab-ce-ab8f13c3ef6e07eb8d44805dc9eef4b008e1bbe9.tar.gz
Merge branch 'fix/ldap_wihtout_user' into 'master'
Fix LDAP login without user in DB See merge request gitlab-org/gitlab-ce!17988
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/auth_spec.rb14
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