def assert_raises *exp
msg = String === exp.last ? exp.pop : nil
msg = msg.to_s + "\n" if msg
should_raise = false
begin
yield
should_raise = true
rescue MiniTest::Skip => e
details = "#{msg}#{mu_pp(exp)} exception expected, not"
if exp.include? MiniTest::Skip then
return e
else
raise e
end
rescue Exception => e
details = "#{msg}#{mu_pp(exp)} exception expected, not"
assert(exp.any? { |ex|
ex.instance_of?(Module) ? e.kind_of?(ex) : ex == e.class
}, exception_details(e, details))
return e
end
exp = exp.first if exp.size == 1
flunk "#{msg}#{mu_pp(exp)} expected but nothing was raised." if
should_raise
end