Index: ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/history/history_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/history/history_spec.rb	(revision 342)
+++ ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/history/history_spec.rb	(revision 342)
@@ -0,0 +1,66 @@
+require File.dirname(__FILE__) + '/../../../../../spec_helper'
+include OpenEHR::RM::DataStructures::History
+include OpenEHR::RM::DataStructures::ItemStructure
+include OpenEHR::RM::DataTypes::Text
+include OpenEHR::RM::DataTypes::Quantity::DateTime
+describe History do
+  before(:each) do
+    origin = DvDateTime.new(:value => '2009-11-01T00:00:00')
+    period = DvDuration.new(:value => 'P1Y2M3W4D')
+    duration = DvDuration.new(:value => 'P0Y0M0W6D')
+    events = [stub(Event, :archetype_node_id => 'at0002')]
+    summary = stub(ItemStructure, :archetype_node_id => 'at0003')
+    @history = History.new(:archetype_node_id => 'at0001',
+                           :name => DvText.new(:value => 'history test'),
+                           :origin => origin,
+                           :period => period,
+                           :duration => duration,
+                           :events => events,
+                           :summary => summary)
+  end
+
+  it 'should be an instance of History' do
+    @history.should be_an_instance_of History
+  end
+
+  it 'origin should be properly assigned' do
+    @history.origin.value.should == '2009-11-01T00:00:00'
+  end
+
+  it 'should raise ArgumentError with nil origin' do
+    lambda {
+      @history.origin = nil
+    }.should raise_error ArgumentError
+  end
+
+  it 'period should be properly assigned' do
+    @history.period.value.should == 'P1Y2M3W4D'
+  end
+
+  it 'duration should be properly assigned' do
+    @history.duration.value.should == 'P0Y0M0W6D'
+  end
+
+  it 'is_periodic? should be true when period is not nil' do
+    @history.is_periodic?.should be_true
+  end
+
+  it 'is_periodic? should be false when period is nil' do
+    @history.period = nil
+    @history.is_periodic?.should be_false
+  end
+
+  it 'events should be properly assigned' do
+    @history.events[0].archetype_node_id.should == 'at0002'
+  end
+
+  it 'empty events should raise ArgumentError' do
+    lambda {
+      @history.events = []
+    }.should raise_error ArgumentError
+  end
+
+  it 'summary should be properly assigned' do
+    @history.summary.archetype_node_id.should == 'at0003'
+  end
+end
Index: ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/item_structure/representation/cluster_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/item_structure/representation/cluster_spec.rb	(revision 342)
+++ ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/item_structure/representation/cluster_spec.rb	(revision 342)
@@ -0,0 +1,26 @@
+require File.dirname(__FILE__) + '/../../../../../../spec_helper'
+include OpenEHR::RM::DataStructures::ItemStructure::Representation
+include OpenEHR::RM::DataTypes::Text
+
+describe Cluster do
+  before(:each) do
+    item = stub(Item)
+    @cluster = Cluster.new(:archetype_node_id => 'at0001',
+                           :name => DvText.new(:value => 'cluster'),
+                           :items => [item, item])
+  end
+
+  it 'should be an isntance of Cluster' do
+    @cluster.should be_an_instance_of Cluster
+  end
+
+  it 'item size should be 2' do
+    @cluster.items.size.should == 2
+  end
+
+  it 'should raise ArgumentError with empty items' do
+    lambda {
+      @cluster.items = []
+    }.should raise_error ArgumentError
+  end
+end
Index: ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/item_structure/representation/element_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/item_structure/representation/element_spec.rb	(revision 342)
+++ ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/item_structure/representation/element_spec.rb	(revision 342)
@@ -0,0 +1,22 @@
+require File.dirname(__FILE__) + '/../../../../../../spec_helper'
+include OpenEHR::RM::DataStructures::ItemStructure::Representation
+include OpenEHR::RM::DataTypes::Text
+
+describe Element do
+  before(:each) do
+    value = DvText.new(:value => 'test')
+    @element = Element.new(:archetype_node_id => 'at0001',
+                           :name => DvText.new(:value => 'element'),
+                           :value => value)
+  end
+
+  it 'should be an instance of Element' do
+    @element.should be_an_instance_of Element
+  end
+
+  it 'value should be assigned as test' do
+    @element.value.value.should == 'test'
+  end
+
+  it 'nullflavor should be assigned'
+end
