gitlab-org--gitlab-foss/spec/lib/auth_spec.rb

29 lines
655 B
Ruby
Raw Normal View History

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',
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
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
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
gl_auth.find('jon', 'invalid11').should_not == @user
end
2012-09-12 06:23:16 +00:00
end
end