source: ruby/branches/0.5/spec/lib/open_ehr/rm/common/generic/revision_history_spec.rb@ 334

Last change on this file since 334 was 334, checked in by KOBAYASHI, Shinji, 14 years ago

Versioning system is complexed

File size: 1.5 KB
Line 
1require File.dirname(__FILE__) + '/../../../../../spec_helper'
2include OpenEHR::RM::Common::Generic
3include OpenEHR::RM::Support::Identification
4include OpenEHR::RM::DataTypes::Quantity::DateTime
5
6describe RevisionHistory do
7 before(:each) do
8 version_id = stub(ObjectVersionID, :value => 'ABCD::EFGH::1')
9 committed_time = stub(DvDateTime, :value => '2009-11-02T22:19:34')
10 audit = stub(AuditDetails, :time_committed => committed_time)
11 audits = stub(Array, :first => audit)
12 last_item = stub(RevisionHistoryItem, :version_id => version_id,
13 :audits => audits)
14 items = stub(Array, :size => 128, :empty? => false, :last => last_item)
15 @revision_history = RevisionHistory.new(:items => items)
16 end
17
18 it 'should be an instance of RevisionHistory' do
19 @revision_history.should be_an_instance_of RevisionHistory
20 end
21
22 it 'items size should return size 128' do
23 @revision_history.items.size.should be_equal 128
24 end
25
26 it 'should return the most recent version string' do
27 @revision_history.most_recent_version.should == 'ABCD::EFGH::1'
28 end
29
30 it 'should return the most recent commited version time string' do
31 @revision_history.most_recent_version_time_committed == '2009-11-02T22:19:34'
32 end
33
34 it 'should raise ArgumentError when item is nil' do
35 lambda {
36 @revision_history.items = nil
37 }.should raise_error ArgumentError
38 end
39
40 it 'should raise ArgumentError when item is empty' do
41 lambda {
42 @revision_history.items = Array.new
43 }.should raise_error ArgumentError
44 end
45end
Note: See TracBrowser for help on using the repository browser.