class RescuableTest

Public Instance Methods

setup() click to toggle source
# File activesupport/test/rescuable_test.rb, line 125
def setup
  @stargate = Stargate.new
  @cool_stargate = CoolStargate.new
end
test_children_should_inherit_rescue_definitions_from_parents_and_child_rescue_should_be_appended() click to toggle source
# File activesupport/test/rescuable_test.rb, line 156
def test_children_should_inherit_rescue_definitions_from_parents_and_child_rescue_should_be_appended
  expected = ["WraithAttack", "WraithAttack", "NuclearExplosion", "MadRonon", "WeirdError", "CoolError"]
  result = @cool_stargate.send(:rescue_handlers).collect(&:first)
  assert_equal expected, result
end
test_rescue_falls_back_to_exception_cause() click to toggle source
# File activesupport/test/rescuable_test.rb, line 162
def test_rescue_falls_back_to_exception_cause
  @stargate.dispatch :fall_back_to_cause
  assert_equal "dex", @stargate.result
end
test_rescue_from_error_dispatchers_with_case_operator() click to toggle source
# File activesupport/test/rescuable_test.rb, line 145
def test_rescue_from_error_dispatchers_with_case_operator
  @stargate.dispatch :weird
  assert_equal "weird", @stargate.result
end
test_rescue_from_with_block() click to toggle source
# File activesupport/test/rescuable_test.rb, line 135
def test_rescue_from_with_block
  @stargate.dispatch :nuke
  assert_equal "alldead", @stargate.result
end
test_rescue_from_with_block_with_args() click to toggle source
# File activesupport/test/rescuable_test.rb, line 140
def test_rescue_from_with_block_with_args
  @stargate.dispatch :ronanize
  assert_equal "dex", @stargate.result
end
test_rescue_from_with_method() click to toggle source
# File activesupport/test/rescuable_test.rb, line 130
def test_rescue_from_with_method
  @stargate.dispatch :attack
  assert_equal "killed", @stargate.result
end
test_rescue_handles_loops_in_exception_cause_chain() click to toggle source
# File activesupport/test/rescuable_test.rb, line 172
def test_rescue_handles_loops_in_exception_cause_chain
  @stargate.dispatch :looped_crash
  assert_equal "unhandled", @stargate.result
end
test_rescues_defined_later_are_added_at_end_of_the_rescue_handlers_array() click to toggle source
# File activesupport/test/rescuable_test.rb, line 150
def test_rescues_defined_later_are_added_at_end_of_the_rescue_handlers_array
  expected = ["WraithAttack", "WraithAttack", "NuclearExplosion", "MadRonon", "WeirdError"]
  result = @stargate.send(:rescue_handlers).collect(&:first)
  assert_equal expected, result
end
test_unhandled_exceptions() click to toggle source
# File activesupport/test/rescuable_test.rb, line 167
def test_unhandled_exceptions
  @stargate.dispatch(:crash)
  assert_equal "unhandled", @stargate.result
end