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