lib/rubocop/cop/rspec/yield.rb in rubocop-rspec-2.12.1 vs lib/rubocop/cop/rspec/yield.rb in rubocop-rspec-2.13.0
- old
+ new
@@ -9,10 +9,11 @@
# # bad
# allow(foo).to receive(:bar) { |&block| block.call(1) }
#
# # good
# expect(foo).to receive(:bar).and_yield(1)
+ #
class Yield < Base
extend AutoCorrector
include RangeHelp
MSG = 'Use `.and_yield`.'
@@ -24,10 +25,10 @@
def_node_matcher :block_arg, '(args (blockarg $_))'
# @!method block_call?(node)
def_node_matcher :block_call?, '(send (lvar %) :call ...)'
- def on_block(node)
+ def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
return unless method_on_stub?(node.send_node)
block_arg(node.arguments) do |block|
if calling_block?(node.body, block)
range = block_range(node)