class RuboCop::Cop::Minitest::AssertSilent
assert_silent { puts object.do_something }
# good
assert_output(”, ”) { puts object.do_something }
# bad
@example
instead of using ‘assert_output(”, ”) { … }`.
Enforces the test to use `assert_silent { … }`
def empty_string?(node)
def empty_string?(node) node.str_type? && node.value.empty? end
def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless assert_silent_candidate?(node) send_node = node.send_node add_offense(send_node) do |corrector| corrector.replace(send_node, 'assert_silent') end end