lib/rubocop/cop/rspec/predicate_matcher.rb in rubocop-rspec-2.22.0 vs lib/rubocop/cop/rspec/predicate_matcher.rb in rubocop-rspec-2.23.0
- old
+ new
@@ -72,11 +72,11 @@
'be_an_instance_of'
when 'include?', 'respond_to?'
name[0..-2]
when 'exist?', 'exists?'
'exist'
- when /^has_/
+ when /\Ahas_/
name.sub('has_', 'have_')[0..-2]
else
"be_#{name[0..-2]}"
end
end
@@ -238,13 +238,13 @@
'instance_of?'
when 'include'
'include?'
when 'respond_to'
'respond_to?'
- when /^have_(.+)/
+ when /\Ahave_(.+)/
"has_#{Regexp.last_match(1)}?"
else
- "#{matcher[/^be_(.+)/, 1]}?"
+ "#{matcher[/\Abe_(.+)/, 1]}?"
end
end
# rubocop:enable Metrics/MethodLength
def replacement_matcher(node)