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

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

archetype id corrected

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