summaryrefslogtreecommitdiff
path: root/spec/lib/auth_spec.rb
blob: e05fde95731a6ff8ba3b3756be33e6d3695865a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require 'spec_helper'

describe Gitlab::Auth do
  let(:gl_auth) { Gitlab::Auth.new }

  describe :find do
    before do
      @user = create(
        :user,
        username: 'john',
        password: '888777',
        password_confirmation: '888777'
      )
    end

    it "should find user by valid login/password" do
      gl_auth.find('john', '888777').should == @user
    end

    it "should not find user with invalid password" do
      gl_auth.find('john', 'invalid').should_not == @user
    end

    it "should not find user with invalid login and password" do
      gl_auth.find('jon', 'invalid').should_not == @user
    end
  end
end