v1_8_7_330 -
Show latest stable
Test::Unit::Assertions contains the standard Test::Unit assertions. Assertions is included in Test::Unit::TestCase.
To include it in your own code and use its functionality, you simply need to rescue Test::Unit::AssertionFailedError. Additionally you may override add_assertion to get notified whenever an assertion is made.
Notes:
-
The message to each assertion, if given, will be propagated with the failure.
-
It is easy to add your own assertions based on assert_block().
Example Custom Assertion
def deny(boolean, message = nil) message = build_message message, '<?> is not false or nil.', boolean assert_block message do not boolean end end
Constants
UncaughtThrow = {NameError => /^uncaught throw \\`(.+)\\'$/, ThreadError => /^uncaught throw \\`(.+)\\' in thread /}
Files
- lib/test/unit/assertions.rb