1 | require File.dirname(__FILE__) + '/../../../../../../spec_helper'
|
---|
2 | require File.dirname(__FILE__) + '/shared_examples_spec'
|
---|
3 | include OpenEHR::RM::DataStructures::ItemStructure
|
---|
4 | include OpenEHR::RM::Composition::Content::Entry
|
---|
5 | include OpenEHR::RM::DataTypes::Encapsulated
|
---|
6 |
|
---|
7 | describe Activity do
|
---|
8 | it_should_behave_like 'entry'
|
---|
9 |
|
---|
10 | before(:each) do
|
---|
11 | description = stub(ItemStructure, :archetype_node_id => 'at0002')
|
---|
12 | timing = stub(DvParsable, :value => '2009-11-18T19:35:11')
|
---|
13 | @activity = Activity.new(:archetype_node_id => 'at0001',
|
---|
14 | :name => @name,
|
---|
15 | :description => description,
|
---|
16 | :timing => timing,
|
---|
17 | :action_archetype_id => '/at.+/')
|
---|
18 | end
|
---|
19 |
|
---|
20 | it 'should be an instance of Activity' do
|
---|
21 | @activity.should be_an_instance_of Activity
|
---|
22 | end
|
---|
23 |
|
---|
24 | it 'description should be assigned properly' do
|
---|
25 | @activity.description.archetype_node_id.should == 'at0002'
|
---|
26 | end
|
---|
27 |
|
---|
28 | it 'should raise ArgumentError with nil description' do
|
---|
29 | lambda {
|
---|
30 | @activity.description = nil
|
---|
31 | }.should raise_error ArgumentError
|
---|
32 | end
|
---|
33 |
|
---|
34 | it 'timing should be assigned properly' do
|
---|
35 | @activity.timing.value.should == '2009-11-18T19:35:11'
|
---|
36 | end
|
---|
37 |
|
---|
38 | it 'should raise ArgumentError with nil timing' do
|
---|
39 | lambda {
|
---|
40 | @activity.timing = nil
|
---|
41 | }.should raise_error ArgumentError
|
---|
42 | end
|
---|
43 |
|
---|
44 | it 'action_archetype_id should be assigned properly' do
|
---|
45 | @activity.action_archetype_id.should == '/at.+/'
|
---|
46 | end
|
---|
47 |
|
---|
48 | it 'should raise ArgumentError with nil action_archetype_id' do
|
---|
49 | lambda {
|
---|
50 | @activity.action_archetype_id = nil
|
---|
51 | }.should raise_error ArgumentError
|
---|
52 | end
|
---|
53 |
|
---|
54 | it 'should raise ArgumentError with empty action_archetype_id' do
|
---|
55 | lambda {
|
---|
56 | @activity.action_archetype_id = ''
|
---|
57 | }.should raise_error ArgumentError
|
---|
58 | end
|
---|
59 | end
|
---|