class RSpec::Rails::Matchers::BeValid
def failure_message
def failure_message message = "expected #{actual.inspect} to be valid" if actual.respond_to?(:errors) errors = if actual.errors.respond_to?(:full_messages) actual.errors.full_messages else actual.errors end message << ", but got errors: #{errors.map(&:to_s).join(', ')}" end message end