[351] | 1 | require File.dirname(__FILE__) + '/../../../../spec_helper'
|
---|
| 2 | include OpenEHR::RM::EHR
|
---|
| 3 | include OpenEHR::RM::Common::Generic
|
---|
| 4 | include OpenEHR::RM::DataTypes::Text
|
---|
| 5 | include OpenEHR::RM::Support::Identification
|
---|
| 6 | include OpenEHR::RM::DataStructures::ItemStructure
|
---|
| 7 |
|
---|
| 8 | describe EHRStatus do
|
---|
| 9 | before(:each) do
|
---|
| 10 | external_ref = stub(PartyRef, :namespace => 'ehr status')
|
---|
| 11 | subject = PartySelf.new(:external_ref => external_ref)
|
---|
| 12 | other_details = stub(ItemStructure, :archetype_node_id => 'at0005')
|
---|
| 13 | @ehr_status = EHRStatus.new(:archetype_node_id => 'at0001',
|
---|
| 14 | :name => DvText.new(:value => 'ehrstatus'),
|
---|
| 15 | :subject => subject,
|
---|
| 16 | :is_queryable => false,
|
---|
| 17 | :is_modifiable => true,
|
---|
| 18 | :other_details => other_details)
|
---|
| 19 | end
|
---|
| 20 |
|
---|
| 21 | it 'should be an instance of EHRStatus' do
|
---|
| 22 | @ehr_status.should be_an_instance_of EHRStatus
|
---|
| 23 | end
|
---|
| 24 |
|
---|
| 25 | it 'subject should be assigned properly' do
|
---|
| 26 | @ehr_status.subject.external_ref.namespace.should == 'ehr status'
|
---|
| 27 | end
|
---|
| 28 |
|
---|
| 29 | it 'should raise ArgumentError with nil subject' do
|
---|
| 30 | lambda {
|
---|
| 31 | @ehr_status.subject = nil
|
---|
| 32 | }.should raise_error ArgumentError
|
---|
| 33 | end
|
---|
| 34 |
|
---|
| 35 | it 'is_queryable should be properly assigned' do
|
---|
| 36 | @ehr_status.is_queryable?.should be_false
|
---|
| 37 | end
|
---|
| 38 |
|
---|
| 39 | it 'is_modifiable should be assigned properly' do
|
---|
| 40 | @ehr_status.is_modifiable?.should be_true
|
---|
| 41 | end
|
---|
| 42 |
|
---|
| 43 | it 'other_details should be assigned properly' do
|
---|
| 44 | @ehr_status.other_details.archetype_node_id.should == 'at0005'
|
---|
| 45 | end
|
---|
[352] | 46 |
|
---|
| 47 | it 'should raise ArgumentError when parant is not nil' do
|
---|
| 48 | lambda {
|
---|
| 49 | @ehr_status.parent = 'parent'
|
---|
| 50 | }.should raise_error ArgumentError
|
---|
| 51 | end
|
---|
[351] | 52 | end
|
---|