diff options
Diffstat (limited to 'test/jobs')
-rw-r--r-- | test/jobs/rescue_job.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/test/jobs/rescue_job.rb b/test/jobs/rescue_job.rb index 66b28d768e..acf2b81515 100644 --- a/test/jobs/rescue_job.rb +++ b/test/jobs/rescue_job.rb @@ -1,13 +1,18 @@ class RescueJob < ActiveJob::Base - rescue_from(StandardError) do - $BUFFER << "rescued from StandardError" + class OtherError < StandardError; end + + rescue_from(ArgumentError) do + $BUFFER << "rescued from ArgumentError" arguments[0] = "DIFFERENT!" retry_now end def perform(person = "david") - if person == "david" - raise "Hair too good" + case person + when "david" + raise ArgumentError, "Hair too good" + when "other" + raise OtherError else $BUFFER << "performed beautifully" end |