1 | require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
---|
2 | include OpenEHR::RM::DataStructures::History
|
---|
3 | include OpenEHR::RM::DataStructures::ItemStructure
|
---|
4 | include OpenEHR::RM::DataTypes::Text
|
---|
5 | include OpenEHR::RM::DataTypes::Quantity::DateTime
|
---|
6 |
|
---|
7 | describe 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
|
---|
43 | end
|
---|