1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Adding tests for reset_password_keys and unlock_keys

This commit is contained in:
Richard Aday 2010-12-30 01:15:43 +08:00 committed by José Valim
parent 038eb321d4
commit 88d4aca2c4
2 changed files with 18 additions and 0 deletions

View file

@ -186,6 +186,15 @@ class LockableTest < ActiveSupport::TestCase
end
end
test 'should require all unlock_keys' do
swap Devise, :unlock_keys => [:username, :email] do
user = create_user
unlock_user = User.send_unlock_instructions(:email => user.email)
assert_not unlock_user.persisted?
assert_equal "can't be blank", unlock_user.errors[:username].join
end
end
test 'should not be able to send instructions if the user is not locked' do
user = create_user
assert_not user.resend_unlock_token

View file

@ -94,6 +94,15 @@ class RecoverableTest < ActiveSupport::TestCase
end
end
test 'should require all reset_password_keys' do
swap Devise, :reset_password_keys => [:username, :email] do
user = create_user
reset_password_user = User.send_reset_password_instructions(:email => user.email)
assert_not reset_password_user.persisted?
assert_equal "can't be blank", reset_password_user.errors[:username].join
end
end
test 'should reset reset_password_token before send the reset instructions email' do
user = create_user
token = user.reset_password_token