source: ruby/trunk/spec/lib/open_ehr/am/archetype/constraint_model/c_object_spec.rb@ 375

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

refs #74

File size: 1.8 KB
Line 
1require File.dirname(__FILE__) + '/../../../../../spec_helper'
2include OpenEHR::AM::Archetype::ConstraintModel
3include OpenEHR::AssumedLibraryTypes
4
5describe CObject do
6 before(:each) do
7 occurrences = Interval.new(:lower => 0, :upper => 1)
8 parent = stub(CAttribute, :rm_attribute_name => 'DV_DATE')
9 @c_object = CObject.new(:path => '/event/[at0001]/',
10 :rm_type_name => 'DV_TIME',
11 :node_id => 'ac0001',
12 :occurrences => occurrences,
13 :parent => parent)
14 end
15
16 it 'should be an instance of CObject' do
17 @c_object.should be_an_instance_of CObject
18 end
19
20 it 'rm_type_name should be assigned properly' do
21 @c_object.rm_type_name.should == 'DV_TIME'
22 end
23
24 it 'should raise ArgumentError when rm_type_name was assigned nil' do
25 lambda {
26 @c_object.rm_type_name = nil
27 }.should raise_error ArgumentError
28 end
29
30 it 'should raise ArgumentError when rm_type_name was assigned empty' do
31 lambda {
32 @c_object.rm_type_name = ''
33 }.should raise_error ArgumentError
34 end
35
36 it 'node_id should be assigned properly' do
37 @c_object.node_id.should == 'ac0001'
38 end
39
40 it 'should raise ArgumentError when node_id was assigned nil' do
41 lambda {
42 @c_object.node_id = nil
43 }.should raise_error ArgumentError
44 end
45
46 it 'should raise ArgumentError when node_id was assigned empty' do
47 lambda {
48 @c_object.node_id = ''
49 }.should raise_error ArgumentError
50 end
51
52 it 'occurences should be assigned properly' do
53 @c_object.occurrences.lower.should be_equal 0
54 end
55
56 it 'should raise ArgumentError when occurences was assigned nil' do
57 lambda {
58 @c_object.occurrences = nil
59 }.should raise_error ArgumentError
60 end
61end
Note: See TracBrowser for help on using the repository browser.