source: ruby/branches/0.5/spec/lib/open_ehr/rm/common/generic/attestation_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: 2.0 KB
Line 
1require File.dirname(__FILE__) + '/../../../../../spec_helper'
2include OpenEHR::RM::Common::Generic
3include OpenEHR::RM::Support::Identification
4include OpenEHR::RM::DataTypes::Text
5include OpenEHR::RM::DataTypes::Quantity::DateTime
6include OpenEHR::RM::DataTypes::Encapsulated
7
8describe Attestation do
9 before(:each) do
10 committer = stub(PartyProxy, :namespace => 'UNKNOWN')
11 change_type = stub(DvCodedText, :value =>'creation')
12 time = stub(DvDateTime, :value => '2009-10-03T16:24:19.0Z')
13 reason = DvText.new(:value => 'signed')
14 items = stub(Set, :empty? => false, :size => 3)
15 attested_view = stub(DvMultimedia, :size => 300)
16 @attestation = Attestation.new(:committer => committer,
17 :change_type => change_type,
18 :time_committed => time,
19 :system_id => 'test',
20 :reason => reason,
21 :proof => 'DEADBEEFBABE',
22 :is_pending => true,
23 :attested_view => attested_view,
24 :items => items)
25 end
26
27 it 'should be an instance of Attestation' do
28 @attestation.should be_an_instance_of Attestation
29 end
30
31 it 'reason should be signed' do
32 @attestation.reason.value.should == 'signed'
33 end
34
35 it 'proof should DEADBEEFBABE' do
36 @attestation.proof.should == 'DEADBEEFBABE'
37 end
38
39 it 'attested view size should be 300' do
40 @attestation.attested_view.size.should == 300
41 end
42
43 it 'is_pending? should true' do
44 @attestation.is_pending?.should be_true
45 end
46
47 it 'items size should be 30' do
48 @attestation.items.size.should == 3
49 end
50
51 it 'should raise ArgumentError when items are empty' do
52 lambda {
53 @attestation.items = Set.new
54 }.should raise_error ArgumentError
55 end
56
57 it 'should not raise ArgumentErro when items are nil' do
58 lambda {
59 @attestation.items = nil
60 }.should_not raise_error ArgumentError
61 end
62end
Note: See TracBrowser for help on using the repository browser.