diff --git a/lib/rubocop/cop/rspec/redundant_around.rb b/lib/rubocop/cop/rspec/redundant_around.rb index 20370d330..f943d2b66 100644 --- a/lib/rubocop/cop/rspec/redundant_around.rb +++ b/lib/rubocop/cop/rspec/redundant_around.rb @@ -27,14 +27,7 @@ def on_block(node) autocorrect(corrector, node) end end - - def on_numblock(node) - return unless match_redundant_around_hook_numblock?(node) - - add_offense(node) do |corrector| - autocorrect(corrector, node) - end - end + alias on_numblock on_block def on_send(node) return unless match_redundant_around_hook_send?(node) @@ -48,16 +41,7 @@ def on_send(node) # @!method match_redundant_around_hook_block?(node) def_node_matcher :match_redundant_around_hook_block?, <<~PATTERN - (block - (send _ :around ...) - (args _?) - (send _ :run) - ) - PATTERN - - # @!method match_redundant_around_hook_numblock?(node) - def_node_matcher :match_redundant_around_hook_numblock?, <<~PATTERN - (numblock (send _ :around) ... (send _ :run)) + ({block numblock} (send _ :around ...) ... (send _ :run)) PATTERN # @!method match_redundant_around_hook_send?(node)