diff options
Diffstat (limited to 'spec/lib/gitlab/auth_spec.rb')
-rw-r--r-- | spec/lib/gitlab/auth_spec.rb | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/spec/lib/gitlab/auth_spec.rb b/spec/lib/gitlab/auth_spec.rb deleted file mode 100644 index 95fc7e16a11..00000000000 --- a/spec/lib/gitlab/auth_spec.rb +++ /dev/null @@ -1,54 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Auth do - let(:gl_auth) { Gitlab::Auth.new } - - describe :find do - let!(:user) do - create(:user, - username: username, - password: password, - password_confirmation: password) - end - let(:username) { 'John' } # username isn't lowercase, test this - let(:password) { 'my-secret' } - - it "should find user by valid login/password" do - expect( gl_auth.find(username, password) ).to eql user - end - - it 'should find user by valid email/password with case-insensitive email' do - expect(gl_auth.find(user.email.upcase, password)).to eql user - end - - it 'should find user by valid username/password with case-insensitive username' do - expect(gl_auth.find(username.upcase, password)).to eql user - end - - it "should not find user with invalid password" do - password = 'wrong' - expect( gl_auth.find(username, password) ).to_not eql user - end - - it "should not find user with invalid login" do - user = 'wrong' - expect( gl_auth.find(username, password) ).to_not eql user - end - - context "with ldap enabled" do - before { Gitlab::LDAP::Config.stub(enabled?: true) } - - it "tries to autheticate with db before ldap" do - expect(Gitlab::LDAP::Authentication).not_to receive(:login) - - gl_auth.find(username, password) - end - - it "uses ldap as fallback to for authentication" do - expect(Gitlab::LDAP::Authentication).to receive(:login) - - gl_auth.find('ldap_user', 'password') - end - end - end -end |