It’s where you hide your “assertions”.
See MiniTest::Assertions#assert_operator
n.must_be :<=, 42
This can also do predicates:
str.must_be :empty?
# File minitest/spec.rb, line 368
infect_an_assertion :assert_operator, :must_be, :reverse
See MiniTest::Assertions#assert_in_delta
n.must_be_close_to m [, delta]
# File minitest/spec.rb, line 299
infect_an_assertion :assert_in_delta, :must_be_close_to
See MiniTest::Assertions#assert_empty.
collection.must_be_empty
# File minitest/spec.rb, line 281
infect_an_assertion :assert_empty, :must_be_empty, :unary
See MiniTest::Assertions#assert_instance_of
obj.must_be_instance_of klass
# File minitest/spec.rb, line 328
infect_an_assertion :assert_instance_of, :must_be_instance_of
See MiniTest::Assertions#assert_kind_of
obj.must_be_kind_of mod
# File minitest/spec.rb, line 337
infect_an_assertion :assert_kind_of, :must_be_kind_of
See MiniTest::Assertions#assert_nil
obj.must_be_nil
# File minitest/spec.rb, line 355
infect_an_assertion :assert_nil, :must_be_nil, :unary
See MiniTest::Assertions#assert_same
a.must_be_same_as b
# File minitest/spec.rb, line 404
infect_an_assertion :assert_same, :must_be_same_as
See MiniTest::Assertions#assert_silent
proc { ... }.must_be_silent
# File minitest/spec.rb, line 423
infect_an_assertion :assert_silent, :must_be_silent
See MiniTest::Assertions#assert_in_epsilon
n.must_be_within_epsilon m [, epsilon]
# File minitest/spec.rb, line 310
infect_an_assertion :assert_in_epsilon, :must_be_within_epsilon
See MiniTest::Assertions#assert_equal
a.must_equal b
# File minitest/spec.rb, line 290
infect_an_assertion :assert_equal, :must_equal
See MiniTest::Assertions#assert_includes
collection.must_include obj
# File minitest/spec.rb, line 319
infect_an_assertion :assert_includes, :must_include, :reverse
See MiniTest::Assertions#assert_match
a.must_match b
# File minitest/spec.rb, line 346
infect_an_assertion :assert_match, :must_match
See MiniTest::Assertions#assert_output
proc { ... }.must_output out_or_nil [, err]
# File minitest/spec.rb, line 377
infect_an_assertion :assert_output, :must_output
See MiniTest::Assertions#assert_raises
proc { ... }.must_raise exception
# File minitest/spec.rb, line 386
infect_an_assertion :assert_raises, :must_raise
See MiniTest::Assertions#assert_respond_to
obj.must_respond_to msg
# File minitest/spec.rb, line 395
infect_an_assertion :assert_respond_to, :must_respond_to, :reverse
See MiniTest::Assertions#assert_send TODO: remove me
a.must_send
# File minitest/spec.rb, line 414
infect_an_assertion :assert_send, :must_send
See MiniTest::Assertions#assert_throws
proc { ... }.must_throw sym
# File minitest/spec.rb, line 432
infect_an_assertion :assert_throws, :must_throw
See MiniTest::Assertions#refute_operator
n.wont_be :<=, 42
This can also do predicates:
str.wont_be :empty?
# File minitest/spec.rb, line 528
infect_an_assertion :refute_operator, :wont_be, :reverse
See MiniTest::Assertions#refute_in_delta
n.wont_be_close_to m [, delta]
# File minitest/spec.rb, line 459
infect_an_assertion :refute_in_delta, :wont_be_close_to
See MiniTest::Assertions#refute_empty
collection.wont_be_empty
# File minitest/spec.rb, line 441
infect_an_assertion :refute_empty, :wont_be_empty, :unary
See MiniTest::Assertions#refute_instance_of
obj.wont_be_instance_of klass
# File minitest/spec.rb, line 488
infect_an_assertion :refute_instance_of, :wont_be_instance_of
See MiniTest::Assertions#refute_kind_of
obj.wont_be_kind_of mod
# File minitest/spec.rb, line 497
infect_an_assertion :refute_kind_of, :wont_be_kind_of
See MiniTest::Assertions#refute_nil
obj.wont_be_nil
# File minitest/spec.rb, line 515
infect_an_assertion :refute_nil, :wont_be_nil, :unary
See MiniTest::Assertions#refute_same
a.wont_be_same_as b
# File minitest/spec.rb, line 546
infect_an_assertion :refute_same, :wont_be_same_as
See MiniTest::Assertions#refute_in_epsilon
n.wont_be_within_epsilon m [, epsilon]
# File minitest/spec.rb, line 470
infect_an_assertion :refute_in_epsilon, :wont_be_within_epsilon
See MiniTest::Assertions#refute_equal
a.wont_equal b
# File minitest/spec.rb, line 450
infect_an_assertion :refute_equal, :wont_equal
See MiniTest::Assertions#refute_includes
collection.wont_include obj
# File minitest/spec.rb, line 479
infect_an_assertion :refute_includes, :wont_include, :reverse
See MiniTest::Assertions#refute_match
a.wont_match b
# File minitest/spec.rb, line 506
infect_an_assertion :refute_match, :wont_match
See MiniTest::Assertions#refute_respond_to
obj.wont_respond_to msg
# File minitest/spec.rb, line 537
infect_an_assertion :refute_respond_to, :wont_respond_to, :reverse
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please see Improve the docs, or visit Documenting-ruby.org.