From 15561281b11e95eb81437acc296f2a2e5ba44629 Mon Sep 17 00:00:00 2001 From: Andrew Eskenazi Date: Wed, 30 Nov 2016 16:02:20 -0700 Subject: [PATCH] Followed the hints * In `about_exceptions.rb` I followed the hints and filled in the empty value. * Modified lines: 9-12, 23, 25-26, 31, 43-44, 57, 63. [#131336149] --- about_exceptions.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/about_exceptions.rb b/about_exceptions.rb index 464f57e..a9ef4bb 100644 --- a/about_exceptions.rb +++ b/about_exceptions.rb @@ -6,10 +6,10 @@ class MySpecialError < RuntimeError end def test_exceptions_inherit_from_Exception - assert_equal __, MySpecialError.ancestors[1] - assert_equal __, MySpecialError.ancestors[2] - assert_equal __, MySpecialError.ancestors[3] - assert_equal __, MySpecialError.ancestors[4] + assert_equal RuntimeError, MySpecialError.ancestors[1] + assert_equal StandardError, MySpecialError.ancestors[2] + assert_equal Exception, MySpecialError.ancestors[3] + assert_equal Object, MySpecialError.ancestors[4] end def test_rescue_clause @@ -20,15 +20,15 @@ def test_rescue_clause result = :exception_handled end - assert_equal __, result + assert_equal :exception_handled, result - assert_equal __, ex.is_a?(StandardError), "Should be a Standard Error" - assert_equal __, ex.is_a?(RuntimeError), "Should be a Runtime Error" + assert_equal true, ex.is_a?(StandardError), "Should be a Standard Error" + assert_equal true, ex.is_a?(RuntimeError), "Should be a Runtime Error" assert RuntimeError.ancestors.include?(StandardError), "RuntimeError is a subclass of StandardError" - assert_equal __, ex.message + assert_equal "Oops", ex.message end def test_raising_a_particular_error @@ -40,8 +40,8 @@ def test_raising_a_particular_error result = :exception_handled end - assert_equal __, result - assert_equal __, ex.message + assert_equal :exception_handled, result + assert_equal "My Message", ex.message end def test_ensure_clause @@ -54,13 +54,13 @@ def test_ensure_clause result = :always_run end - assert_equal __, result + assert_equal :always_run, result end # Sometimes, we must know about the unknown def test_asserting_an_error_is_raised # A do-end is a block, a topic to explore more later - assert_raise(___) do + assert_raise(Exception) do raise MySpecialError.new("New instances can be raised directly.") end end