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

29 lines
655 B
Ruby
Raw Normal View History

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