1 | require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
---|
2 | require File.dirname(__FILE__) + '/shared_examples_spec'
|
---|
3 | include OpenEHR::RM::Common::ChangeControl
|
---|
4 | include OpenEHR::RM::Common::Generic
|
---|
5 | include OpenEHR::RM::DataTypes::Text
|
---|
6 |
|
---|
7 | describe Version do
|
---|
8 | it_should_behave_like 'change_control'
|
---|
9 |
|
---|
10 | it 'should be an instance of Version' do
|
---|
11 | @version.should be_an_instance_of Version
|
---|
12 | end
|
---|
13 |
|
---|
14 | it 'uid value should be ABCD::EFG::1' do
|
---|
15 | @version.uid.value.should == 'ABCD::EFG::2'
|
---|
16 | end
|
---|
17 |
|
---|
18 | it 'commit_audit.committer.should be UNKNOWN' do
|
---|
19 | @version.commit_audit.committer.should == 'UNKNOWN'
|
---|
20 | end
|
---|
21 |
|
---|
22 | it 'lifecycle_state should be 532' do
|
---|
23 | @version.lifecycle_state.defining_code.code_string.should == '532'
|
---|
24 | end
|
---|
25 |
|
---|
26 | it 'contribution namespece should be local' do
|
---|
27 | @version.contribution.namespace.should == 'local'
|
---|
28 | end
|
---|
29 |
|
---|
30 | it 'contribution type should be CONTRIBUTION' do
|
---|
31 | contribution = @version.contribution
|
---|
32 | contribution.type = 'PARTY'
|
---|
33 | lambda {
|
---|
34 | @version.contribution = contribution
|
---|
35 | }.should raise_error ArgumentError
|
---|
36 | end
|
---|
37 |
|
---|
38 | it 'signature should be 4760271533c2866579dde347ad28dd79e4aad933' do
|
---|
39 | @version.signature.should == '4760271533c2866579dde347ad28dd79e4aad933'
|
---|
40 | end
|
---|
41 |
|
---|
42 | it 'should not be a branch' do
|
---|
43 | @version.is_branch?.should_not be true
|
---|
44 | end
|
---|
45 |
|
---|
46 | it 'should be a branch' do
|
---|
47 | @version.uid.value = 'ABCD::EFG::1.2.3'
|
---|
48 | @version.is_branch?.should be true
|
---|
49 | end
|
---|
50 |
|
---|
51 | it 'data should be data' do
|
---|
52 | @version.data.should == 'data'
|
---|
53 | end
|
---|
54 |
|
---|
55 | it 'owner_id value should be ABCD::EFG::2' do
|
---|
56 | @version.owner_id.value.should == 'ABCD::EFG::2'
|
---|
57 | end
|
---|
58 |
|
---|
59 | it 'canonical form is not well determined' do
|
---|
60 | lambda {
|
---|
61 | @version.canonical_form
|
---|
62 | }.should raise_error NotImplementedError
|
---|
63 | end
|
---|
64 |
|
---|
65 | it 'should raise ArgumentError when preceding version id exists and uid version tree is first' do
|
---|
66 | @version.uid.value = 'ABC::DEF::1'
|
---|
67 | preceding_version_uid = ObjectVersionID.new(:value => 'GHI::JKL::2')
|
---|
68 | lambda {
|
---|
69 | @version.preceding_version_uid = preceding_version_uid
|
---|
70 | }.should raise_error ArgumentError
|
---|
71 | end
|
---|
72 | end
|
---|