2012-09-12 02:23:16 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Gitlab::Auth do
|
|
|
|
let(:gl_auth) { Gitlab::Auth.new }
|
|
|
|
|
2013-09-03 17:53:13 -04:00
|
|
|
describe :find do
|
2012-09-12 02:23:16 -04:00
|
|
|
before do
|
2013-09-03 17:53:13 -04:00
|
|
|
@user = create(
|
|
|
|
:user,
|
|
|
|
username: 'john',
|
2013-11-25 14:36:17 -05:00
|
|
|
password: '88877711',
|
|
|
|
password_confirmation: '88877711'
|
2012-09-12 02:23:16 -04:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2013-09-03 17:53:13 -04:00
|
|
|
it "should find user by valid login/password" do
|
2013-11-25 14:36:17 -05:00
|
|
|
gl_auth.find('john', '88877711').should == @user
|
2012-09-12 02:23:16 -04:00
|
|
|
end
|
|
|
|
|
2013-09-03 17:53:13 -04:00
|
|
|
it "should not find user with invalid password" do
|
2013-11-25 14:36:17 -05:00
|
|
|
gl_auth.find('john', 'invalid11').should_not == @user
|
2012-09-12 02:23:16 -04:00
|
|
|
end
|
|
|
|
|
2013-09-03 17:53:13 -04:00
|
|
|
it "should not find user with invalid login and password" do
|
2013-11-25 14:36:17 -05:00
|
|
|
gl_auth.find('jon', 'invalid11').should_not == @user
|
2013-03-11 02:44:45 -04:00
|
|
|
end
|
2012-09-12 02:23:16 -04:00
|
|
|
end
|
|
|
|
end
|