1 | require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
---|
2 | include OpenEHR::RM::Common::Generic
|
---|
3 | include OpenEHR::RM::Support::Identification
|
---|
4 | include OpenEHR::RM::DataTypes::Text
|
---|
5 | include OpenEHR::RM::DataTypes::Quantity::DateTime
|
---|
6 | include OpenEHR::RM::DataTypes::Encapsulated
|
---|
7 |
|
---|
8 | describe 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
|
---|
62 | end
|
---|