Module: Minitest::Expectations

Defined in:
lib/minitest-bonus-assertions.rb

Instance Method Summary collapse

Instance Method Details

#assert_falseObject

See Minitest::Assertions#assert_false

false.must_be_false

:method: must_be_false



118
# File 'lib/minitest-bonus-assertions.rb', line 118

infect_an_assertion :assert_false, :must_be_false, :unary

#assert_has_keysObject

See Minitest::Assertions#assert_has_keys

hash.must_have_keys %w(a b c)

:method: must_have_keys



151
# File 'lib/minitest-bonus-assertions.rb', line 151

infect_an_assertion :assert_has_keys, :must_have_keys, :unary

#assert_missing_keysObject

See Minitest::Assertions#assert_missing_keys

hash.must_not_have_keys %w(a b c)

:method: must_not_have_keys



160
# File 'lib/minitest-bonus-assertions.rb', line 160

infect_an_assertion :assert_missing_keys, :must_not_have_keys, :unary

#assert_raises_with_messageObject

See Minitest::Assertions#assert_raises_with_message

proc { ... }.must_raise_with_message exception, message

:method: must_raise_with_message



169
# File 'lib/minitest-bonus-assertions.rb', line 169

infect_an_assertion :assert_raises_with_message, :must_raise_with_message

#assert_set_equalObject

See Minitest::Assertions#assert_set_equal

%w(a b c).must_equal_set %(c b a)

:method: must_equal_set



178
# File 'lib/minitest-bonus-assertions.rb', line 178

infect_an_assertion :assert_set_equal, :must_equal_set, :unary

#assert_trueObject

See Minitest::Assertions#assert_true

true.must_be_true

:method: must_be_true



127
# File 'lib/minitest-bonus-assertions.rb', line 127

infect_an_assertion :assert_true, :must_be_true, :unary

#must_be_between(*args) ⇒ Object

See Minitest::Assertions#assert_between

2.must_be_between 1, 3
2.must_be_between 1..3


135
136
137
138
139
140
141
142
# File 'lib/minitest-bonus-assertions.rb', line 135

def must_be_between *args
  hi, lo, msg  = if args.first.kind_of?(Range)
                   [args.first.begin, args.first.end, args[1]]
                 else
                   args[0..2]
                 end
  ctx.assert_between lo, hi, target, msg
end

#refute_set_equalObject

See Minitest::refuteions#refute_set_equal

%w(a b c).must_equal_set %(c b a)

:method: must_equal_set



187
# File 'lib/minitest-bonus-assertions.rb', line 187

infect_an_assertion :refute_set_equal, :must_not_equal_set, :unary