Sha256: 40d585864bbd1a19737dd03eb5a082fc7cea8e051ebd79fab4d7e3f4fc926077
Contents?: true
Size: 1.04 KB
Versions: 12
Compression:
Stored size: 1.04 KB
Contents
module Spec module Rails module Matchers class ArBeValid #:nodoc: def initialize @matcher = Spec::Matchers::Be.new :be_valid @matcher.__send__ :handling_predicate! end def matches?(actual) @actual = actual @matcher.matches? @actual end def failure_message_for_should if @actual.respond_to?(:errors) && ActiveRecord::Errors === @actual.errors "Expected #{@actual.inspect} to be valid, but it was not\nErrors: " + @actual.errors.full_messages.join(", ") else @matcher.failure_message_for_should end end def failure_message_for_should_not @matcher.failure_message_for_should_not end def description "be valid" end end # :call-seq: # response.should be_valid # response.should_not be_valid def be_valid ArBeValid.new end end end end
Version data entries
12 entries across 12 versions & 3 rubygems