Skip to content

Instantly share code, notes, and snippets.

@cw4d3
Created January 31, 2011 01:59
Show Gist options
  • Select an option

  • Save cw4d3/803530 to your computer and use it in GitHub Desktop.

Select an option

Save cw4d3/803530 to your computer and use it in GitHub Desktop.
from test_about_exceptions.rb Koan
class AboutExceptions
class MySpecialError < RuntimeError
end
def test_rescue_clause
result = nil
begin
fail "Oops"
rescue StandardError => ex
result = :exception_handled
end
end
# assert_equal __, ex.is_a?(StandardError), "Should be a Standard Error"
# assert_equal __, ex.is_a?(RuntimeError), "Should be a Runtime Error"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment