diff options
author | George Claghorn <george@basecamp.com> | 2018-06-25 18:16:58 -0400 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2018-06-25 18:16:58 -0400 |
commit | 3110caecbebdad7300daaf26bfdff39efda99e25 (patch) | |
tree | 7539316cfa54a252d9711854ec230300da73dba4 /activejob/test/cases | |
parent | 83247916c934a92f0f9d69ee13cd8532c3d16d0e (diff) | |
download | rails-3110caecbebdad7300daaf26bfdff39efda99e25.tar.gz rails-3110caecbebdad7300daaf26bfdff39efda99e25.tar.bz2 rails-3110caecbebdad7300daaf26bfdff39efda99e25.zip |
Allow passing multiple exceptions to retry_on/discard_on
Diffstat (limited to 'activejob/test/cases')
-rw-r--r-- | activejob/test/cases/exceptions_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
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 |