Sha256: 23f40aa0768d00753348ecd1dc91c85c66414b12ae6255169e84ab9f90c88c34
Contents?: true
Size: 1.27 KB
Versions: 20
Compression:
Stored size: 1.27 KB
Contents
require File.dirname(__FILE__) + '/../../../spec_helper' include OpenEHR::AssumedLibraryTypes describe ISO8601DateTime do before(:each) do @iso8601date_time = ISO8601DateTime.new('2009-06-29T12:34:56.78+0900') end it 'should be an instance of ISO8601DateTime' do @iso8601date_time.should be_an_instance_of ISO8601DateTime end it 'should be 2009-06-29T12:34:56.78T+09:00 as string' do @iso8601date_time.as_string.should == '2009-06-29T12:34:56.78+0900' end it 'should raise ArgumentError with invalid date format' do lambda { ISO8601DateTime.new('2009:06:29Z12-34-56') }.should raise_error ArgumentError end it 'should raise ArgumentErrow with empty argument' do lambda { ISO8601DateTime.new('') }.should raise_error ArgumentError end it 'allows without fractional second' do lambda { ISO8601DateTime.new('2009-06-29T12:34:56') }.should_not raise_error ArgumentError end describe 'partial date' do it 'should recognize 2009-06' do @iso8601date_time.day = nil @iso8601date_time.as_string.should == '2009-06' end it 'should recognize 2009' do @iso8601date_time.day = nil @iso8601date_time.month = nil @iso8601date_time.as_string.should == '2009' end end end
Version data entries
20 entries across 20 versions & 2 rubygems