lib/rubocop/cop/rspec/change_by_zero.rb in rubocop-rspec-2.18.1 vs lib/rubocop/cop/rspec/change_by_zero.rb in rubocop-rspec-2.19.0
- old
+ new
@@ -97,11 +97,11 @@
end
private
def check_offense(node)
- expression = node.loc.expression
+ expression = node.source_range
if compound_expectations?(node)
add_offense(expression, message: message_compound) do |corrector|
autocorrect_compound(corrector, node)
end
else
@@ -115,19 +115,19 @@
%i[and or & |].include?(node.parent.method_name)
end
def autocorrect(corrector, node)
corrector.replace(node.parent.loc.selector, 'not_to')
- range = node.loc.dot.with(end_pos: node.loc.expression.end_pos)
+ range = node.loc.dot.with(end_pos: node.source_range.end_pos)
corrector.remove(range)
end
def autocorrect_compound(corrector, node)
return unless negated_matcher
change_nodes(node) do |change_node|
corrector.replace(change_node.loc.selector, negated_matcher)
- range = node.loc.dot.with(end_pos: node.loc.expression.end_pos)
+ range = node.loc.dot.with(end_pos: node.source_range.end_pos)
corrector.remove(range)
end
end
def negated_matcher