class RSpec::Rails::Matchers::BeANew

def failure_message

Other tags:
    Private: -
def failure_message
  [].tap do |message|
    unless actual.is_a?(expected) && actual.new_record?
      message << "expected #{actual.inspect} to be a new #{expected.inspect}"
    end
    unless attributes_match?(actual)
      describe_unmatched_attributes = surface_descriptions_in(unmatched_attributes)
      if unmatched_attributes.size > 1
        message << "attributes #{describe_unmatched_attributes.inspect} were not set on #{actual.inspect}"
      else
        message << "attribute #{describe_unmatched_attributes.inspect} was not set on #{actual.inspect}"
      end
    end
  end.join(' and ')
end