lib/rubocop/cop/rspec/it_behaves_like.rb in rubocop-rspec-1.41.0 vs lib/rubocop/cop/rspec/it_behaves_like.rb in rubocop-rspec-1.42.0
- old
+ new
@@ -17,24 +17,23 @@
# it_behaves_like 'a foo'
#
# # good
# it_should_behave_like 'a foo'
class ItBehavesLike < Cop
+ extend AutoCorrector
include ConfigurableEnforcedStyle
MSG = 'Prefer `%<replacement>s` over `%<original>s` when including '\
'examples in a nested context.'
def_node_matcher :example_inclusion_offense, '(send _ % ...)'
def on_send(node)
example_inclusion_offense(node, alternative_style) do
- add_offense(node)
+ add_offense(node) do |corrector|
+ corrector.replace(node.loc.selector, style.to_s)
+ end
end
- end
-
- def autocorrect(node)
- ->(corrector) { corrector.replace(node.loc.selector, style.to_s) }
end
private
def message(_node)