source: ruby/trunk/spec/lib/open_ehr/rm/data_structures/history/interval_event_spec.rb@ 369

Last change on this file since 369 was 369, checked in by KOBAYASHI, Shinji, 14 years ago

merge from branches/0.5

File size: 1.6 KB
Line 
1require File.dirname(__FILE__) + '/../../../../../spec_helper'
2include OpenEHR::RM::DataStructures::History
3include OpenEHR::RM::DataStructures::ItemStructure
4include OpenEHR::RM::DataTypes::Text
5include OpenEHR::RM::DataTypes::Quantity::DateTime
6
7describe IntervalEvent do
8 before(:each) do
9 time = DvDateTime.new(:value => '2009-11-12T10:19:33')
10 state = stub(ItemStructure, :archetype_node_id => 'at0002')
11 origin = DvDateTime.new(:value => '2009-11-11T10:20:40')
12 parent = stub(History, :origin => origin)
13 math_function = stub(DvCodedText, :value => 'mean')
14 width = DvDuration.new(:value => 'P0Y2M1W3DT5H7M3S')
15 @interval_event = IntervalEvent.new(:archetype_node_id => 'at0001',
16 :name => DvText.new(:value => 'Event test'),
17 :time => time,
18 :data => 'data',
19 :width => width,
20 :math_function => math_function,
21 :sample_count => 1234)
22 end
23
24 it 'should be an instance of IntervalEvent' do
25 @interval_event.should be_an_instance_of IntervalEvent
26 end
27
28 it 'width should be assigned properly' do
29 @interval_event.width.value.should == 'P0Y2M1W3DT5H7M3S'
30 end
31
32 it 'math_function should be assigned properly' do
33 @interval_event.math_function.value.should == 'mean'
34 end
35
36 it 'sample_count should be assigned properly' do
37 @interval_event.sample_count.should be_equal 1234
38 end
39
40 it 'should subtract time for interval start time' do
41 @interval_event.interval_start_time.value.should == '2009-09-09T05:12:30+09:00'
42 end
43end
Note: See TracBrowser for help on using the repository browser.