class RSpec::Rails::Matchers::BeValid
@private
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
def failure_message_when_negated
def failure_message_when_negated "expected #{actual.inspect} not to be valid" end
def initialize(*args)
def initialize(*args) @args = args end
def matches?(actual)
def matches?(actual) @actual = actual actual.valid?(*@args) end