Sha256: 70baa82ef6c94c3ee27c0fe6daf6c50e27d1e509364ed6fef71aae1eadf6cce3
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
require 'spec_helper' describe DataMapper::Property::DateTime do before :all do @name = :created_at @type = described_class @value = DateTime.now @other_value = DateTime.now + 15 @invalid_value = 1 end it_should_behave_like 'A semipublic Property' describe '#typecast' do describe 'and value given as a hash with keys like :year, :month, etc' do it 'builds a DateTime instance from hash values' do result = @property.typecast( :year => '2006', :month => '11', :day => '23', :hour => '12', :min => '0', :sec => '0' ) result.should be_kind_of(DateTime) result.year.should eql(2006) result.month.should eql(11) result.day.should eql(23) result.hour.should eql(12) result.min.should eql(0) result.sec.should eql(0) end end describe 'and value is a string' do it 'parses the string' do @property.typecast('Dec, 2006').month.should == 12 end end it 'does not typecast non-datetime values' do @property.typecast('not-datetime').should eql('not-datetime') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ghost_dm-core-1.3.0.beta | spec/semipublic/property/date_time_spec.rb |