Refactor gitlab auth tests
This commit is contained in:
parent
18f88a1b76
commit
f88b6d0330
1 changed files with 13 additions and 11 deletions
|
@ -4,25 +4,27 @@ describe Gitlab::Auth do
|
||||||
let(:gl_auth) { Gitlab::Auth.new }
|
let(:gl_auth) { Gitlab::Auth.new }
|
||||||
|
|
||||||
describe :find do
|
describe :find do
|
||||||
before do
|
let!(:user) do
|
||||||
@user = create(
|
create(:user,
|
||||||
:user,
|
username: username,
|
||||||
username: 'john',
|
password: password,
|
||||||
password: '88877711',
|
password_confirmation: password)
|
||||||
password_confirmation: '88877711'
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
let(:username) { 'john' }
|
||||||
|
let(:password) { 'my-secret' }
|
||||||
|
|
||||||
it "should find user by valid login/password" do
|
it "should find user by valid login/password" do
|
||||||
gl_auth.find('john', '88877711').should == @user
|
expect( gl_auth.find(username, password) ).to eql user
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should not find user with invalid password" do
|
it "should not find user with invalid password" do
|
||||||
gl_auth.find('john', 'invalid11').should_not == @user
|
password = 'wrong'
|
||||||
|
expect( gl_auth.find(username, password) ).to_not eql user
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should not find user with invalid login and password" do
|
it "should not find user with invalid login" do
|
||||||
gl_auth.find('jon', 'invalid11').should_not == @user
|
user = 'wrong'
|
||||||
|
expect( gl_auth.find(username, password) ).to_not eql user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue