Index: /ruby/branches/0.5/lib/open_ehr/rm/composition/content/entry.rb
===================================================================
--- /ruby/branches/0.5/lib/open_ehr/rm/composition/content/entry.rb	(revision 358)
+++ /ruby/branches/0.5/lib/open_ehr/rm/composition/content/entry.rb	(revision 359)
@@ -96,4 +96,31 @@
           end
 
+          class Instruction < CareEntry
+            attr_reader :narrative, :activities
+            attr_accessor :expiry_time, :wf_definition
+
+            def initialize(args = { })
+              super(args)
+              self.narrative = args[:narrative]
+              self.activities = args[:activities]
+              self.expiry_time = args[:expiry_time]
+              self.wf_definition = args[:wf_definition]
+            end
+
+            def narrative=(narrative)
+              if narrative.nil?
+                raise ArgumentError, 'narrative is mandatory'
+              end
+              @narrative = narrative
+            end
+
+            def activities=(activities)
+              if !activities.nil? && activities.empty?
+                raise ArgumentError, 'activities should not be empty'
+              end
+              @activities = activities
+            end
+          end
+
           class Activity < Locatable
             attr_reader :description, :timing, :action_archetype_id
@@ -163,9 +190,53 @@
 
           class InstructionDetails < Pathable
-
+            attr_reader :instruction_id, :activity_id
+            attr_accessor :wf_details
+
+            def initialize(args = { })
+              super(args)
+              self.instruction_id = args[:instruction_id]
+              self.activity_id = args[:activity_id]
+              self.wf_details = args[:wf_details]
+            end
+
+            def instruction_id=(instruction_id)
+              if instruction_id.nil?
+                raise ArgumentError, 'instruction_id is mandatory'
+              end
+              @instruction_id = instruction_id
+            end
+
+            def activity_id=(activity_id)
+              if activity_id.nil? || activity_id.empty?
+                raise ArgumentError, 'activity_id is mandatory'
+              end
+              @activity_id = activity_id
+            end
           end
 
           class IsmTransition < Pathable
-
+            attr_reader :current_state, :transition
+            attr_accessor :careflow_step
+
+            def initialize(args = { })
+              super(args)
+              self.current_state = args[:current_state]
+              self.transition = args[:transition]
+              self.careflow_step = args[:careflow_step]
+            end
+
+            def current_state=(current_state)
+              if current_state.nil?
+                raise ArgumentError, 'current_state is mandatory'
+              end
+              @current_state = current_state
+            end
+
+            def transition=(transition)
+              if transition.nil?
+                raise ArgumentError, 'transition is mandatory'
+              end
+              @transition = transition
+            end
           end
         end # of Entry
Index: /ruby/branches/0.5/spec/lib/open_ehr/rm/composition/content/entry/instruction_details_spec.rb
===================================================================
--- /ruby/branches/0.5/spec/lib/open_ehr/rm/composition/content/entry/instruction_details_spec.rb	(revision 359)
+++ /ruby/branches/0.5/spec/lib/open_ehr/rm/composition/content/entry/instruction_details_spec.rb	(revision 359)
@@ -0,0 +1,51 @@
+require File.dirname(__FILE__) + '/../../../../../../spec_helper'
+include OpenEHR::RM::DataStructures::ItemStructure
+include OpenEHR::RM::Composition::Content::Entry
+include OpenEHR::RM::Support::Identification
+
+describe InstructionDetails do
+  before(:each) do
+    instruction_id = stub(LocatableRef, :path => '[instruction]/[test]')
+    wf_details = stub(ItemStructure, :archetype_node_id => 'at0004')
+    @instruction_details =
+      InstructionDetails.new(:instruction_id => instruction_id,
+                             :activity_id => 'at0003',
+                             :wf_details => wf_details)
+  end
+
+  it 'should be an instance of InstructionDetails' do
+    @instruction_details.should be_an_instance_of InstructionDetails
+  end
+
+  it 'instruction_id should be assigned properly' do
+    @instruction_details.instruction_id.path.should ==
+      '[instruction]/[test]'
+  end
+
+  it 'should raise ArgumentError with nil instruction_id' do
+    lambda {
+      @instruction_details.instruction_id = nil
+    }.should raise_error ArgumentError
+  end
+
+  it 'activity_id should be assigned properly' do
+    @instruction_details.activity_id.should == 'at0003'
+  end
+
+  it 'should raise ArgumentError with nil activity_id' do
+    lambda {
+      @instruction_details.activity_id = nil
+    }.should raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError with empty activity_id' do
+    lambda {
+      @instruction_details.activity_id = ''
+    }.should raise_error ArgumentError
+  end
+
+  it 'wf_details should be assigned properly' do
+    @instruction_details.wf_details.archetype_node_id.should == 
+      'at0004'
+  end
+end
Index: /ruby/branches/0.5/spec/lib/open_ehr/rm/composition/content/entry/instruction_spec.rb
===================================================================
--- /ruby/branches/0.5/spec/lib/open_ehr/rm/composition/content/entry/instruction_spec.rb	(revision 359)
+++ /ruby/branches/0.5/spec/lib/open_ehr/rm/composition/content/entry/instruction_spec.rb	(revision 359)
@@ -0,0 +1,58 @@
+require File.dirname(__FILE__) + '/../../../../../../spec_helper'
+require File.dirname(__FILE__) + '/shared_examples_spec'
+include OpenEHR::RM::Composition::Content::Entry
+include OpenEHR::RM::DataTypes::Text
+include OpenEHR::RM::DataTypes::Quantity::DateTime
+include OpenEHR::RM::DataTypes::Encapsulated
+
+describe Instruction do
+  it_should_behave_like 'entry'
+
+  before(:each) do
+    narrative = DvText.new(:value => 'instruction test')
+    activities = stub(Array, :size => 5, :empty? => false)
+    expiry_time = DvDateTime.new(:value => '2009-11-18T20:58:34')
+    wf_definition = stub(DvParsable, :value => 'behavior driven')
+    @instruction= Instruction.new(:archetype_node_id => 'at0001',
+                                  :name => @name,
+                                  :language => @language,
+                                  :encoding => @encoding,
+                                  :subject => @subject,
+                                  :narrative => narrative,
+                                  :activities => activities,
+                                  :expiry_time => expiry_time,
+                                  :wf_definition => wf_definition)
+  end
+
+  it 'should be an instance of Instruction' do
+    @instruction.should be_an_instance_of Instruction
+  end
+
+  it 'narrative should be assigned properly' do
+    @instruction.narrative.value.should == 'instruction test'
+  end
+
+  it 'should raise ArgumentError when narrative is assined with nil' do
+    lambda {
+      @instruction.narrative = nil
+    }.should raise_error ArgumentError
+  end
+
+  it 'activities should be assigned properly' do
+    @instruction.activities.size.should be_equal 5
+  end
+
+  it 'should raise ArgumentError with empty activities' do
+    lambda {
+      @instruction.activities = [ ]
+    }.should raise_error ArgumentError
+  end
+
+  it 'expiry_time should be assigned properly' do
+    @instruction.expiry_time.value.should == '2009-11-18T20:58:34'
+  end
+
+  it 'wf_definition should be assigned properly' do
+    @instruction.wf_definition.value.should == 'behavior driven'
+  end
+end
Index: /ruby/branches/0.5/spec/lib/open_ehr/rm/composition/content/entry/ism_transition_spec.rb
===================================================================
--- /ruby/branches/0.5/spec/lib/open_ehr/rm/composition/content/entry/ism_transition_spec.rb	(revision 359)
+++ /ruby/branches/0.5/spec/lib/open_ehr/rm/composition/content/entry/ism_transition_spec.rb	(revision 359)
@@ -0,0 +1,46 @@
+require File.dirname(__FILE__) + '/../../../../../../spec_helper'
+include OpenEHR::RM::Composition::Content::Entry
+include OpenEHR::RM::DataTypes::Text
+
+describe IsmTransition do
+  before(:each) do
+    current_state = stub(DvCodedText, :value => 'planned')
+    transition = stub(DvCodedText, :value => 'scheduled')
+    careflow_step = stub(DvCodedText, :value => 'completed')
+    @ism_transition = IsmTransition.new(:current_state => current_state,
+                                        :transition => transition,
+                                        :careflow_step => careflow_step)
+  end
+
+  it 'should be an instance of IsmTransition' do
+    @ism_transition.should be_an_instance_of IsmTransition
+  end
+
+  it 'current_status should be assigned properly' do
+    @ism_transition.current_state.value.should == 'planned'
+  end
+
+  it 'should raise ArgumentError with nil current state' do
+    lambda {
+      @ism_transition.current_state = nil
+    }.should raise_error ArgumentError
+  end
+
+  it 'should raise ArgumentError when current_state has invalid code'
+
+  it 'transition should be assined properly' do
+    @ism_transition.transition.value.should == 'scheduled'
+  end
+
+  it 'should raise ArgumentError with nil transition' do
+    lambda {
+      @ism_transition.transition = nil
+    }.should raise_error ArgumentError
+  end
+
+  it 'should raise ArugmentError with invalid transition code'
+
+  it 'careflow_step should be assigned properly' do
+    @ism_transition.careflow_step.value.should == 'completed'
+  end
+end
