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
Fails if stdout or stderr do not output the expected results. Pass in nil if you don‘t care about that streams output. Pass in "" if you require it to be silent.
See also: assert_silent
send_ary is a receiver, message and arguments.
Fails unless the call returns a true value TODO: I should prolly remove this from specs
Fails if the block outputs anything to stderr or stdout.
See also: assert_output
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