Changeset 301 for ruby/branches
- Timestamp:
- Sep 26, 2009, 10:15:57 PM (15 years ago)
- Location:
- ruby/branches/0.5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/branches/0.5/lib/open_ehr/rm/common/archetyped.rb
r300 r301 78 78 end 79 79 80 def item_at_path(path) 81 if !@path.nil? 82 if @path == "" 83 raise ArgumentError, "path is not valid" 84 end 80 def concept 81 if self.is_archetype_root? 82 return DvText.new(:value => 83 @archetype_details.archetype_id.concept_name) 84 else 85 raise ArgumentError, 'this is not root' 85 86 end 86 end87 88 def concept89 return DvText.new(:value =>90 @archetype_details.archetype_id.concept_name)91 87 end 92 88 -
ruby/branches/0.5/spec/lib/open_ehr/rm/common/archetyped/locatable_spec.rb
r300 r301 9 9 link = stub(Set, :size => 10, :empty? => false) 10 10 uid = UIDBasedID.new(:value => 'ehr::localhost/3030') 11 archetype_details = stub(Archetyped, :rm_version => '1.2.4') 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') 12 16 @locatable = Locatable.new(:archetype_node_id => 'at001', 13 17 :name => name, 14 18 :links => link, 15 19 :uid => uid, 20 :feeder_audit => feeder_audit, 16 21 :archetype_details => archetype_details) 17 22 end … … 23 28 it 'archetype_node_id should be at001' do 24 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 25 39 end 26 40 … … 41 55 end 42 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 43 65 it 'should raise ArgumentError with nil archetype_node_id' do 44 66 lambda { … … 47 69 end 48 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 49 89 end
Note:
See TracChangeset
for help on using the changeset viewer.