Sha256: 464ecee29dfb710ea88de400654827f2e45100cc1ba928d3cf40684013cca047
Contents?: true
Size: 1022 Bytes
Versions: 6
Compression:
Stored size: 1022 Bytes
Contents
module Remarkable module MongoMapper module Matchers class ValidatePresenceOfMatcher < Remarkable::MongoMapper::Base arguments :collection => :attributes, :as => :attribute optional :message collection_assertions :allow_nil? default_options :message => "can't be empty" protected def allow_nil? bad?(nil, :message) end end # Ensures that the model cannot be saved if one of the attributes listed is not present. # # == Options # # * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>. # Regexp, string or symbol. Default = "can't be empty" # # == Examples # # should_validate_presence_of :name, :phone_number # it { should validate_presence_of(:name, :phone_number) } # def validate_presence_of(*args, &block) ValidatePresenceOfMatcher.new(*args, &block).spec(self) end end end end
Version data entries
6 entries across 6 versions & 4 rubygems