method

assert_raise

v1_8_6_287 - Show latest stable - Class: Test::Unit::Assertions
assert_raise(*args)
public

Passes if the block raises one of the given exceptions.

Example:

  assert_raise RuntimeError, LoadError do
    raise 'Boom!!!'
  end

1Note

Typo

olitreadwell ยท Apr 2, 2015

"Acceptable exception types maye be given as optional arguments. If the last argument is a String, it will be used as the error message."

"Acceptable exception types may be given as optional arguments. If the last argument is a String, it will be used as the error message."