diff options
author | Jan-Willem van der Meer <mail@jewilmeer.nl> | 2014-09-08 15:11:39 +0400 |
---|---|---|
committer | Jan-Willem van der Meer <mail@jewilmeer.nl> | 2014-09-08 15:11:39 +0400 |
commit | f88b6d03306be1ec487a0746512f8d02722da435 (patch) | |
tree | 19baf12fb958457c511db1e51e09e40d8d9f078f /spec/lib/gitlab/auth_spec.rb | |
parent | 18f88a1b7627fe08d5f3e299276709101d091d48 (diff) |
Refactor gitlab auth tests
Diffstat (limited to 'spec/lib/gitlab/auth_spec.rb')
-rw-r--r-- | spec/lib/gitlab/auth_spec.rb | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/spec/lib/gitlab/auth_spec.rb b/spec/lib/gitlab/auth_spec.rb index 073b811c3fb..ef65e109585 100644 --- a/spec/lib/gitlab/auth_spec.rb +++ b/spec/lib/gitlab/auth_spec.rb @@ -4,25 +4,27 @@ describe Gitlab::Auth do let(:gl_auth) { Gitlab::Auth.new } describe :find do - before do - @user = create( - :user, - username: 'john', - password: '88877711', - password_confirmation: '88877711' - ) + let!(:user) do + create(:user, + username: username, + password: password, + password_confirmation: password) end + let(:username) { 'john' } + let(:password) { 'my-secret' } 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 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 - it "should not find user with invalid login and password" do - gl_auth.find('jon', 'invalid11').should_not == @user + it "should not find user with invalid login" do + user = 'wrong' + expect( gl_auth.find(username, password) ).to_not eql user end end end |