Index: /ruby/branches/0.5/lib/open_ehr/rm/common/archetyped.rb
===================================================================
--- /ruby/branches/0.5/lib/open_ehr/rm/common/archetyped.rb	(revision 304)
+++ /ruby/branches/0.5/lib/open_ehr/rm/common/archetyped.rb	(revision 305)
@@ -96,8 +96,8 @@
           attr_accessor :template_id
 
-          def initialize(archetype_id, rm_version, template_id = nil)
-            self.archetype_id = archetype_id
-            self.rm_version = rm_version
-            self.template_id = template_id
+          def initialize(args = { })
+            self.archetype_id = args[:archetype_id]
+            self.rm_version = args[:rm_version]
+            self.template_id = args[:template_id]
           end
 
@@ -108,5 +108,7 @@
 
           def rm_version=(rm_version)
-            raise ArgumentError, "invalid rm_version" if rm_version.nil? or rm_version.empty?
+            if rm_version.nil? or rm_version.empty?
+              raise ArgumentError, "invalid rm_version"
+            end
             @rm_version = rm_version
           end
@@ -115,8 +117,8 @@
         class Link
           attr_reader :meaning, :target, :type
-          def initialize(meaning, target, type)
-            self.meaning = meaning
-            self.target = target
-            self.type = type
+          def initialize(args = { })
+            self.meaning = args[:meaning]
+            self.target = args[:target]
+            self.type = args[:type]
           end
           def meaning=(meaning)
Index: /ruby/branches/0.5/spec/lib/open_ehr/rm/common/archetyped/archetyped_spec.rb
===================================================================
--- /ruby/branches/0.5/spec/lib/open_ehr/rm/common/archetyped/archetyped_spec.rb	(revision 305)
+++ /ruby/branches/0.5/spec/lib/open_ehr/rm/common/archetyped/archetyped_spec.rb	(revision 305)
@@ -0,0 +1,50 @@
+require File.dirname(__FILE__) + '/../../../../../spec_helper'
+include OpenEHR::RM::Common::Archetyped
+include OpenEHR::RM::Support::Identification
+
+describe Archetyped do
+  before(:each) do
+    archetype_id = ArchetypeID.new(:value => 
+                      'openEHR-EHR-SECTION.physical_examination.v2')
+    template_id = TemplateID.new(:value =>
+                   'uk.nhs.cfh:openehr-EHR-COMPOSITION.admission_ed.v5')
+    @archetyped = Archetyped.new(:archetype_id => archetype_id,
+                                 :rm_version => '1.2.4',
+                                 :template_id => template_id)
+  end
+
+  it 'should be an instance of Archetyped' do
+    @archetyped.should be_an_instance_of Archetyped
+  end
+
+  it 'archetype id concept rm_name should be EHR' do
+    @archetyped.archetype_id.rm_name.should == 'EHR'
+  end
+
+  it 'rm_version should 1.2.4' do
+    @archetyped.rm_version.should == '1.2.4'
+  end
+
+  it 'template_id.value should be uk.nhs.cfh:openehr-EHR-COMPOSITION.admission_ed.v5' do
+    @archetyped.template_id.value.should ==
+      'uk.nhs.cfh:openehr-EHR-COMPOSITION.admission_ed.v5'
+  end
+
+  it 'should raise ArgumentError with nil rm_version' do
+    lambda {
+      @archetyped.rm_version = nil
+    }.should raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with empty rm_version' do
+    lambda {
+      @archetyped.rm_version = ''
+    }.should raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with nil ArchetypeID' do
+    lambda {
+      @archetyped.archetype_id = nil
+    }.should raise_error ArgumentError
+  end
+end
Index: /ruby/branches/0.5/spec/lib/open_ehr/rm/common/archetyped/link_spec.rb
===================================================================
--- /ruby/branches/0.5/spec/lib/open_ehr/rm/common/archetyped/link_spec.rb	(revision 305)
+++ /ruby/branches/0.5/spec/lib/open_ehr/rm/common/archetyped/link_spec.rb	(revision 305)
@@ -0,0 +1,43 @@
+require File.dirname(__FILE__) + '/../../../../../spec_helper'
+include OpenEHR::RM::Common::Archetyped
+include OpenEHR::RM::DataTypes::Text
+include OpenEHR::RM::DataTypes::Uri
+
+describe Link do
+  before(:each) do
+    @link = Link.new(:meaning => DvText.new(:value => 'generic'),
+                     :type => DvText.new(:value => 'problem'),
+                     :target => DvEhrUri.new(:value => 'ehr://test'))
+  end
+
+  it 'should be an instance of Link' do
+    @link.should be_an_instance_of Link
+  end
+
+  it 'meaning should be generic' do
+    @link.meaning.value.should == 'generic'
+  end
+
+  it 'target should be ehr://test' do
+    @link.target.value.should == 'ehr://test'
+  end
+
+  it 'should raise ArgumentError with nil meaning' do
+    lambda {
+      @link.meaning = nil
+    }.should raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with nil type' do
+    lambda {
+      @link.type = nil
+    }.should raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with nil target' do
+    lambda {
+      @link.target = nil
+    }.should raise_error ArgumentError
+  end
+
+end
