Skip to content

Instantly share code, notes, and snippets.

@arturaz
Created May 29, 2012 16:37
Show Gist options
  • Save arturaz/2829447 to your computer and use it in GitHub Desktop.
Save arturaz/2829447 to your computer and use it in GitHub Desktop.
# Raise an exception in caller context, but stay running
def abort(cause)
cause = case cause
when String then RuntimeError.new(cause)
when Exception then cause
else raise "Unknown abort cause class #{cause.class} for object #{cause.inspect}"
end
raise AbortError.new(cause)
end
it "crashes the caller if we pass neither String nor Exception" do
actor = actor_class.new "Al Pacino"
expect do
actor.crash_with_abort_raw 10
end.to raise_exception(RuntimeError)
actor.should_not be_alive
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment