Index: ruby/trunk/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb
===================================================================
--- ruby/trunk/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb	(revision 410)
+++ ruby/trunk/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb	(revision 411)
@@ -1,17 +1,24 @@
 require File.dirname(__FILE__) + '/../../../../../spec_helper'
 include OpenEHR::AM::Archetype::Ontology
+include OpenEHR::RM::DataTypes::Text
 
 describe ArchetypeOntology do
   before(:each) do
-    terminologies_available = stub(Set, :size =>1)
-    term_codes = stub(Array, :size => 2)
-    constraint_codes = stub(Array, :size => 3)
-    term_attribute_names = stub(Array, :size => 4)
+    items = {'TEXT' => 'text', 'DESC' => 'description'}
+    term1 = ArchetypeTerm.new(:code => 'at0000', :items => items)
+    items = {'TEXT' => 'concept'}
+    term2 = ArchetypeTerm.new(:code => 'at0001', :items => items)
+    term_definitions = {'ja' => [term1, term2]}
+    items = {'text' => 'test', 'description' => 'test item'}
+    term3 = ArchetypeTerm.new(:code => 'ac0000', :items => items)
+    constraint_definitions = {'ja' => [term3]}
+    code_phrase = stub(CodePhrase, :code_string => '163020007')
+    bind = {'at0000' => code_phrase}
+    term_bindings = {'SNOMED-CT(2003)' => [bind]}
     @archetype_ontology =
-      ArchetypeOntology.new(:terminologies_available => terminologies_available,
-                            :specialisation_depth => 0,
-                            :term_codes => term_codes,
-                            :constraint_codes => constraint_codes,
-                            :term_attribute_names => term_attribute_names)
+      ArchetypeOntology.new(:term_definitions => term_definitions,
+                            :constraint_definitions => constraint_definitions,
+                            :term_bindings => term_bindings,
+                            :specialisation_depth => 0)
   end
 
@@ -20,28 +27,28 @@
   end
 
-  it 'terminologies_available should be assigned properly' do
-    @archetype_ontology.terminologies_available.size.should be_equal 1
-  end
-
-  it 'should raise ArgumentError if terminologies_available is nil' do
-    lambda {
-      @archetype_ontology.terminologies_available = nil
-    }.should raise_error ArgumentError
-  end
-
-  it 'term_codes should be assigned properly' do
-    @archetype_ontology.term_codes.size.should be_equal 2
-  end
-
   it 'specialisation depth should be assigned properly' do
     @archetype_ontology.specialisation_depth.should be_equal 0
   end
 
-  it 'constraint_codes should be assigned properly' do
-    @archetype_ontology.constraint_codes.size.should be_equal 3
+  it 'term_definitions should be assigned properly' do
+    @archetype_ontology.term_definitions['ja'][0].code.should == 'at0000'
   end
 
-  it 'term_attribute_names should be assigned properly' do
-    @archetype_ontology.term_attribute_names.size.should be_equal 4
+  it 'term_codes should returnd all at codes' do
+    @archetype_ontology.term_codes.should == ['at0000','at0001']
+  end
+
+  it 'constraint_definitions should be assigned properly' do
+    @archetype_ontology.constraint_definitions['ja'][0].items['text'].
+      should == 'test'
+  end
+
+  it 'constrant_codes should return all ac codes' do
+    @archetype_ontology.constraint_codes.should == ['ac0000']
+  end
+
+  it 'term_bindings should be assigned properly' do
+    @archetype_ontology.term_bindings['SNOMED-CT(2003)'][0]['at0000'].
+      code_string.should == '163020007'
   end
 end
Index: ruby/trunk/spec/lib/open_ehr/am/archetype/ontology/archetype_term_spec.rb
===================================================================
--- ruby/trunk/spec/lib/open_ehr/am/archetype/ontology/archetype_term_spec.rb	(revision 410)
+++ ruby/trunk/spec/lib/open_ehr/am/archetype/ontology/archetype_term_spec.rb	(revision 411)
@@ -4,5 +4,5 @@
 describe ArchetypeTerm do
   before(:each) do
-    items = Hash['TEXT', 'text']
+    items = {'TEXT' => 'text', 'DESC' => 'description'}
     @archetype_term = ArchetypeTerm.new(:code => 'at0001',
                                         :items => items)
@@ -34,5 +34,5 @@
 
   it 'keys should be a set of keys of item' do
-    @archetype_term.keys.should == Set.new('TEXT')
+    @archetype_term.keys.should == Set['TEXT', 'DESC']
   end
 
Index: ruby/trunk/spec/lib/open_ehr/serializer/adl_serializer_spec.rb
===================================================================
--- ruby/trunk/spec/lib/open_ehr/serializer/adl_serializer_spec.rb	(revision 410)
+++ ruby/trunk/spec/lib/open_ehr/serializer/adl_serializer_spec.rb	(revision 411)
@@ -15,4 +15,5 @@
     @sample_description = adl[9..22].join
     @sample_definition = adl[24..25].join
+    @sample_ontology = adl[27..37].join
     adl_file.close
   end
@@ -37,3 +38,7 @@
     @adl_serializer.definition.should == @sample_definition
   end
+
+  it 'ontology should return ADL formatted ontology' do
+    @adl_serializer.ontology.should == @sample_definition
+  end
 end
