Class: RuboCop::Cop::Minitest::AssertRaisesCompoundBody
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Minitest::AssertRaisesCompoundBody
- Defined in:
- lib/rubocop/cop/minitest/assert_raises_compound_body.rb
Overview
Enforces the block body of ‘assert_raises { … }` to be reduced to only the raising code.
Constant Summary collapse
- MSG =
'Reduce `assert_raises` block body to contain only the raising code.'
Instance Method Summary collapse
-
#on_block(node) ⇒ Object
rubocop:disable InternalAffairs/NumblockHandler.
Instance Method Details
#on_block(node) ⇒ Object
rubocop:disable InternalAffairs/NumblockHandler
31 32 33 34 35 |
# File 'lib/rubocop/cop/minitest/assert_raises_compound_body.rb', line 31 def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless node.method?(:assert_raises) && multi_statement_begin?(node.body) add_offense(node) end |