lib/rubocop/cop/rspec/not_to_not.rb in rubocop-rspec-1.41.0 vs lib/rubocop/cop/rspec/not_to_not.rb in rubocop-rspec-1.42.0
- old
+ new
@@ -14,23 +14,22 @@
# # good
# it '...' do
# expect(false).not_to be_true
# end
class NotToNot < Cop
+ extend AutoCorrector
include ConfigurableEnforcedStyle
MSG = 'Prefer `%<replacement>s` over `%<original>s`.'
def_node_matcher :not_to_not_offense, '(send _ % ...)'
def on_send(node)
not_to_not_offense(node, alternative_style) do
- add_offense(node, location: :selector)
+ add_offense(node.loc.selector) 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)