class RuboCop::Cop::RSpec::InvalidPredicateMatcher

expect(foo).to be_something
# good
expect(foo).to be_something?
# bad
@example
This cop checks an unnecessary question in predicate matcher.
Predicate matcher does not need a question.
Checks invalid usage for predicate matcher.

def on_send(node)

def on_send(node)
  invalid_predicate_matcher?(node) do |predicate|
    add_offense(predicate,
                message: format(MSG, matcher: predicate.method_name))
  end
end

def predicate?(name)

def predicate?(name)
  name = name.to_s
  name.start_with?('be_', 'have_') && name.end_with?('?')
end