Changeset 300


Ignore:
Timestamp:
Sep 25, 2009, 6:56:37 PM (15 years ago)
Author:
KOBAYASHI, Shinji
Message:

archetyped package is difficult

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  
    6565
    6666          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
    6870            @name = name
    6971          end
     72
    7073          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
    7277            @links = links
    7378          end
     
    8186          end
    8287
    83           def items_at_path(path)
    84             raise NotImplementError, "items_at_path must be implemented"
    85           end
    86 
    87           def path_exists?
    88             raise NotImplementError, "path_exists? must be implemented"
    89           end
    90 
    91           def path_unique
    92             raise NotImplementError, "path_unique must be implemented"
    93           end
    94 
    9588          def concept
     89            return DvText.new(:value =>
     90                              @archetype_details.archetype_id.concept_name)
    9691          end
    9792
     
    10499          attr_reader :archetype_id, :rm_version
    105100          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)
    107103            self.archetype_id = archetype_id
    108104            self.rm_version = rm_version
    109105            self.template_id = template_id
    110106          end
     107
    111108          def archetype_id=(archetype_id)
    112109            raise ArgumentError, "invalid archetype_id" if archetype_id.nil?
    113110            @archetype_id = archetype_id
    114111          end
     112
    115113          def rm_version=(rm_version)
    116114            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  
    77  before(:each) do
    88    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')
    1112    @locatable = Locatable.new(:archetype_node_id => 'at001',
    1213                               :name => name,
    13                                :link => link,
    14                                :id => id)
     14                               :links => link,
     15                               :uid => uid,
     16                               :archetype_details => archetype_details)
    1517  end
    1618
    1719  it 'should be_an_instance_of Locatable' do
    1820    @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'
    1941  end
    2042
     
    2547  end
    2648
    27   it 'should'
    2849end
Note: See TracChangeset for help on using the changeset viewer.