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 |
|
---|
7 | describe AuditDetails do
|
---|
8 | before(:each) do
|
---|
9 | committer = stub(PartyProxy, :namespace => 'UNKNOWN')
|
---|
10 | change_type = stub(DvCodedText, :value =>'creation')
|
---|
11 | time = stub(DvDateTime, :value => '2009-10-03T16:24:19.0Z')
|
---|
12 | desc = DvText.new(:value => 'test environment')
|
---|
13 | @audit_details = AuditDetails.new(:system_id => 'MAGI',
|
---|
14 | :committer => committer,
|
---|
15 | :time_committed => time,
|
---|
16 | :change_type => change_type,
|
---|
17 | :description => desc)
|
---|
18 | end
|
---|
19 |
|
---|
20 | it 'should be an instance of AuditDetails' do
|
---|
21 | @audit_details.should be_an_instance_of AuditDetails
|
---|
22 | end
|
---|
23 |
|
---|
24 | it 'system_id should be MAGI' do
|
---|
25 | @audit_details.system_id.should == 'MAGI'
|
---|
26 | end
|
---|
27 |
|
---|
28 | it 'committer namespece should be UNKNOWN' do
|
---|
29 | @audit_details.committer.namespace.should == 'UNKNOWN'
|
---|
30 | end
|
---|
31 |
|
---|
32 | it 'change_type.value should be creation' do
|
---|
33 | @audit_details.change_type.value.should == 'creation'
|
---|
34 | end
|
---|
35 |
|
---|
36 | it 'description should be test environment' do
|
---|
37 | @audit_details.description.value.should == 'test environment'
|
---|
38 | end
|
---|
39 |
|
---|
40 | it 'should raise ArgumentError when system_id was assigned nil' do
|
---|
41 | lambda {
|
---|
42 | @audit_details.system_id = nil
|
---|
43 | }.should raise_error ArgumentError
|
---|
44 | end
|
---|
45 |
|
---|
46 | it 'should raise ArgumentError when time_commited is nil' do
|
---|
47 | lambda {
|
---|
48 | @audit_details.time_committed = nil
|
---|
49 | }.should raise_error ArgumentError
|
---|
50 | end
|
---|
51 | end
|
---|