mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-02 15:28:50 +01:00
Fixed User specs broken in commit b33044
Expressions '...should == @user' caused specs to fail because of ArgumentError in 'User authentication resets password' wrong number of arguments (0 for 1) Replacing expectations declared for User objects with expectations declared for their id fields solves the problem and doesn't change specs' logic.
This commit is contained in:
parent
e5708f5ce7
commit
e221264e74
2 changed files with 6 additions and 5 deletions
4
spec/fixtures/users.yml
vendored
4
spec/fixtures/users.yml
vendored
|
|
@ -1,7 +1,7 @@
|
|||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
||||
admin_user:
|
||||
login: admin
|
||||
crypted_password: <%= BCrypt::Password.create("#{Tracks::Config.salt}--abracadabra--").to_s %>
|
||||
crypted_password: <%= BCrypt::Password.create("abracadabra") %>
|
||||
token: <%= Digest::SHA1.hexdigest("adminSat Feb 25 17:14:00 GMT 20060.236961325863376") %>
|
||||
is_admin: true
|
||||
first_name: Admin
|
||||
|
|
@ -10,7 +10,7 @@ admin_user:
|
|||
|
||||
other_user:
|
||||
login: jane
|
||||
crypted_password: <%= BCrypt::Password.create("#{Tracks::Config.salt}--sesame--").to_s %>
|
||||
crypted_password: <%= BCrypt::Password.create("sesame") %>
|
||||
token: <%= Digest::SHA1.hexdigest("janeSun Feb 19 14:42:45 GMT 20060.408173979260027") %>
|
||||
is_admin: false
|
||||
first_name: Jane
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ describe User do
|
|||
end
|
||||
|
||||
it 'authenticates user' do
|
||||
User.authenticate('simon', 'foobarspam').should == @user
|
||||
User.authenticate('simon', 'foobarspam').id.should be @user.id
|
||||
end
|
||||
|
||||
it 'resets password' do
|
||||
|
|
@ -117,12 +117,13 @@ describe User do
|
|||
:password => 'new password',
|
||||
:password_confirmation => 'new password'
|
||||
)
|
||||
User.authenticate('simon', 'new password').should == @user
|
||||
User.authenticate('simon', 'foobarspam').should be_nil
|
||||
User.authenticate('simon', 'new password').id.should be @user.id
|
||||
end
|
||||
|
||||
it 'does not rehash password after update of login' do
|
||||
@user.update_attribute(:login, 'foobar')
|
||||
User.authenticate('foobar', 'foobarspam').should == @user
|
||||
User.authenticate('foobar', 'foobarspam').id.should be @user.id
|
||||
end
|
||||
|
||||
it 'sets remember token' do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue