Sha256: a594494e034e64f25d22109879fda0e28b422d16f07a0404bcacf2e26b43dd87
Contents?: true
Size: 622 Bytes
Versions: 1
Compression:
Stored size: 622 Bytes
Contents
module DataMapper module Matchers def validate_presence_of(property) ValidatePresenceOf.new(property) end class ValidatePresenceOf < ValidationMatcher set_validation_subject "presence" def matches?(model) validators = model.validators.contexts[:default] presence_of = validators.find do |validator| validator.is_a? DataMapper::Validations::PresenceValidator and validator.field_name == @property end return false unless presence_of return false if @msg and @msg != presence_of.options[:message] true end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dm-rspec-0.1.2 | lib/dm/matchers/validate_presence_of.rb |