source: ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/archetype_id_spec.rb@ 267

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

bugs fixed around identification

File size: 4.3 KB
RevLine 
[262]1require File.dirname(__FILE__) + '/../../../../../spec_helper'
2include OpenEHR::RM::Support::Identification
3
4describe ArchetypeID do
5 before(:each) do
6 @archetype_id = ArchetypeID.new(:value => 'openEHR-EHR-SECTION.physical_examination-prenatal.v2')
7 end
8
9 it 'should be an instance of ArchetypeID' do
10 @archetype_id.should be_an_instance_of ArchetypeID
11 end
12
[267]13 it 's value should be equal
14 openEHR-EHR-SECTION.physical_examination-prenatal.v2' do
15 @archetype_id.value.should ==
16 'openEHR-EHR-SECTION.physical_examination-prenatal.v2'
17 end
[262]18 it 's qualified_rm_entity should be openEHR-EHR-SECTION' do
19 @archetype_id.qualified_rm_entity.should == 'openEHR-EHR-SECTION'
20 end
21
22 it 's rm_originator should be openEHR' do
23 @archetype_id.rm_originator.should == 'openEHR'
24 end
25
26 it 's rm_name should be EHR' do
27 @archetype_id.rm_name.should == 'EHR'
28 end
29
30 it 'rm_entity should be SECTION' do
31 @archetype_id.rm_entity.should == 'SECTION'
32 end
33
34 it 's domain_concept should be physical_examination-prenatal' do
35 @archetype_id.domain_concept.should == 'physical_examination-prenatal'
36 end
37
38 it 's concept name should be physical_examination' do
39 @archetype_id.concept_name.should == 'physical_examination'
40 end
41
42 it 's specialisation should be prenatal' do
43 @archetype_id.specialisation.should == 'prenatal'
44 end
45
46 it 's version_id should == v2' do
47 @archetype_id.version_id.should == 'v2'
48 end
[264]49
50 it 'should raise ArgumentError with wrong id format' do
51 lambda {
52 ArchetypeID.new(:value =>'wrong-format')
53 }.should raise_error ArgumentError
54 end
55
56 it 'should raise ArgumentError with nil concept name' do
57 lambda {
58 @archetype_id.concept_name = nil
59 }.should raise_error ArgumentError
60 end
61
62 it 'should raise ArgumentError with wrong domain concept format' do
63 lambda {
64 @archetype_id.domain_concept = '0123'
65 }.should raise_error ArgumentError
66 end
67
68 it 'should raise ArgumentError with empty rm_entity' do
69 lambda {
70 @archetype_id.rm_entity = ''
71 }.should raise_error ArgumentError
72 end
73
74 it 'should raise ArgumentError with nil rm_entity' do
75 lambda {
76 @archetype_id.rm_entity = nil
77 }.should raise_error ArgumentError
78 end
79
80 it 'should raise ArgumentError with empty rm_originator' do
81 lambda {
82 @archetype_id.rm_originator = ''
83 }.should raise_error ArgumentError
84 end
85
86 it 'should raise ArgumentError with nil rm_originator' do
87 lambda {
88 @archetype_id.rm_originator = nil
89 }.should raise_error ArgumentError
90 end
91
92 it 'should raise ArgumentError with empty specialisation' do
93 lambda {
94 @archetype_id.specialisation = ''
95 }.should raise_error ArgumentError
96 end
97
98 it 'should not raise ArgumentError with nil specialisation' do
99 lambda {
100 @archetype_id.specialisation = nil
101 }.should_not raise_error ArgumentError
102 end
103
104 describe 'another constructor' do
105 before(:each) do
106 @archetype_id = ArchetypeID.new(:rm_originator => 'openEHR',
107 :rm_name => 'EHR',
108 :rm_entity => 'EVALUATION',
109 :concept_name => 'clinical_synopsis',
110 :version_id => 'v1')
111 end
112
113 it 'should be an instance of ArchetypeID' do
114 @archetype_id.should be_an_instance_of ArchetypeID
115 end
116
117 it 'domain_concept should be clinical_synopsis' do
118 @archetype_id.domain_concept.should == 'clinical_synopsis'
119 end
120 end
121
122 describe 'domain concept' do
123 before(:each) do
124 @archetype_id.domain_concept = 'progress_note-naturopathy'
125 end
126
127 it 'concept_name should be progress note' do
128 @archetype_id.concept_name.should == 'progress_note'
129 end
130
131 it 'specialisation should be naturopathy' do
132 @archetype_id.specialisation === 'naturopathy'
133 end
134
135 it 'should raise ArgumentError empty domain concept' do
136 lambda {
137 @archetype_id.domain_concept = ''
138 }.should raise_error ArgumentError
139 end
140
141 it 'should raise ArgumentError nil domain concept' do
142 lambda {
143 @archetype_id.domain_concept = nil
144 }.should raise_error ArgumentError
145 end
146
147 it 's specialisation may be empty' do
148 @archetype_id.domain_concept = 'clinical_synopsis'
149 @archetype_id.concept_name.should == 'clinical_synopsis'
150 end
151 end
[262]152end
Note: See TracBrowser for help on using the repository browser.