1 | require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
---|
2 | include OpenEHR::RM::Support::Identification
|
---|
3 |
|
---|
4 | describe ObjectVersionID do
|
---|
5 | before(:each) do
|
---|
6 | @object_version_id = ObjectVersionID.new(:value => 'F7C5C7B7-75DB-4b39-9A1E-C0BA9BFDBDEC::87284370-2D4B-4e3d-A3F3-F303D2F4F34B::2')
|
---|
7 |
|
---|
8 | end
|
---|
9 |
|
---|
10 | it 'should be an instance of ObjectVersionID' do
|
---|
11 | @object_version_id.should be_an_instance_of ObjectVersionID
|
---|
12 | end
|
---|
13 |
|
---|
14 | it 'value should be F7C5C7B7-75DB-4b39-9A1E-C0BA9BFDBDEC::87284370-2D4B-4e3d-A3F3-F303D2F4F34B::2' do
|
---|
15 | @object_version_id.value.should == 'F7C5C7B7-75DB-4b39-9A1E-C0BA9BFDBDEC::87284370-2D4B-4e3d-A3F3-F303D2F4F34B::2'
|
---|
16 | end
|
---|
17 |
|
---|
18 | it 'should not be branched' do
|
---|
19 | @object_version_id.is_branch?.should be_false
|
---|
20 | end
|
---|
21 |
|
---|
22 | it 'should have valid object_id' do
|
---|
23 | @object_version_id.object_id.value.should ==
|
---|
24 | 'F7C5C7B7-75DB-4b39-9A1E-C0BA9BFDBDEC'
|
---|
25 | end
|
---|
26 |
|
---|
27 | it 'should have valid creating_system_id' do
|
---|
28 | @object_version_id.creating_system_id.value.should ==
|
---|
29 | '87284370-2D4B-4e3d-A3F3-F303D2F4F34B'
|
---|
30 | end
|
---|
31 |
|
---|
32 | it 'should raise ArgumentError with invalid format' do
|
---|
33 | lambda {
|
---|
34 | @object_version_id.value = 'invalid:form'
|
---|
35 | }.should raise_error ArgumentError
|
---|
36 | end
|
---|
37 |
|
---|
38 | it 'should raise ArgumentError with nil object id' do
|
---|
39 | lambda {
|
---|
40 | @object_version_id.object_id = nil
|
---|
41 | }.should raise_error ArgumentError
|
---|
42 | end
|
---|
43 |
|
---|
44 | it 'should raise ArgumentError with nil creating system id' do
|
---|
45 | lambda {
|
---|
46 | @object_version_id.creating_system_id = nil
|
---|
47 | }.should raise_error ArgumentError
|
---|
48 | end
|
---|
49 |
|
---|
50 | it 'should raise ArgumentError with nil version_tree_id' do
|
---|
51 | lambda {
|
---|
52 | @object_version_id.version_tree_id = nil
|
---|
53 | }.should raise_error ArgumentError
|
---|
54 | end
|
---|
55 |
|
---|
56 | it 'should be branch if version_identifier represent branch' do
|
---|
57 | @object_version_id.version_tree_id.value = '2.3.4'
|
---|
58 | @object_version_id.is_branch?.should be_true
|
---|
59 | end
|
---|
60 | end
|
---|