From d3f521925ecff8af46d2a44dad0d90d228d87d88 Mon Sep 17 00:00:00 2001 From: Andy Geers Date: Wed, 18 Nov 2015 22:19:36 +0000 Subject: [PATCH] Write unit test for bug fix --- test/models/confirmable_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/models/confirmable_test.rb b/test/models/confirmable_test.rb index 008996c0..5c1cf69a 100644 --- a/test/models/confirmable_test.rb +++ b/test/models/confirmable_test.rb @@ -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