Sha256: 7181a995e01616fbca8e1fd28dcbc5b4c7cb74cd3b77ab7ce71d850aba42bde7
Contents?: true
Size: 815 Bytes
Versions: 3
Compression:
Stored size: 815 Bytes
Contents
require 'pathname' require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper' class Monica # :nodoc: include DataMapper::Resource property :id, Integer, :serial => true property :birth_date, Date, :auto_validation => false property :happy, TrueClass validates_is_primitive :birth_date end describe DataMapper::Validate::PrimitiveValidator do it "should validate a property to check for the type" do b = Monica.new b.should be_valid b.birth_date = 'ABC' b.should_not be_valid b.birth_date.should eql('ABC') b.birth_date = '2008-01-01' b.should be_valid b.birth_date.should eql(Date.civil(2008,1,1)) end it "should accept FalseClass even when the property type is TrueClass" do b = Monica.new b.happy = false b.valid?.should == true end end
Version data entries
3 entries across 3 versions & 1 rubygems