[296] | 1 | require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
---|
| 2 | include OpenEHR::RM::Common::Archetyped
|
---|
| 3 | include OpenEHR::RM::DataTypes::Text
|
---|
| 4 | include OpenEHR::RM::Support::Identification
|
---|
| 5 |
|
---|
| 6 | describe Locatable do
|
---|
| 7 | before(:each) do
|
---|
| 8 | name = DvText.new(:value => 'problem/SOAP')
|
---|
[300] | 9 | link = stub(Set, :size => 10, :empty? => false)
|
---|
| 10 | uid = UIDBasedID.new(:value => 'ehr::localhost/3030')
|
---|
[301] | 11 | archetype_id = ArchetypeID.new(:value =>
|
---|
| 12 | 'openEHR-EHR-SECTION.physical_examination.v2')
|
---|
| 13 | archetype_details = stub(Archetyped, :rm_version => '1.2.4',
|
---|
| 14 | :archetype_id => archetype_id)
|
---|
| 15 | feeder_audit = stub(FeederAudit, :system_id => 'MAGI')
|
---|
[296] | 16 | @locatable = Locatable.new(:archetype_node_id => 'at001',
|
---|
| 17 | :name => name,
|
---|
[300] | 18 | :links => link,
|
---|
| 19 | :uid => uid,
|
---|
[301] | 20 | :feeder_audit => feeder_audit,
|
---|
[300] | 21 | :archetype_details => archetype_details)
|
---|
[296] | 22 | end
|
---|
| 23 |
|
---|
| 24 | it 'should be_an_instance_of Locatable' do
|
---|
| 25 | @locatable.should be_an_instance_of Locatable
|
---|
| 26 | end
|
---|
| 27 |
|
---|
[300] | 28 | it 'archetype_node_id should be at001' do
|
---|
| 29 | @locatable.archetype_node_id.should == 'at001'
|
---|
| 30 | end
|
---|
| 31 |
|
---|
[301] | 32 | it 'is_archetype_root? should be true' do
|
---|
| 33 | @locatable.is_archetype_root?.should be_true
|
---|
| 34 | end
|
---|
| 35 |
|
---|
| 36 | it 'is_archetype_root? should be false when archetype_details is nil' do
|
---|
| 37 | @locatable.archetype_details = nil
|
---|
| 38 | @locatable.is_archetype_root?.should be_false
|
---|
| 39 | end
|
---|
| 40 |
|
---|
[300] | 41 | it 'link size should be 10' do
|
---|
| 42 | @locatable.links.size.should == 10
|
---|
| 43 | end
|
---|
| 44 |
|
---|
| 45 | it 'name.value should problem/soap' do
|
---|
| 46 | @locatable.name.value.should == 'problem/SOAP'
|
---|
| 47 | end
|
---|
| 48 |
|
---|
| 49 | it 'uid.value should be ehr::localhost/3030' do
|
---|
| 50 | @locatable.uid.value.should == 'ehr::localhost/3030'
|
---|
| 51 | end
|
---|
| 52 |
|
---|
| 53 | it 'archetype_details.rm_version should be 1.2.4' do
|
---|
| 54 | @locatable.archetype_details.rm_version.should == '1.2.4'
|
---|
| 55 | end
|
---|
| 56 |
|
---|
[301] | 57 | it 'feeer_audit.system_id should MAGI' do
|
---|
| 58 | @locatable.feeder_audit.system_id.should == 'MAGI'
|
---|
| 59 | end
|
---|
| 60 |
|
---|
| 61 | it 'concept should be physical_examination' do
|
---|
| 62 | @locatable.concept.value.should == 'physical_examination'
|
---|
| 63 | end
|
---|
| 64 |
|
---|
[296] | 65 | it 'should raise ArgumentError with nil archetype_node_id' do
|
---|
| 66 | lambda {
|
---|
| 67 | @locatable.archetype_node_id = nil
|
---|
| 68 | }.should raise_error ArgumentError
|
---|
| 69 | end
|
---|
| 70 |
|
---|
[301] | 71 | it 'should raise ArgumentError with nil name' do
|
---|
| 72 | lambda {
|
---|
| 73 | @locatable.name = nil
|
---|
| 74 | }.should raise_error ArgumentError
|
---|
| 75 | end
|
---|
| 76 |
|
---|
| 77 | it 'should raise ArgumentError with empty links' do
|
---|
| 78 | lambda {
|
---|
| 79 | @locatable.links = Set.new
|
---|
| 80 | }.should raise_error ArgumentError
|
---|
| 81 | end
|
---|
| 82 |
|
---|
| 83 | it 'should raise ArgumentError Archetyped invalid' do
|
---|
| 84 | @locatable.archetype_details = nil
|
---|
| 85 | lambda {
|
---|
| 86 | @locatable.concept
|
---|
| 87 | }.should raise_error ArgumentError
|
---|
| 88 | end
|
---|
[296] | 89 | end
|
---|