aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/rescuable_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/rescuable_test.rb')
-rw-r--r--activesupport/test/rescuable_test.rb33
1 files changed, 16 insertions, 17 deletions
diff --git a/activesupport/test/rescuable_test.rb b/activesupport/test/rescuable_test.rb
index e42e6d2973..7e5c3d1a8f 100644
--- a/activesupport/test/rescuable_test.rb
+++ b/activesupport/test/rescuable_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit'
+require "abstract_unit"
class WraithAttack < StandardError
end
@@ -24,12 +24,12 @@ class Stargate
include ActiveSupport::Rescuable
- rescue_from WraithAttack, :with => :sos_first
+ rescue_from WraithAttack, with: :sos_first
- rescue_from WraithAttack, :with => :sos
+ rescue_from WraithAttack, with: :sos
- rescue_from 'NuclearExplosion' do
- @result = 'alldead'
+ rescue_from "NuclearExplosion" do
+ @result = "alldead"
end
rescue_from MadRonon do |e|
@@ -37,7 +37,7 @@ class Stargate
end
rescue_from WeirdError do
- @result = 'weird'
+ @result = "weird"
end
def dispatch(method)
@@ -63,7 +63,7 @@ class Stargate
ronanize
rescue
# This is the exception we'll handle that doesn't have a cause.
- raise 'unhandled RuntimeError with a handleable cause'
+ raise "unhandled RuntimeError with a handleable cause"
end
def weird
@@ -77,11 +77,11 @@ class Stargate
end
def sos
- @result = 'killed'
+ @result = "killed"
end
def sos_first
- @result = 'sos_first'
+ @result = "sos_first"
end
end
@@ -90,14 +90,13 @@ class CoolStargate < Stargate
include ActiveSupport::Rescuable
- rescue_from CoolError, :with => :sos_cool_error
+ rescue_from CoolError, with: :sos_cool_error
def sos_cool_error
- @result = 'sos_cool_error'
+ @result = "sos_cool_error"
end
end
-
class RescuableTest < ActiveSupport::TestCase
def setup
@stargate = Stargate.new
@@ -106,22 +105,22 @@ class RescuableTest < ActiveSupport::TestCase
def test_rescue_from_with_method
@stargate.dispatch :attack
- assert_equal 'killed', @stargate.result
+ assert_equal "killed", @stargate.result
end
def test_rescue_from_with_block
@stargate.dispatch :nuke
- assert_equal 'alldead', @stargate.result
+ assert_equal "alldead", @stargate.result
end
def test_rescue_from_with_block_with_args
@stargate.dispatch :ronanize
- assert_equal 'dex', @stargate.result
+ assert_equal "dex", @stargate.result
end
def test_rescue_from_error_dispatchers_with_case_operator
@stargate.dispatch :weird
- assert_equal 'weird', @stargate.result
+ assert_equal "weird", @stargate.result
end
def test_rescues_defined_later_are_added_at_end_of_the_rescue_handlers_array
@@ -138,6 +137,6 @@ class RescuableTest < ActiveSupport::TestCase
def test_rescue_falls_back_to_exception_cause
@stargate.dispatch :fall_back_to_cause
- assert_equal 'unhandled RuntimeError with a handleable cause', @stargate.result
+ assert_equal "unhandled RuntimeError with a handleable cause", @stargate.result
end
end