lib/rubocop/cop/rspec/predicate_matcher.rb in rubocop-rspec-1.36.0 vs lib/rubocop/cop/rspec/predicate_matcher.rb in rubocop-rspec-1.37.0
- old
+ new
@@ -136,10 +136,14 @@
be_between be_within
].freeze
private
+ def allowed_explicit_matchers
+ cop_config.fetch('AllowedExplicitMatchers', []) + BUILT_IN_MATCHERS
+ end
+
def check_explicit(node) # rubocop:disable Metrics/MethodLength
predicate_matcher_block?(node) do |_actual, matcher|
add_offense(
node,
message: message_explicit(matcher)
@@ -176,10 +180,10 @@
PATTERN
def predicate_matcher_name?(name)
name = name.to_s
- return false if BUILT_IN_MATCHERS.include?(name)
+ return false if allowed_explicit_matchers.include?(name)
name.start_with?('be_', 'have_') && !name.end_with?('?')
end
def message_explicit(matcher)