diff --git a/lib/devise/models/confirmable.rb b/lib/devise/models/confirmable.rb index 51ca45d4..ba7d71f8 100644 --- a/lib/devise/models/confirmable.rb +++ b/lib/devise/models/confirmable.rb @@ -39,6 +39,13 @@ module Devise after_update :send_confirmation_instructions, :if => :reconfirmation_required? end + def initialize(*args, &block) + @bypass_postpone = false + @reconfirmation_required = false + @skip_confirmation_notification = false + super + end + def self.required_fields(klass) required_methods = [:confirmation_token, :confirmed_at, :confirmation_sent_at] required_methods << :unconfirmed_email if klass.reconfirmable diff --git a/test/failure_app_test.rb b/test/failure_app_test.rb index 39b0e871..f543dfb1 100644 --- a/test/failure_app_test.rb +++ b/test/failure_app_test.rb @@ -80,9 +80,9 @@ class FailureTest < ActiveSupport::TestCase test 'setup a default message' do call_failure - assert_match /You are being/, @response.last.body - assert_match /redirected/, @response.last.body - assert_match /users\/sign_in/, @response.last.body + assert_match(/You are being/, @response.last.body) + assert_match(/redirected/, @response.last.body) + assert_match(/users\/sign_in/, @response.last.body) end test 'works for any navigational format' do diff --git a/test/integration/confirmable_test.rb b/test/integration/confirmable_test.rb index 1e20ec0d..627dbd74 100644 --- a/test/integration/confirmable_test.rb +++ b/test/integration/confirmable_test.rb @@ -275,7 +275,7 @@ class ConfirmationOnChangeTest < ActionDispatch::IntegrationTest visit_admin_confirmation_with_token(confirmation_token) assert_have_selector '#error_explanation' - assert_contain /Confirmation token(.*)invalid/ + assert_contain(/Confirmation token(.*)invalid/) visit_admin_confirmation_with_token(admin.confirmation_token) assert_contain 'Your account was successfully confirmed.' @@ -293,7 +293,7 @@ class ConfirmationOnChangeTest < ActionDispatch::IntegrationTest visit_admin_confirmation_with_token(admin.confirmation_token) assert_have_selector '#error_explanation' - assert_contain /Email.*already.*taken/ + assert_contain(/Email.*already.*taken/) assert admin.reload.pending_reconfirmation? end end diff --git a/test/models/serializable_test.rb b/test/models/serializable_test.rb index 946b304d..565b71fe 100644 --- a/test/models/serializable_test.rb +++ b/test/models/serializable_test.rb @@ -6,18 +6,18 @@ class SerializableTest < ActiveSupport::TestCase end test 'should not include unsafe keys on XML' do - assert_match /email/, @user.to_xml - assert_no_match /confirmation-token/, @user.to_xml + assert_match(/email/, @user.to_xml) + assert_no_match(/confirmation-token/, @user.to_xml) end test 'should not include unsafe keys on XML even if a new except is provided' do - assert_no_match /email/, @user.to_xml(:except => :email) - assert_no_match /confirmation-token/, @user.to_xml(:except => :email) + assert_no_match(/email/, @user.to_xml(:except => :email)) + assert_no_match(/confirmation-token/, @user.to_xml(:except => :email)) end test 'should include unsafe keys on XML if a force_except is provided' do - assert_no_match / :email) - assert_match /confirmation-token/, @user.to_xml(:force_except => :email) + assert_no_match(/ :email)) + assert_match(/confirmation-token/, @user.to_xml(:force_except => :email)) end test 'should not include unsafe keys on JSON' do