Home
Pages Classes Methods
module
Minitest::Assertions
Methods
::diff
::diff= Minitest Assertions. All assertion methods
#assert accept a msg which is printed if the assertion
#assert_empty
fails.
#assert_equal
#assert_in_delta Protocol: Nearly everything here boils up to
#assert_in_epsilon
assert, which expects to be able to
#assert_includes
#assert_instance_of increment an instance accessor named
#assert_kind_of assertions. This is not provided by
#assert_match Assertions and must be provided by the
#assert_mock
thing including Assertions. See
#assert_nil
#assert_operator Minitest::Runnable for an example.
#assert_output
#assert_predicate
#assert_raises
#assert_respond_to
Public Class Methods
#assert_same
#assert_send
diff()
#assert_silent
#assert_throws
Returns the diff command to use in diff. Tries
#capture_io
#capture_subprocess_io to intelligently figure out what diff to use.
#diff
#exception_details
#flunk diff=(o)
#message
#mu_pp Set the diff command to use in diff.
#mu_pp_for_diff
#pass
#refute
#refute_empty Public Instance Methods
#refute_equal
#refute_in_delta
#refute_in_epsilon assert(test, msg = nil)
#refute_includes
#refute_instance_of Fails unless test is truthy.
#refute_kind_of
#refute_match
#refute_nil assert_empty(obj, msg = nil)
#refute_operator
#refute_predicate Fails unless obj is empty.
#refute_respond_to
1 of 9 3/12/19, 8:35 AM
module Minitest::Assertions - minitest-5.11.3 Do... file:///home/engel/Documentos/Respaldo (F)/Teori...
assert_in_epsilon(exp, act,
epsilon = 0.001, msg = nil)
For comparing Floats. Fails unless exp and
act have a relative error less than epsilon.
assert_includes(collection, obj,
msg = nil)
Fails unless collection includes obj.
2 of 9 3/12/19, 8:35 AM
module Minitest::Assertions - minitest-5.11.3 Do... file:///home/engel/Documentos/Respaldo (F)/Teori...
assert_mock(mock)
Assert that the mock verifies correctly.
assert_operator(o1, op, o2 =
UNDEFINED, msg = nil)
For testing with binary operators. Eg:
assert_operator 5, :<=, 4
assert_output(/hey/) { method_with_output }
3 of 9 3/12/19, 8:35 AM
module Minitest::Assertions - minitest-5.11.3 Do... file:///home/engel/Documentos/Respaldo (F)/Teori...
capture_subprocess_io.
See also: assert_silent
str.must_be :empty?
assert_raises(*exp) { || ... }
Fails unless the block raises one of exp.
Returns the exception matched so you can
check the message, attributes, etc.
exp takes an optional message on the end to
help explain failures and defaults to
StandardError if no exception class is
passed.
assert_send(send_ary, m = nil)
4 of 9 3/12/19, 8:35 AM
module Minitest::Assertions - minitest-5.11.3 Do... file:///home/engel/Documentos/Respaldo (F)/Teori...
assert_silent() { || ... }
Fails if the block outputs anything to stderr
or stdout.
See also: assert_output
capture_io() { || ... }
Captures $stdout and $stderr into strings:
capture_subprocess_io() { || ... }
Captures $stdout and $stderr into strings,
using Tempfile to ensure that subprocess IO
is captured as well.
5 of 9 3/12/19, 8:35 AM
module Minitest::Assertions - minitest-5.11.3 Do... file:///home/engel/Documentos/Respaldo (F)/Teori...
diff(exp, act)
Returns a diff between exp and act. If there
is no known diff command or if it doesn't
make sense to diff the output (single line,
short output), then it simply returns a basic
comparison between the two.
exception_details(e, msg)
Returns details for exception e
flunk(msg = nil)
Fails with msg
mu_pp(obj)
This returns a human-readable version of
obj. By default inspect is called. You can
override this to use pretty_print if you want.
6 of 9 3/12/19, 8:35 AM
module Minitest::Assertions - minitest-5.11.3 Do... file:///home/engel/Documentos/Respaldo (F)/Teori...
mu_pp_for_diff(obj)
This returns a diff-able human-readable
version of obj. This differs from the regular
#mu_pp because it expands escaped
newlines and makes hex-values generic (like
object_ids). This uses #mu_pp to do the first
pass and then cleans it up.
pass(_msg = nil)
used for counting assertions
refute_in_epsilon(a, b, epsilon =
0.001, msg = nil)
7 of 9 3/12/19, 8:35 AM
module Minitest::Assertions - minitest-5.11.3 Do... file:///home/engel/Documentos/Respaldo (F)/Teori...
refute_includes(collection, obj,
msg = nil)
Fails if collection includes obj.
refute_operator(o1, op, o2 =
UNDEFINED, msg = nil)
Fails if o1 is not op o2. Eg:
8 of 9 3/12/19, 8:35 AM
module Minitest::Assertions - minitest-5.11.3 Do... file:///home/engel/Documentos/Respaldo (F)/Teori...
str.wont_be :empty?
skipped?()
Was this testcase skipped? Meant for
teardown.
Validate
Generated by RDoc 6.0.1.
Based on Darkfish by Michael Granger.
9 of 9 3/12/19, 8:35 AM