[359] | 1 | require File.dirname(__FILE__) + '/../../../../../../spec_helper'
|
---|
| 2 | include OpenEHR::RM::DataStructures::ItemStructure
|
---|
| 3 | include OpenEHR::RM::Composition::Content::Entry
|
---|
| 4 | include OpenEHR::RM::Support::Identification
|
---|
| 5 |
|
---|
| 6 | describe InstructionDetails do
|
---|
| 7 | before(:each) do
|
---|
| 8 | instruction_id = stub(LocatableRef, :path => '[instruction]/[test]')
|
---|
| 9 | wf_details = stub(ItemStructure, :archetype_node_id => 'at0004')
|
---|
| 10 | @instruction_details =
|
---|
| 11 | InstructionDetails.new(:instruction_id => instruction_id,
|
---|
| 12 | :activity_id => 'at0003',
|
---|
| 13 | :wf_details => wf_details)
|
---|
| 14 | end
|
---|
| 15 |
|
---|
| 16 | it 'should be an instance of InstructionDetails' do
|
---|
| 17 | @instruction_details.should be_an_instance_of InstructionDetails
|
---|
| 18 | end
|
---|
| 19 |
|
---|
| 20 | it 'instruction_id should be assigned properly' do
|
---|
| 21 | @instruction_details.instruction_id.path.should ==
|
---|
| 22 | '[instruction]/[test]'
|
---|
| 23 | end
|
---|
| 24 |
|
---|
| 25 | it 'should raise ArgumentError with nil instruction_id' do
|
---|
| 26 | lambda {
|
---|
| 27 | @instruction_details.instruction_id = nil
|
---|
| 28 | }.should raise_error ArgumentError
|
---|
| 29 | end
|
---|
| 30 |
|
---|
| 31 | it 'activity_id should be assigned properly' do
|
---|
| 32 | @instruction_details.activity_id.should == 'at0003'
|
---|
| 33 | end
|
---|
| 34 |
|
---|
| 35 | it 'should raise ArgumentError with nil activity_id' do
|
---|
| 36 | lambda {
|
---|
| 37 | @instruction_details.activity_id = nil
|
---|
| 38 | }.should raise_error ArgumentError
|
---|
| 39 | end
|
---|
| 40 |
|
---|
| 41 | it 'should raise ArgumentError with empty activity_id' do
|
---|
| 42 | lambda {
|
---|
| 43 | @instruction_details.activity_id = ''
|
---|
| 44 | }.should raise_error ArgumentError
|
---|
| 45 | end
|
---|
| 46 |
|
---|
| 47 | it 'wf_details should be assigned properly' do
|
---|
| 48 | @instruction_details.wf_details.archetype_node_id.should ==
|
---|
| 49 | 'at0004'
|
---|
| 50 | end
|
---|
| 51 | end
|
---|