Module | MiniTest::Assertions |
In: |
lib/minitest/unit.rb
|
MiniTest Assertions. All assertion methods accept a msg which is printed if the assertion fails.
For comparing Floats. Fails unless exp and act are within delta of each other.
assert_in_delta Math::PI, (22.0 / 7.0), 0.01
send_ary is a receiver, message and arguments.
Fails unless the call returns a true value
Captures $stdout and $stderr into strings:
out, err = capture_io do warn "You did a bad thing" end assert_match %r%bad%, err
mu_pp gives a human-readable version of obj. By default inspect is called. You can override this to use pretty_print if you want.
Fails if +o1+ is not op +o2+ nil. eg:
refute_operator 1, :>, 2 #=> pass refute_operator 1, :<, 2 #=> fail