Changeset 380
- Timestamp:
- Dec 20, 2009, 8:20:02 PM (14 years ago)
- Location:
- ruby/trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/trunk/lib/open_ehr/am/archetype/constraint_model.rb
r379 r380 150 150 151 151 class CDefinedObject < CObject 152 attr_accessor :assumed_value , :any_allowed152 attr_accessor :assumed_value 153 153 154 154 def initialize(args = { }) … … 168 168 raise NotImplementedError, 'subclass should implement this method' 169 169 end 170 171 def any_allowed? 172 raise NotImplementedError, 'subclass should implement this method' 173 end 170 174 end 171 175 … … 174 178 175 179 def initialize(args = { }) 176 @attributes = args[:item] if args[:item] 177 super 180 super 181 self.item = args[:item] 182 end 183 184 def any_allowed? 185 return !item.nil? 178 186 end 179 187 end -
ruby/trunk/spec/lib/open_ehr/am/archetype/constraint_model/c_defined_object_spec.rb
r379 r380 42 42 }.should raise_error NotImplementedError 43 43 end 44 45 it 'any_allowed should raise NotImplementedError' do 46 lambda { 47 @c_defined_object.any_allowed? 48 }.should raise_error NotImplementedError 49 end 44 50 end 45 51 -
ruby/trunk/spec/lib/open_ehr/am/archetype/constraint_model/c_primitive_object_spec.rb
r375 r380 1 1 require File.dirname(__FILE__) + '/../../../../../spec_helper' 2 2 include OpenEHR::AM::Archetype::ConstraintModel 3 include OpenEHR::AM::Archetype::Primitive 3 4 include OpenEHR::AssumedLibraryTypes 4 5 … … 6 7 before(:each) do 7 8 interval = Interval.new(:lower => 0, :upper => 1) 9 item = stub(CPrimitive, :node_id => 'at0001') 8 10 @c_primitive_object = CPrimitiveObject.new(:path => 'event/test', 9 11 :rm_type_name => 'DV_TEXT', 10 12 :node_id => 'ac0001', 11 :occurrences => interval) 13 :occurrences => interval, 14 :item => item) 12 15 end 13 16 … … 15 18 @c_primitive_object.should be_an_instance_of CPrimitiveObject 16 19 end 20 21 it 'item should be assigned properly' do 22 @c_primitive_object.item.node_id.should == 'at0001' 23 end 24 25 it 'should allowed any' do 26 @c_primitive_object.should be_any_allowed 27 end 28 29 it 'should not any allowed' do 30 @c_primitive_object.item = nil 31 @c_primitive_object.should_not be_any_allowed 32 end 17 33 end
Note:
See TracChangeset
for help on using the changeset viewer.