Sha256: 742c0093a3f6fcff4407be37edaab59f9d7f61bb268970a5c136170646206476
Contents?: true
Size: 995 Bytes
Versions: 1
Compression:
Stored size: 995 Bytes
Contents
module Remarkable module ActiveRecord module Matchers class ValidatePresenceOfMatcher < Remarkable::ActiveRecord::Base arguments :collection => :attributes, :as => :attribute optional :message collection_assertions :allow_nil? default_options :message => :blank, :allow_nil => false 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 = <tt>I18n.translate('activerecord.errors.messages.blank')</tt> # # == Examples # # should_validate_presence_of :name, :phone_number # it { should validate_presence_of(:name, :phone_number) } # def validate_presence_of(*args) ValidatePresenceOfMatcher.new(*args).spec(self) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
remarkable_activerecord-3.0.0 | lib/remarkable_activerecord/matchers/validate_presence_of_matcher.rb |