mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-27 12:28:48 +01:00
Merge pull request #36 from 02strich/896e496f83c92fb0326dceb56a0fcf007e7327da
Fixing failing cucumber test
This commit is contained in:
commit
0fc4318163
2 changed files with 4 additions and 4 deletions
|
|
@ -225,8 +225,6 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def salted(s)
|
||||
"#{Tracks::Config.salt}--#{s}--"
|
||||
end
|
||||
|
|
@ -239,6 +237,8 @@ protected
|
|||
BCrypt::Password.create s
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def crypt_password
|
||||
return if password.blank?
|
||||
write_attribute("crypted_password", hash(password)) if password == password_confirmation
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ Given /^the following user records with hash algorithm$/ do |table|
|
|||
BCrypt::Password.new(user.crypted_password).should == password
|
||||
when 'sha1'
|
||||
user.password = user.password_confirmation = nil
|
||||
user.write_attribute :crypted_password, User.sha1( password )
|
||||
user.write_attribute :crypted_password, user.sha1(password)
|
||||
user.save
|
||||
user.reload
|
||||
user.crypted_password.should == User.sha1(password)
|
||||
user.crypted_password.should == user.sha1(password)
|
||||
else
|
||||
raise "Unknown hashing algorithm: #{algorithm}"
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue