source: ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/iso8601_timezone_spec.rb@ 288

Last change on this file since 288 was 288, checked in by KOBAYASHI, Shinji, 15 years ago

timezone completed

File size: 1.3 KB
Line 
1require File.dirname(__FILE__) + '/../../../spec_helper'
2include OpenEHR::AssumedLibraryTypes
3
4describe ISO8601Timezone do
5 before(:each) do
6 @iso8601timezone = ISO8601Timezone.new('+0900')
7 end
8
9 it 'should be an instance of ISO8601Timezone' do
10 @iso8601timezone.should be_an_instance_of ISO8601Timezone
11 end
12
13 it 'sign should be +1' do
14 @iso8601timezone.sign.should == +1
15 end
16
17 it 'hour should be 9' do
18 @iso8601timezone.hour.should == 9
19 end
20
21 it 'minute should be 0' do
22 @iso8601timezone.minute.should == 0
23 end
24
25 it 'should be +0900 as string' do
26 @iso8601timezone.as_string.should == '+0900'
27 end
28
29 it 'should not be gmt' do
30 @iso8601timezone.is_gmt?.should_not be_true
31 end
32
33 it 'should raise ArgumentError with invalid format' do
34 lambda {
35 ISO8601Timezone.new('ABCDE')
36 }.should raise_error ArgumentError
37 end
38
39 it 'should allow - sign' do
40 @iso8601timezone = ISO8601Timezone.new('-5000')
41 @iso8601timezone.as_string.should == '-5000'
42 end
43
44 describe 'GMT' do
45 before(:each) do
46 @iso8601timezone = ISO8601Timezone.new('Z')
47 end
48
49 it 'should racognize UTC as Z' do
50 @iso8601timezone.as_string.should == '+0000'
51 end
52
53 it 'should be gmt(almost)' do
54 @iso8601timezone.is_gmt?.should be_true
55 end
56 end
57end
Note: See TracBrowser for help on using the repository browser.