Some additional Test::Unit assertions.
Assert that the boolean is false.
# File lib/s4t-utils/more-assertions.rb, line 12 def assert_false(boolean, message = nil) _wrap_assertion do assert_block(build_message(message, "<?> should be false or nil.", boolean)) { !boolean } end end
Like assert_raise, but the raised exception must contain a
message matching (as in assert_match) the
message argument.
# File lib/s4t-utils/more-assertions.rb, line 20 def assert_raise_with_matching_message(exception_class, message, &block) exception = assert_raise(exception_class, &block) assert_match(message, exception.message) end
Same as assert. I just like it better.
# File lib/s4t-utils/more-assertions.rb, line 7 def assert_true(boolean, message = nil) assert(boolean, message) end
Assert that the block tried to exit.
# File lib/s4t-utils/more-assertions.rb, line 28 def assert_wants_to_exit assert_raise(SystemExit) do yield end end