Suppose I have a method written in Ruby that I am unit testing via Test::Unit. This method can raise a SystemExit for more than one reason, but uniquely identifies the reason it throws it in the Exception. I know I can do this to assert that an exception is raised:
assert_raises(SystemExit) { boo() }
But this matches all cases where boo() throws a SystemExit. How could I differentiate cases where boo() did abort("reason 1") from abort("reason 2")?
Just trap it with
begin..rescue. Write a helper method if you need to do it repeatedly.