1 | require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
---|
2 | include OpenEHR::AM::Archetype::Ontology
|
---|
3 |
|
---|
4 | describe ArchetypeOntology do
|
---|
5 | before(:each) do
|
---|
6 | terminologies_available = stub(Set, :size =>1)
|
---|
7 | term_codes = stub(Array, :size => 2)
|
---|
8 | constraint_codes = stub(Array, :size => 3)
|
---|
9 | term_attribute_names = stub(Array, :size => 4)
|
---|
10 | @archetype_ontology =
|
---|
11 | ArchetypeOntology.new(:terminologies_available => terminologies_available,
|
---|
12 | :specialisation_depth => 0,
|
---|
13 | :term_codes => term_codes,
|
---|
14 | :constraint_codes => constraint_codes,
|
---|
15 | :term_attribute_names => term_attribute_names)
|
---|
16 | end
|
---|
17 |
|
---|
18 | it 'should be an instance of ArchetypeOntology' do
|
---|
19 | @archetype_ontology.should be_an_instance_of ArchetypeOntology
|
---|
20 | end
|
---|
21 |
|
---|
22 | it 'terminologies_available should be assigned properly' do
|
---|
23 | @archetype_ontology.terminologies_available.size.should be_equal 1
|
---|
24 | end
|
---|
25 |
|
---|
26 | it 'should raise ArgumentError if terminologies_available is nil' do
|
---|
27 | lambda {
|
---|
28 | @archetype_ontology.terminologies_available = nil
|
---|
29 | }.should raise_error ArgumentError
|
---|
30 | end
|
---|
31 |
|
---|
32 | it 'term_codes should be assigned properly' do
|
---|
33 | @archetype_ontology.term_codes.size.should be_equal 2
|
---|
34 | end
|
---|
35 |
|
---|
36 | it 'specialisation depth should be assigned properly' do
|
---|
37 | @archetype_ontology.specialisation_depth.should be_equal 0
|
---|
38 | end
|
---|
39 |
|
---|
40 | it 'constraint_codes should be assigned properly' do
|
---|
41 | @archetype_ontology.constraint_codes.size.should be_equal 3
|
---|
42 | end
|
---|
43 |
|
---|
44 | it 'term_attribute_names should be assigned properly' do
|
---|
45 | @archetype_ontology.term_attribute_names.size.should be_equal 4
|
---|
46 | end
|
---|
47 | end
|
---|
48 |
|
---|