diff options
| author | Jan-Willem van der Meer <mail@jewilmeer.nl> | 2014-09-08 13:26:25 +0200 |
|---|---|---|
| committer | Jan-Willem van der Meer <mail@jewilmeer.nl> | 2014-09-08 13:26:25 +0200 |
| commit | f27830fa4c11548279b5eed68e92b6f352ad4a9f (patch) | |
| tree | 046b1f1828587dbf5e1460d7267d863345726714 /spec/lib | |
| parent | f88b6d03306be1ec487a0746512f8d02722da435 (diff) | |
| download | gitlab-ce-f27830fa4c11548279b5eed68e92b6f352ad4a9f.tar.gz | |
Ensure Gitlab::LDAP::authentication is tested
Diffstat (limited to 'spec/lib')
| -rw-r--r-- | spec/lib/gitlab/auth_spec.rb | 17 |
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 |
