diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-07-23 15:51:46 -0400 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-07-26 16:48:45 +0200 |
commit | a5bb1f511f6d4ea63360eefe8c3850f9bbb7505a (patch) | |
tree | cde7dbc091c6126842f1a0cd80f0a176ec6bf7ab | |
parent | 9789d221373123d5d9c26173985080881fcb536a (diff) | |
download | rails-a5bb1f511f6d4ea63360eefe8c3850f9bbb7505a.tar.gz rails-a5bb1f511f6d4ea63360eefe8c3850f9bbb7505a.tar.bz2 rails-a5bb1f511f6d4ea63360eefe8c3850f9bbb7505a.zip |
strengthening the rescue_from test suites
Signed-off-by: José Valim <jose.valim@gmail.com>
-rw-r--r-- | activesupport/test/rescuable_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/test/rescuable_test.rb b/activesupport/test/rescuable_test.rb index ff77e16edd..8d2577c64a 100644 --- a/activesupport/test/rescuable_test.rb +++ b/activesupport/test/rescuable_test.rb @@ -14,6 +14,8 @@ class Stargate include ActiveSupport::Rescuable + rescue_from WraithAttack, :with => :sos_first + rescue_from WraithAttack, :with => :sos rescue_from NuclearExplosion do @@ -45,6 +47,11 @@ class Stargate def sos @result = 'killed' end + + def sos_first + @result = 'sos_first' + end + end class RescueableTest < Test::Unit::TestCase @@ -66,4 +73,11 @@ class RescueableTest < Test::Unit::TestCase @stargate.dispatch :ronanize assert_equal 'dex', @stargate.result end + + def test_rescues_defined_later_are_added_at_end_of_the_rescue_handlers_array + expected = ["WraithAttack", "WraithAttack", "NuclearExplosion", "MadRonon"] + result = @stargate.send(:rescue_handlers).collect {|e| e.first} + assert_equal expected, result + end + end |