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