Method: ActiveSupport::Testing::Assertions#assert_nothing_raised
- Defined in:
- activesupport/lib/active_support/testing/assertions.rb
#assert_nothing_raised ⇒ Object
Assertion that the block should not raise an exception.
Passes if evaluated code in the yielded block raises no exception.
assert_nothing_raised do
perform_service(param: 'no_exception')
end
48 49 50 51 52 |
# File 'activesupport/lib/active_support/testing/assertions.rb', line 48 def assert_nothing_raised yield.tap { assert(true) } rescue => error raise Minitest::UnexpectedError.new(error) end |