lib/rubocop/cop/rspec/predicate_matcher.rb in rubocop-rspec-1.30.1 vs lib/rubocop/cop/rspec/predicate_matcher.rb in rubocop-rspec-1.31.0
- old
+ new
@@ -62,10 +62,12 @@
'be_a'
when 'instance_of?'
'be_an_instance_of'
when 'include?', 'respond_to?'
name[0..-2]
+ when 'exist?', 'exists?'
+ 'exist'
when /^has_/
name.sub('has_', 'have_')[0..-2]
else
"be_#{name[0..-2]}"
end
@@ -172,12 +174,13 @@
...)
PATTERN
def predicate_matcher_name?(name)
name = name.to_s
- name.start_with?('be_', 'have_') &&
- !BUILT_IN_MATCHERS.include?(name) &&
- !name.end_with?('?')
+
+ return false if BUILT_IN_MATCHERS.include?(name)
+
+ name.start_with?('be_', 'have_') && !name.end_with?('?')
end
def message_explicit(matcher)
format(MSG_EXPLICIT,
predicate_name: to_predicate_method(matcher.method_name),