method
assert_raise
v1_9_3_392 -
Show latest stable
- Class:
Test::Unit::Assertions
assert_raise(*args, &b)public
Tests if the given block raises an exception. Acceptable exception types maye be given as optional arguments. If the last argument is a String, it will be used as the error message.
assert_raise do #Fails, no Exceptions are raised end assert_raise NameError do puts x #Raises NameError, so assertion succeeds end
1Note
Typo
"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."