Class: RuboCop::Cop::Minitest::AssertSilent
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Minitest::AssertSilent
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/minitest/assert_silent.rb
Overview
Enforces the test to use ‘assert_silent { … }` instead of using `assert_output(”, ”) { … }`.
Constant Summary collapse
- MSG =
'Prefer using `assert_silent`.'
Instance Method Summary collapse
-
#on_block(node) ⇒ Object
rubocop:disable InternalAffairs/NumblockHandler.
Instance Method Details
#on_block(node) ⇒ Object
rubocop:disable InternalAffairs/NumblockHandler
29 30 31 32 33 34 35 36 37 |
# File 'lib/rubocop/cop/minitest/assert_silent.rb', line 29 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 |