summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/auth_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/lib/gitlab/auth_spec.rb b/spec/lib/gitlab/auth_spec.rb
index ef65e109585..551fb3fb5f6 100644
--- a/spec/lib/gitlab/auth_spec.rb
+++ b/spec/lib/gitlab/auth_spec.rb
@@ -26,5 +26,22 @@ describe Gitlab::Auth do
user = 'wrong'
expect( gl_auth.find(username, password) ).to_not eql user
end
+
+ context "with ldap enabled" do
+ before { Gitlab.config.ldap['enabled'] = true }
+ after { Gitlab.config.ldap['enabled'] = false }
+
+ it "tries to autheticate with db before ldap" do
+ expect(Gitlab::LDAP::User).not_to receive(:authenticate)
+
+ gl_auth.find(username, password)
+ end
+
+ it "uses ldap as fallback to for authentication" do
+ expect(Gitlab::LDAP::User).to receive(:authenticate)
+
+ gl_auth.find('ldap_user', 'password')
+ end
+ end
end
end