lib/rubocop/cop/rspec/context_method.rb in rubocop-rspec-1.41.0 vs lib/rubocop/cop/rspec/context_method.rb in rubocop-rspec-1.42.0

- old
+ new

@@ -22,24 +22,22 @@ # # describe '.foo_bar' do # # ... # end class ContextMethod < Cop + extend AutoCorrector + MSG = 'Use `describe` for testing methods.' def_node_matcher :context_method, <<-PATTERN (block (send #{RSPEC} :context $(str #method_name?) ...) ...) PATTERN def on_block(node) context_method(node) do |context| - add_offense(context) - end - end - - def autocorrect(node) - lambda do |corrector| - corrector.replace(node.parent.loc.selector, 'describe') + add_offense(context) do |corrector| + corrector.replace(node.send_node.loc.selector, 'describe') + end end end private