[381] | 1 | require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
---|
| 2 | include OpenEHR::AM::Archetype::ConstraintModel
|
---|
| 3 | include OpenEHR::AssumedLibraryTypes
|
---|
| 4 |
|
---|
| 5 | describe CComplexObject do
|
---|
| 6 | before(:each) do
|
---|
| 7 | occurrences = Interval.new(:lower => 0, :upper => 1)
|
---|
| 8 | parent = stub(CAttribute, :rm_attribute_name => 'DV_DATE')
|
---|
| 9 | attributes = stub(Set, :empty? => false, :size => 3)
|
---|
| 10 | @c_complex_object = CComplexObject.new(:path => '/event/[at0001]/',
|
---|
| 11 | :rm_type_name => 'DV_TIME',
|
---|
| 12 | :node_id => 'ac0001',
|
---|
| 13 | :occurrences => occurrences,
|
---|
| 14 | :attributes => attributes)
|
---|
| 15 | end
|
---|
| 16 |
|
---|
| 17 | it 'should be an instance of CComplexObject' do
|
---|
| 18 | @c_complex_object.should be_an_instance_of CComplexObject
|
---|
| 19 | end
|
---|
| 20 |
|
---|
| 21 | it 'attributes should be assigned properly' do
|
---|
| 22 | @c_complex_object.attributes.size.should be_equal 3
|
---|
| 23 | end
|
---|
| 24 |
|
---|
| 25 | it 'any_allowed should be false when attributes are not empty' do
|
---|
| 26 | @c_complex_object.should_not be_any_allowed
|
---|
| 27 | end
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | it 'any_allowed should be true when attributes are nil' do
|
---|
| 31 | @c_complex_object.attributes = nil
|
---|
| 32 | @c_complex_object.should be_any_allowed
|
---|
| 33 | end
|
---|
| 34 |
|
---|
| 35 | it 'any_allowed should be true when attributes are empty' do
|
---|
| 36 | @c_complex_object.attributes = Set.new
|
---|
| 37 | @c_complex_object.should be_any_allowed
|
---|
| 38 | end
|
---|
| 39 | end
|
---|