source: ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/time_definitions_spec.rb@ 281

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

date and time are seeds of headache

File size: 1.4 KB
RevLine 
[281]1require File.dirname(__FILE__) + '/../../../spec_helper'
2include OpenEHR::AssumedLibraryTypes
3
4describe TimeDefinitions do
5 describe 'year behavior' do
6 it 'should more than zero in openEHR specification' do
7 TimeDefinitions.should be_valid_year 0
8 end
9
10 it '-1 should not be valid year' do
11 TimeDefinitions.should_not be_valid_year -1
12 end
13
14 it 'nil year should be invaild' do
15 TimeDefinitions.should_not be_valid_year nil
16 end
17 end
18
19
20 describe 'month behavior' do
21 (1..12).each do |month|
22 it "should valid #{month}" do
23 TimeDefinitions.should be_valid_month month
24 end
25 end
26
27 it '0th month should be invalid' do
28 TimeDefinitions.should_not be_valid_month 0
29 end
30
31 it '13th month should be invalid' do
32 TimeDefinitions.should_not be_valid_month 13
33 end
34 end
35
36 describe 'day behavior' do
37 it '0 day should not be valid day' do
38 TimeDefinitions.should_not be_valid_day(1,2,0)
39 end
40
41 it '32 day should not be valid day' do
42 TimeDefinitions.should_not be_valid_day(1,2,32)
43 end
44
45 it 'should be valid 2009-09-19' do
46 TimeDefinitions.should be_valid_day(2009,9,19)
47 end
48
49 it 'should be invalid 2009 nil 19' do
50 TimeDefinitions.should_not be_valid_day(2009, nil,19)
51 end
52
53 it 'shoudl be invalid nil 09 19' do
54 TimeDefinitions.should_not be_valid_day(nil, 9, 19)
55 end
56 end
57
58 describe 'hour behavior'
59end
Note: See TracBrowser for help on using the repository browser.