1 | require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
---|
2 | include OpenEHR::AM::Archetype::ConstraintModel
|
---|
3 | include OpenEHR::AssumedLibraryTypes
|
---|
4 |
|
---|
5 | describe Cardinality do
|
---|
6 | before(:each) do
|
---|
7 | interval = Interval.new(:upper => 1, :lower => 0)
|
---|
8 | @cardinality = Cardinality.new(:is_ordered => true,
|
---|
9 | :is_unique => true,
|
---|
10 | :interval => interval)
|
---|
11 | end
|
---|
12 |
|
---|
13 | it 'should be an instance of Cardinality' do
|
---|
14 | @cardinality.should be_an_instance_of Cardinality
|
---|
15 | end
|
---|
16 |
|
---|
17 | it 'is_ordered should be assigned properly' do
|
---|
18 | @cardinality.should be_ordered
|
---|
19 | end
|
---|
20 |
|
---|
21 | it 'is_ordered should be false' do
|
---|
22 | @cardinality.is_ordered = false
|
---|
23 | @cardinality.should_not be_ordered
|
---|
24 | end
|
---|
25 |
|
---|
26 | it 'is_unique should be assigned properly' do
|
---|
27 | @cardinality.should be_unique
|
---|
28 | end
|
---|
29 |
|
---|
30 | it 'is_unique should not be true' do
|
---|
31 | @cardinality.is_unique = false
|
---|
32 | @cardinality.should_not be_unique
|
---|
33 | end
|
---|
34 |
|
---|
35 | it 'interval should be assigned properly' do
|
---|
36 | @cardinality.interval.upper.should be_equal 1
|
---|
37 | end
|
---|
38 |
|
---|
39 | it 'is_set represent not ordered and unique' do
|
---|
40 | @cardinality.should_not be_set
|
---|
41 | end
|
---|
42 |
|
---|
43 | it 'is_set should be true' do
|
---|
44 | @cardinality.is_unique = true
|
---|
45 | @cardinality.is_ordered = false
|
---|
46 | @cardinality.should be_set
|
---|
47 | end
|
---|
48 |
|
---|
49 | it 'is_list represent ordered and not unique' do
|
---|
50 | @cardinality.is_ordered = true
|
---|
51 | @cardinality.is_unique = false
|
---|
52 | @cardinality.should be_list
|
---|
53 | end
|
---|
54 |
|
---|
55 | it 'is_list should not be true' do
|
---|
56 | @cardinality.should_not be_list
|
---|
57 | end
|
---|
58 |
|
---|
59 | it 'is_bag represent not ordered and not unique' do
|
---|
60 | @cardinality.is_ordered = false
|
---|
61 | @cardinality.is_unique = false
|
---|
62 | @cardinality.should be_bag
|
---|
63 | end
|
---|
64 |
|
---|
65 | it 'is_bag? should not be true' do
|
---|
66 | @cardinality.should_not be_bag
|
---|
67 | end
|
---|
68 | end
|
---|