[352] | 1 | require File.dirname(__FILE__) + '/../../../../spec_helper'
|
---|
| 2 | include OpenEHR::RM::EHR
|
---|
| 3 | include OpenEHR::RM::Composition
|
---|
| 4 | include OpenEHR::RM::Common::ChangeControl
|
---|
| 5 | include OpenEHR::RM::DataTypes::Text
|
---|
| 6 | include OpenEHR::RM::DataTypes::Quantity::DateTime
|
---|
| 7 |
|
---|
| 8 | describe VersionedComposition do
|
---|
| 9 | before(:each) do
|
---|
| 10 | composition1 = stub(Composition, :archetype_node_id => 'at0002',
|
---|
| 11 | :is_persistent? => true)
|
---|
| 12 | version1 = stub(Version, :data => composition1)
|
---|
| 13 | composition2 = stub(Composition, :archetype_node_id => 'at0002',
|
---|
| 14 | :is_persistent? => false)
|
---|
| 15 | version2 = stub(Version, :data => composition2)
|
---|
| 16 | uid = HierObjectID.new(:value => 'opeehr.jp::350')
|
---|
| 17 | owner_id = stub(ObjectRef, :type => 'EHR')
|
---|
| 18 | time_created = DvDateTime.new(:value => '2009-11-16T15:14:33')
|
---|
| 19 | @versioned_composition =
|
---|
| 20 | VersionedComposition.new(:uid => uid,
|
---|
| 21 | :owner_id => owner_id,
|
---|
| 22 | :time_created => time_created,
|
---|
| 23 | :all_versions => [version1, version2])
|
---|
| 24 | end
|
---|
| 25 |
|
---|
| 26 | it 'should be an instance of VersionedComposition' do
|
---|
| 27 | @versioned_composition.should be_an_instance_of VersionedComposition
|
---|
| 28 | end
|
---|
| 29 |
|
---|
| 30 | it 'is_persistent? should be evaluated by first version' do
|
---|
| 31 | @versioned_composition.is_persistent?.should be_true
|
---|
| 32 | end
|
---|
| 33 | end
|
---|