mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-10 07:18:14 -05:00
* [#4245] Allowing password to nil * Set encrypted password to nil if password is nil * [#4245] Fixing the build * Removed unnecessary code
This commit is contained in:
committed by
Leonardo Tegon
parent
fa067b31c6
commit
3aedbf0a4d
@@ -117,9 +117,9 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
|
||||
assert_nil user.authenticatable_salt
|
||||
end
|
||||
|
||||
test 'should not generate a hashed password if password is blank' do
|
||||
assert_blank new_user(password: nil).encrypted_password
|
||||
assert_blank new_user(password: '').encrypted_password
|
||||
test 'should set encrypted password to nil if password is nil' do
|
||||
assert_nil new_user(password: nil).encrypted_password
|
||||
assert_nil new_user(password: '').encrypted_password
|
||||
end
|
||||
|
||||
test 'should hash password again if password has changed' do
|
||||
@@ -307,4 +307,11 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
test 'nil password should be invalid if password is set to nil' do
|
||||
user = User.create(email: "HEllO@example.com", password: "12345678")
|
||||
user.password = nil
|
||||
refute user.valid_password?('12345678')
|
||||
refute user.valid_password?(nil)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user