class RuboCop::Cop::Minitest::AssertEmpty
assert_empty(object, ‘message’)
assert_empty(object)
# good
assert(object.empty?, ‘message’)
assert(object.empty?)
# bad
@example
Enforces the test to use ‘assert_empty` instead of using `assert(object.empty?)`.
def on_send(node)
def on_send(node) return unless node.method?(:assert) return unless node.first_argument.respond_to?(:method?) && node.first_argument.method?(:empty?) return unless node.first_argument.arguments.empty? add_offense(node, message: offense_message(node.arguments)) do |corrector| autocorrect(corrector, node, node.arguments) end end