From 3110caecbebdad7300daaf26bfdff39efda99e25 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Mon, 25 Jun 2018 18:16:58 -0400 Subject: Allow passing multiple exceptions to retry_on/discard_on --- activejob/test/cases/exceptions_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'activejob/test/cases/exceptions_test.rb') diff --git a/activejob/test/cases/exceptions_test.rb b/activejob/test/cases/exceptions_test.rb index 15938e3fc7..47d4e3c0c2 100644 --- a/activejob/test/cases/exceptions_test.rb +++ b/activejob/test/cases/exceptions_test.rb @@ -113,4 +113,22 @@ class ExceptionsTest < ActiveJob::TestCase end end end + + test "successfully retry job throwing one of two retryable exceptions" do + perform_enqueued_jobs do + RetryJob.perform_later "SecondRetryableErrorOfTwo", 3 + + assert_equal [ + "Raised SecondRetryableErrorOfTwo for the 1st time", + "Raised SecondRetryableErrorOfTwo for the 2nd time", + "Successfully completed job" ], JobBuffer.values + end + end + + test "discard job throwing one of two discardable exceptions" do + perform_enqueued_jobs do + RetryJob.perform_later "SecondDiscardableErrorOfTwo", 2 + assert_equal [ "Raised SecondDiscardableErrorOfTwo for the 1st time" ], JobBuffer.values + end + end end -- cgit v1.2.3