source: ruby/trunk/spec/lib/open_ehr/rm/common/archetyped/locatable_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: 2.7 KB
Line 
1require File.dirname(__FILE__) + '/../../../../../spec_helper'
2include OpenEHR::RM::Common::Archetyped
3include OpenEHR::RM::DataTypes::Text
4include OpenEHR::RM::Support::Identification
5
6describe Locatable do
7 before(:each) do
8 name = DvText.new(:value => 'problem/SOAP')
9 link = stub(Set, :size => 10, :empty? => false)
10 uid = UIDBasedID.new(:value => 'ehr::localhost/3030')
11 archetype_id = ArchetypeID.new(:value =>
12 'openEHR-EHR-SECTION.physical_examination.v2')
13 archetype_details = stub(Archetyped, :rm_version => '1.2.4',
14 :archetype_id => archetype_id)
15 feeder_audit = stub(FeederAudit, :system_id => 'MAGI')
16 @locatable = Locatable.new(:archetype_node_id => 'at001',
17 :name => name,
18 :links => link,
19 :uid => uid,
20 :feeder_audit => feeder_audit,
21 :archetype_details => archetype_details)
22 end
23
24 it 'should be_an_instance_of Locatable' do
25 @locatable.should be_an_instance_of Locatable
26 end
27
28 it 'archetype_node_id should be at001' do
29 @locatable.archetype_node_id.should == 'at001'
30 end
31
32 it 'is_archetype_root? should be true' do
33 @locatable.is_archetype_root?.should be_true
34 end
35
36 it 'is_archetype_root? should be false when archetype_details is nil' do
37 @locatable.archetype_details = nil
38 @locatable.is_archetype_root?.should be_false
39 end
40
41 it 'link size should be 10' do
42 @locatable.links.size.should == 10
43 end
44
45 it 'name.value should problem/soap' do
46 @locatable.name.value.should == 'problem/SOAP'
47 end
48
49 it 'uid.value should be ehr::localhost/3030' do
50 @locatable.uid.value.should == 'ehr::localhost/3030'
51 end
52
53 it 'archetype_details.rm_version should be 1.2.4' do
54 @locatable.archetype_details.rm_version.should == '1.2.4'
55 end
56
57 it 'feeer_audit.system_id should MAGI' do
58 @locatable.feeder_audit.system_id.should == 'MAGI'
59 end
60
61 it 'concept should be physical_examination' do
62 @locatable.concept.value.should == 'physical_examination'
63 end
64
65 it 'should raise ArgumentError with nil archetype_node_id' do
66 lambda {
67 @locatable.archetype_node_id = nil
68 }.should raise_error ArgumentError
69 end
70
71 it 'should raise ArgumentError with nil name' do
72 lambda {
73 @locatable.name = nil
74 }.should raise_error ArgumentError
75 end
76
77 it 'should raise ArgumentError with empty links' do
78 lambda {
79 @locatable.links = Set.new
80 }.should raise_error ArgumentError
81 end
82
83 it 'should raise ArgumentError Archetyped invalid' do
84 @locatable.archetype_details = nil
85 lambda {
86 @locatable.concept
87 }.should raise_error ArgumentError
88 end
89end
Note: See TracBrowser for help on using the repository browser.