class RuboCop::Cop::Minitest::AssertNil
assert_nil(actual, ‘message’)
assert_nil(actual)
# good
assert_predicate(object, :nil?, ‘message’)
assert_predicate(object, :nil?)
assert(object.nil?, ‘message’)
assert(object.nil?)
assert_equal(nil, actual, ‘message’)
assert_equal(nil, actual)
# bad
@example
`assert_equal(nil, something)‘, `assert(something.nil?)`, or `assert_predicate(something, :nil?)`.
Enforces the test to use `assert_nil` instead of using
def assertion_type
def assertion_type ASSERTION_TYPE end
def on_send(node)
def on_send(node) nil_assertion(node) do |actual, message| register_offense(node, actual, message) end end