Changeset 300 for ruby/branches
- Timestamp:
- Sep 25, 2009, 6:56:37 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
r292 r300 65 65 66 66 def name=(name) 67 raise ArgumentError, 'name should not be empty' if name.nil? or name.value.empty? 67 if name.nil? or name.value.empty? 68 raise ArgumentError, 'name should not be empty' 69 end 68 70 @name = name 69 71 end 72 70 73 def links=(links) 71 raise ArgumentError, "links shoud not be empty" if !links.nil? and links.empty? 74 if !links.nil? and links.empty? 75 raise ArgumentError, "links shoud not be empty" 76 end 72 77 @links = links 73 78 end … … 81 86 end 82 87 83 def items_at_path(path)84 raise NotImplementError, "items_at_path must be implemented"85 end86 87 def path_exists?88 raise NotImplementError, "path_exists? must be implemented"89 end90 91 def path_unique92 raise NotImplementError, "path_unique must be implemented"93 end94 95 88 def concept 89 return DvText.new(:value => 90 @archetype_details.archetype_id.concept_name) 96 91 end 97 92 … … 104 99 attr_reader :archetype_id, :rm_version 105 100 attr_accessor :template_id 106 def initialize(archetype_id, rm_version, template_id = nil) 101 102 def initialize(archetype_id, rm_version, template_id = nil) 107 103 self.archetype_id = archetype_id 108 104 self.rm_version = rm_version 109 105 self.template_id = template_id 110 106 end 107 111 108 def archetype_id=(archetype_id) 112 109 raise ArgumentError, "invalid archetype_id" if archetype_id.nil? 113 110 @archetype_id = archetype_id 114 111 end 112 115 113 def rm_version=(rm_version) 116 114 raise ArgumentError, "invalid rm_version" if rm_version.nil? or rm_version.empty? -
ruby/branches/0.5/spec/lib/open_ehr/rm/common/archetyped/locatable_spec.rb
r296 r300 7 7 before(:each) do 8 8 name = DvText.new(:value => 'problem/SOAP') 9 link = stub(Set, :size => 10) 10 id = UIDBasedID.new(:value => 'ehr::localhost/3030') 9 link = stub(Set, :size => 10, :empty? => false) 10 uid = UIDBasedID.new(:value => 'ehr::localhost/3030') 11 archetype_details = stub(Archetyped, :rm_version => '1.2.4') 11 12 @locatable = Locatable.new(:archetype_node_id => 'at001', 12 13 :name => name, 13 :link => link, 14 :id => id) 14 :links => link, 15 :uid => uid, 16 :archetype_details => archetype_details) 15 17 end 16 18 17 19 it 'should be_an_instance_of Locatable' do 18 20 @locatable.should be_an_instance_of Locatable 21 end 22 23 it 'archetype_node_id should be at001' do 24 @locatable.archetype_node_id.should == 'at001' 25 end 26 27 it 'link size should be 10' do 28 @locatable.links.size.should == 10 29 end 30 31 it 'name.value should problem/soap' do 32 @locatable.name.value.should == 'problem/SOAP' 33 end 34 35 it 'uid.value should be ehr::localhost/3030' do 36 @locatable.uid.value.should == 'ehr::localhost/3030' 37 end 38 39 it 'archetype_details.rm_version should be 1.2.4' do 40 @locatable.archetype_details.rm_version.should == '1.2.4' 19 41 end 20 42 … … 25 47 end 26 48 27 it 'should'28 49 end
Note:
See TracChangeset
for help on using the changeset viewer.