Write unit test for bug fix

This commit is contained in:
Andy Geers 2015-11-18 22:19:36 +00:00
parent 8a8887ea82
commit d3f521925e
1 changed files with 10 additions and 0 deletions

View File

@ -250,6 +250,16 @@ class ConfirmableTest < ActiveSupport::TestCase
assert user.reload.active_for_authentication?
end
test 'should not break when a user tries to reset their password in the case where confirmation is not required and confirm_within is set' do
swap Devise, confirm_within: 3.days do
user = create_user
user.instance_eval { def confirmation_required?; false end }
user.confirmation_sent_at = nil
user.save
assert user.reload.confirm!
end
end
test 'should find a user to send email instructions for the user confirm its email by authentication_keys' do
swap Devise, authentication_keys: [:username, :email] do
user = create_user