aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/cases/rescue_test.rb
diff options
context:
space:
mode:
authorAbdelkader Boudih <terminale@gmail.com>2014-08-12 09:17:19 +0000
committerAbdelkader Boudih <terminale@gmail.com>2014-08-12 09:17:19 +0000
commita75f085941b2d6aed160f5f2f7e64e5fc7e03826 (patch)
tree23174b264983a15c3108ec912b355829c5f17a80 /activejob/test/cases/rescue_test.rb
parentb45b99894a60eda434abec94d133a1cfd8de2dda (diff)
parent14f74a8331f94150dfee653224de8fc837797709 (diff)
downloadrails-a75f085941b2d6aed160f5f2f7e64e5fc7e03826.tar.gz
rails-a75f085941b2d6aed160f5f2f7e64e5fc7e03826.tar.bz2
rails-a75f085941b2d6aed160f5f2f7e64e5fc7e03826.zip
Add 'activejob/' from commit '14f74a8331f94150dfee653224de8fc837797709'
git-subtree-dir: activejob git-subtree-mainline: b45b99894a60eda434abec94d133a1cfd8de2dda git-subtree-split: 14f74a8331f94150dfee653224de8fc837797709
Diffstat (limited to 'activejob/test/cases/rescue_test.rb')
-rw-r--r--activejob/test/cases/rescue_test.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/activejob/test/cases/rescue_test.rb b/activejob/test/cases/rescue_test.rb
new file mode 100644
index 0000000000..3d4831bc62
--- /dev/null
+++ b/activejob/test/cases/rescue_test.rb
@@ -0,0 +1,23 @@
+require 'helper'
+require 'jobs/rescue_job'
+
+require 'active_support/core_ext/object/inclusion'
+
+class RescueTest < ActiveSupport::TestCase
+ setup do
+ $BUFFER = []
+ end
+
+ test 'rescue perform exception with retry' do
+ job = RescueJob.new
+ job.execute(SecureRandom.uuid, "david")
+ assert_equal [ "rescued from ArgumentError", "performed beautifully" ], $BUFFER
+ end
+
+ test 'let through unhandled perform exception' do
+ job = RescueJob.new
+ assert_raises(RescueJob::OtherError) do
+ job.execute(SecureRandom.uuid, "other")
+ end
+ end
+end