From a0cd4655baa68e532de93d0e5a2af911f1ab3b33 Mon Sep 17 00:00:00 2001 From: Kacper Walanus Date: Tue, 24 Nov 2015 01:54:03 +0100 Subject: [PATCH] test for save in after_create hook breaks devise confirmation [3787] --- test/models/confirmable_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/models/confirmable_test.rb b/test/models/confirmable_test.rb index 008996c0..d9f2a313 100644 --- a/test/models/confirmable_test.rb +++ b/test/models/confirmable_test.rb @@ -476,4 +476,18 @@ class ReconfirmableTest < ActiveSupport::TestCase :unconfirmed_email ] end + + test 'should not require reconfirmation after creating a record' do + user = create_admin + assert !user.pending_reconfirmation? + end + + test 'should not require reconfirmation after creating a record with #save called in callback' do + class Admin::WithSaveInCallback < Admin + after_create :save + end + + user = Admin::WithSaveInCallback.create(valid_attributes.except(:username)) + assert !user.pending_reconfirmation? + end end