source: ruby/trunk/spec/lib/open_ehr/am/archetype/constraint_model/c_complex_object_spec.rb@ 381

Last change on this file since 381 was 381, checked in by KOBAYASHI, Shinji, 14 years ago

refs #74

File size: 1.4 KB
Line 
1require File.dirname(__FILE__) + '/../../../../../spec_helper'
2include OpenEHR::AM::Archetype::ConstraintModel
3include OpenEHR::AssumedLibraryTypes
4
5describe 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
39end
Note: See TracBrowser for help on using the repository browser.