lib/rubocop/cop/rspec/predicate_matcher.rb in rubocop-rspec-2.19.0 vs lib/rubocop/cop/rspec/predicate_matcher.rb in rubocop-rspec-2.20.0
- old
+ new
@@ -97,11 +97,11 @@
args = LocationHelp.arguments_with_whitespace(predicate).source
block_loc = LocationHelp.block_with_whitespace(predicate)
block = block_loc ? block_loc.source : ''
corrector.replace(
- matcher.source_range,
+ matcher,
to_predicate_matcher(predicate.method_name) + args + block
)
end
def true?(to_symbol, matcher)
@@ -212,11 +212,11 @@
matcher_name: matcher.method_name)
end
def corrector_explicit(corrector, to_node, actual, matcher, block_child)
replacement_matcher = replacement_matcher(to_node)
- corrector.replace(matcher.source_range, replacement_matcher)
+ corrector.replace(matcher, replacement_matcher)
move_predicate(corrector, actual, matcher, block_child)
corrector.replace(to_node.loc.selector, 'to')
end
def move_predicate(corrector, actual, matcher, block_child)
@@ -224,11 +224,10 @@
args = LocationHelp.arguments_with_whitespace(matcher).source
block_loc = LocationHelp.block_with_whitespace(block_child)
block = block_loc ? block_loc.source : ''
corrector.remove(block_loc) if block_loc
- corrector.insert_after(actual.source_range,
- ".#{predicate}" + args + block)
+ corrector.insert_after(actual, ".#{predicate}" + args + block)
end
# rubocop:disable Metrics/MethodLength
def to_predicate_method(matcher)
case matcher = matcher.to_s