class RSpec::Matchers::BuiltIn::Have

def print_deprecation_message(query_method)

def print_deprecation_message(query_method)
  deprecation_message = "the rspec-collection_matchers gem "
  deprecation_message << "or replace your expectation with something like "
  if for_rspec_rails_error_on?
    # It is supposed to be safe to be able to convert the args array to
    # a string. This is because the `errors_on` method only takes two
    # valid arguments: attribute name (symbol/string) and a hash
    deprecated_call = expectation_expression(query_method, "record")
    deprecated_call << "(#{errors_on_args_list})" unless @args.empty?
    deprecation_message << <<-EOS.gsub(/^\s+\|/, '')
      |
      |
      |    #{record_valid_expression}
      |    expect(#{record_errors_expression(query_method)}).#{expectation_format_method} #{suggested_matcher_expression}
      |
    EOS
  else
    deprecated_call = expectation_expression(query_method)
    deprecation_message << "`expect(#{cardinality_expression(query_method)}).#{expectation_format_method} #{suggested_matcher_expression}`"
  end
  RSpec.deprecate("`#{deprecated_call}`",
    :replacement => deprecation_message,
    :type        => "the have matcher"
  )
end