source: ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/object_version_id_spec.rb@ 278

Last change on this file since 278 was 278, checked in by KOBAYASHI, Shinji, 15 years ago

object_version_id test/unit move to rspec

File size: 1.6 KB
Line 
1require File.dirname(__FILE__) + '/../../../../../spec_helper'
2include OpenEHR::RM::Support::Identification
3
4describe 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 'should not be branched' do
15 @object_version_id.is_branch?.should be_false
16 end
17
18 it 'should have valid object_id' do
19 @object_version_id.object_id.value.should ==
20 'F7C5C7B7-75DB-4b39-9A1E-C0BA9BFDBDEC'
21 end
22
23 it 'should have valid creating_system_id' do
24 @object_version_id.creating_system_id.value.should ==
25 '87284370-2D4B-4e3d-A3F3-F303D2F4F34B'
26 end
27
28 it 'should raise ArgumentError with invalid format' do
29 lambda {
30 @object_version_id.value = 'invalid:form'
31 }.should raise_error ArgumentError
32 end
33
34 it 'should raise ArgumentError with nil object id' do
35 lambda {
36 @object_version_id.object_id = nil
37 }.should raise_error ArgumentError
38 end
39
40 it 'should raise ArgumentError with nil creating system id' do
41 lambda {
42 @object_version_id.creating_system_id = nil
43 }.should raise_error ArgumentError
44 end
45
46 it 'should raise ArgumentError with nil version_tree_id' do
47 lambda {
48 @object_version_id.version_tree_id = nil
49 }.should raise_error ArgumentError
50 end
51
52 it 'should be branch if version_identifier represent branch' do
53 @object_version_id.version_tree_id.value = '2.3.4'
54 @object_version_id.is_branch?.should be_true
55 end
56end
Note: See TracBrowser for help on using the repository browser.