Method: Mini::Assertions#assert_raises
- Defined in:
- lib/mini/test.rb
#assert_raises(*exp) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/mini/test.rb', line 119 def assert_raises *exp msg = String === exp.last ? exp.pop : nil should_raise = false begin yield should_raise = true rescue Exception => e assert_includes exp, e.class exception_details(e, "<#{mu_pp(exp)}> exception expected, not") return e end exp = exp.first if exp.size == 1 flunk "#{mu_pp(exp)} expected but nothing was raised." if should_raise end |