Module: MiniTest::Expectations
- Included in:
 - Object
 
- Defined in:
 - lib/minitest/spec.rb
 
Overview
It’s where you hide your “assertions”.
Instance Method Summary collapse
- 
  
    
      #assert_empty  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_empty.
 - 
  
    
      #assert_equal  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_equal.
 - 
  
    
      #assert_in_delta  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_in_delta.
 - 
  
    
      #assert_in_epsilon  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_in_epsilon.
 - 
  
    
      #assert_includes  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_includes.
 - 
  
    
      #assert_instance_of  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_instance_of.
 - 
  
    
      #assert_kind_of  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_kind_of.
 - 
  
    
      #assert_match  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_match.
 - 
  
    
      #assert_nil  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_nil.
 - 
  
    
      #assert_operator  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_operator.
 - 
  
    
      #assert_output  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_output.
 - 
  
    
      #assert_raises  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_raises.
 - 
  
    
      #assert_respond_to  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_respond_to.
 - 
  
    
      #assert_same  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_same.
 - 
  
    
      #assert_send  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_send TODO: remove me.
 - 
  
    
      #assert_silent  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_silent.
 - 
  
    
      #assert_throws  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#assert_throws.
 - 
  
    
      #refute_empty  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#refute_empty.
 - 
  
    
      #refute_equal  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#refute_equal.
 - 
  
    
      #refute_in_delta  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#refute_in_delta.
 - 
  
    
      #refute_in_epsilon  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#refute_in_epsilon.
 - 
  
    
      #refute_includes  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#refute_includes.
 - 
  
    
      #refute_instance_of  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#refute_instance_of.
 - 
  
    
      #refute_kind_of  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#refute_kind_of.
 - 
  
    
      #refute_match  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#refute_match.
 - 
  
    
      #refute_nil  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#refute_nil.
 - 
  
    
      #refute_operator  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#refute_operator.
 - 
  
    
      #refute_respond_to  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#refute_respond_to.
 - 
  
    
      #refute_same  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
See MiniTest::Assertions#refute_same.
 
Instance Method Details
#assert_empty ⇒ Object
See MiniTest::Assertions#assert_empty.
collection.must_be_empty
:method: must_be_empty
      281  | 
    
      # File 'lib/minitest/spec.rb', line 281 infect_an_assertion :assert_empty, :must_be_empty, :unary  | 
  
#assert_equal ⇒ Object
See MiniTest::Assertions#assert_equal
a.must_equal b
:method: must_equal
      290  | 
    
      # File 'lib/minitest/spec.rb', line 290 infect_an_assertion :assert_equal, :must_equal  | 
  
#assert_in_delta ⇒ Object
See MiniTest::Assertions#assert_in_delta
n.must_be_close_to m [, delta]
:method: must_be_close_to
      299  | 
    
      # File 'lib/minitest/spec.rb', line 299 infect_an_assertion :assert_in_delta, :must_be_close_to  | 
  
#assert_in_epsilon ⇒ Object
See MiniTest::Assertions#assert_in_epsilon
n.must_be_within_epsilon m [, epsilon]
:method: must_be_within_epsilon
      310  | 
    
      # File 'lib/minitest/spec.rb', line 310 infect_an_assertion :assert_in_epsilon, :must_be_within_epsilon  | 
  
#assert_includes ⇒ Object
See MiniTest::Assertions#assert_includes
collection.must_include obj
:method: must_include
      319  | 
    
      # File 'lib/minitest/spec.rb', line 319 infect_an_assertion :assert_includes, :must_include, :reverse  | 
  
#assert_instance_of ⇒ Object
See MiniTest::Assertions#assert_instance_of
obj.must_be_instance_of klass
:method: must_be_instance_of
      328  | 
    
      # File 'lib/minitest/spec.rb', line 328 infect_an_assertion :assert_instance_of, :must_be_instance_of  | 
  
#assert_kind_of ⇒ Object
See MiniTest::Assertions#assert_kind_of
obj.must_be_kind_of mod
:method: must_be_kind_of
      337  | 
    
      # File 'lib/minitest/spec.rb', line 337 infect_an_assertion :assert_kind_of, :must_be_kind_of  | 
  
#assert_match ⇒ Object
See MiniTest::Assertions#assert_match
a.must_match b
:method: must_match
      346  | 
    
      # File 'lib/minitest/spec.rb', line 346 infect_an_assertion :assert_match, :must_match  | 
  
#assert_nil ⇒ Object
See MiniTest::Assertions#assert_nil
obj.must_be_nil
:method: must_be_nil
      355  | 
    
      # File 'lib/minitest/spec.rb', line 355 infect_an_assertion :assert_nil, :must_be_nil, :unary  | 
  
#assert_operator ⇒ Object
See MiniTest::Assertions#assert_operator
n.must_be :<=, 42
This can also do predicates:
str.must_be :empty?
:method: must_be
      368  | 
    
      # File 'lib/minitest/spec.rb', line 368 infect_an_assertion :assert_operator, :must_be, :reverse  | 
  
#assert_output ⇒ Object
See MiniTest::Assertions#assert_output
proc { ... }.must_output out_or_nil [, err]
:method: must_output
      377  | 
    
      # File 'lib/minitest/spec.rb', line 377 infect_an_assertion :assert_output, :must_output  | 
  
#assert_raises ⇒ Object
See MiniTest::Assertions#assert_raises
proc { ... }.must_raise exception
:method: must_raise
      386  | 
    
      # File 'lib/minitest/spec.rb', line 386 infect_an_assertion :assert_raises, :must_raise  | 
  
#assert_respond_to ⇒ Object
See MiniTest::Assertions#assert_respond_to
obj.must_respond_to msg
:method: must_respond_to
      395  | 
    
      # File 'lib/minitest/spec.rb', line 395 infect_an_assertion :assert_respond_to, :must_respond_to, :reverse  | 
  
#assert_same ⇒ Object
See MiniTest::Assertions#assert_same
a.must_be_same_as b
:method: must_be_same_as
      404  | 
    
      # File 'lib/minitest/spec.rb', line 404 infect_an_assertion :assert_same, :must_be_same_as  | 
  
#assert_send ⇒ Object
See MiniTest::Assertions#assert_send TODO: remove me
a.must_send
:method: must_send
      414  | 
    
      # File 'lib/minitest/spec.rb', line 414 infect_an_assertion :assert_send, :must_send  | 
  
#assert_silent ⇒ Object
See MiniTest::Assertions#assert_silent
proc { ... }.must_be_silent
:method: must_be_silent
      423  | 
    
      # File 'lib/minitest/spec.rb', line 423 infect_an_assertion :assert_silent, :must_be_silent  | 
  
#assert_throws ⇒ Object
See MiniTest::Assertions#assert_throws
proc { ... }.must_throw sym
:method: must_throw
      432  | 
    
      # File 'lib/minitest/spec.rb', line 432 infect_an_assertion :assert_throws, :must_throw  | 
  
#refute_empty ⇒ Object
See MiniTest::Assertions#refute_empty
collection.wont_be_empty
:method: wont_be_empty
      441  | 
    
      # File 'lib/minitest/spec.rb', line 441 infect_an_assertion :refute_empty, :wont_be_empty, :unary  | 
  
#refute_equal ⇒ Object
See MiniTest::Assertions#refute_equal
a.wont_equal b
:method: wont_equal
      450  | 
    
      # File 'lib/minitest/spec.rb', line 450 infect_an_assertion :refute_equal, :wont_equal  | 
  
#refute_in_delta ⇒ Object
See MiniTest::Assertions#refute_in_delta
n.wont_be_close_to m [, delta]
:method: wont_be_close_to
      459  | 
    
      # File 'lib/minitest/spec.rb', line 459 infect_an_assertion :refute_in_delta, :wont_be_close_to  | 
  
#refute_in_epsilon ⇒ Object
See MiniTest::Assertions#refute_in_epsilon
n.wont_be_within_epsilon m [, epsilon]
:method: wont_be_within_epsilon
      470  | 
    
      # File 'lib/minitest/spec.rb', line 470 infect_an_assertion :refute_in_epsilon, :wont_be_within_epsilon  | 
  
#refute_includes ⇒ Object
See MiniTest::Assertions#refute_includes
collection.wont_include obj
:method: wont_include
      479  | 
    
      # File 'lib/minitest/spec.rb', line 479 infect_an_assertion :refute_includes, :wont_include, :reverse  | 
  
#refute_instance_of ⇒ Object
See MiniTest::Assertions#refute_instance_of
obj.wont_be_instance_of klass
:method: wont_be_instance_of
      488  | 
    
      # File 'lib/minitest/spec.rb', line 488 infect_an_assertion :refute_instance_of, :wont_be_instance_of  | 
  
#refute_kind_of ⇒ Object
See MiniTest::Assertions#refute_kind_of
obj.wont_be_kind_of mod
:method: wont_be_kind_of
      497  | 
    
      # File 'lib/minitest/spec.rb', line 497 infect_an_assertion :refute_kind_of, :wont_be_kind_of  | 
  
#refute_match ⇒ Object
See MiniTest::Assertions#refute_match
a.wont_match b
:method: wont_match
      506  | 
    
      # File 'lib/minitest/spec.rb', line 506 infect_an_assertion :refute_match, :wont_match  | 
  
#refute_nil ⇒ Object
See MiniTest::Assertions#refute_nil
obj.wont_be_nil
:method: wont_be_nil
      515  | 
    
      # File 'lib/minitest/spec.rb', line 515 infect_an_assertion :refute_nil, :wont_be_nil, :unary  | 
  
#refute_operator ⇒ Object
See MiniTest::Assertions#refute_operator
n.wont_be :<=, 42
This can also do predicates:
str.wont_be :empty?
:method: wont_be
      528  | 
    
      # File 'lib/minitest/spec.rb', line 528 infect_an_assertion :refute_operator, :wont_be, :reverse  | 
  
#refute_respond_to ⇒ Object
See MiniTest::Assertions#refute_respond_to
obj.wont_respond_to msg
:method: wont_respond_to
      537  | 
    
      # File 'lib/minitest/spec.rb', line 537 infect_an_assertion :refute_respond_to, :wont_respond_to, :reverse  | 
  
#refute_same ⇒ Object
See MiniTest::Assertions#refute_same
a.wont_be_same_as b
:method: wont_be_same_as
      546  | 
    
      # File 'lib/minitest/spec.rb', line 546 infect_an_assertion :refute_same, :wont_be_same_as  |