lib/rubocop/cop/rspec/invalid_predicate_matcher.rb in rubocop-rspec-1.32.0 vs lib/rubocop/cop/rspec/invalid_predicate_matcher.rb in rubocop-rspec-1.33.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module RuboCop
module Cop
module RSpec
# Checks invalid usage for predicate matcher.
#
@@ -12,13 +14,13 @@
# expect(foo).to be_something?
#
# # good
# expect(foo).to be_something
class InvalidPredicateMatcher < Cop
- MSG = 'Omit `?` from `%<matcher>s`.'.freeze
+ MSG = 'Omit `?` from `%<matcher>s`.'
def_node_matcher :invalid_predicate_matcher?, <<-PATTERN
- (send (send nil? :expect ...) {:to :not_to :to_not} $(send nil? #predicate?))
+ (send (send nil? :expect ...) #{Runners::ALL.node_pattern_union} $(send nil? #predicate?))
PATTERN
def on_send(node)
invalid_predicate_matcher?(node) do |predicate|
add_offense(predicate, location: :expression)