Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (19 sloc) 588 Bytes
---
assert_raise: |
# 'cheat assertions' for the rest
assert_raise(*args) {|| ...}
Passes if the block raises one of the given exceptions.
Returns the thrown exception.
Examples:
assert_raise RuntimeError, LoadError do
raise 'Boom!!!'
end
assert_raise(ActionController::RoutingError) {
assert_routing 'invalid/url', { }
}
# to check the message/class of the exception
exception = assert_raise RuntimeError, LoadError do
...
end
puts exception.message
puts exception.class
Jump to Line
Something went wrong with that request. Please try again.