aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2018-10-03 15:36:40 -0400
committerGeorge Claghorn <george@basecamp.com>2018-10-03 15:36:40 -0400
commitb9e220aa41674c974f5a1e8c4fe1684596cab740 (patch)
tree1e8d62f9720db4736d6497c9a900b343335763a4 /test
parent7bf2cd437dd3b122aa1c8cb91c282cc9d699fc4c (diff)
downloadrails-b9e220aa41674c974f5a1e8c4fe1684596cab740.tar.gz
rails-b9e220aa41674c974f5a1e8c4fe1684596cab740.tar.bz2
rails-b9e220aa41674c974f5a1e8c4fe1684596cab740.zip
Terminate processing on bounce
Diffstat (limited to 'test')
-rw-r--r--test/unit/mailbox/callbacks_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/unit/mailbox/callbacks_test.rb b/test/unit/mailbox/callbacks_test.rb
index b6cfef9868..fccd89b9df 100644
--- a/test/unit/mailbox/callbacks_test.rb
+++ b/test/unit/mailbox/callbacks_test.rb
@@ -10,6 +10,21 @@ class CallbackMailbox < ActionMailbox::Base
end
end
+class BouncingCallbackMailbox < ActionMailbox::Base
+ before_processing { $before_processing = [ "Pre-bounce" ] }
+
+ before_processing do
+ bounce_with BounceMailer.bounce(to: mail.from)
+ $before_processing << "Bounce"
+ end
+
+ before_processing { $before_processing << "Post-bounce" }
+
+ def process
+ $processed = mail.subject
+ end
+end
+
class ActionMailbox::Base::CallbacksTest < ActiveSupport::TestCase
setup do
$before_processing = $after_processing = $around_processing = $processed = false
@@ -22,4 +37,11 @@ class ActionMailbox::Base::CallbacksTest < ActiveSupport::TestCase
assert_equal "Ran that too!", $after_processing
assert_equal "Ran that as well!", $around_processing
end
+
+ test "bouncing in a callback terminates processing" do
+ BouncingCallbackMailbox.receive @inbound_email
+ assert @inbound_email.bounced?
+ assert_equal [ "Pre-bounce", "Bounce" ], $before_processing
+ assert_not $processed
+ end
end