lib/rubocop/cop/rspec/verified_double_reference.rb in rubocop-rspec-2.18.1 vs lib/rubocop/cop/rspec/verified_double_reference.rb in rubocop-rspec-2.19.0
- old
+ new
@@ -74,14 +74,14 @@
def on_send(node)
verified_double(node) do |class_reference|
break correct_style_detected unless opposing_style?(class_reference)
message = format(MSG, style: style)
- expression = class_reference.loc.expression
+ expression = class_reference.source_range
add_offense(expression, message: message) do |corrector|
- violation = class_reference.children.last.to_s
+ violation = class_reference.source
corrector.replace(expression, correct_style(violation))
opposite_style_detected
end
end
@@ -100,10 +100,10 @@
def correct_style(violation)
if style == :string
"'#{violation}'"
else
- violation
+ violation.gsub(/^['"]|['"]$/, '')
end
end
end
end
end