source: ruby/trunk/spec/lib/open_ehr/serializer/adl_serializer_spec.rb

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

ADL serializer

File size: 1.4 KB
Line 
1require File.dirname(__FILE__) + '/../../../spec_helper'
2require File.dirname(__FILE__) + '/sample_archetype_spec'
3include OpenEHR::Serializer
4include OpenEHR::AM::Archetype
5include OpenEHR::RM::Support::Identification
6
7describe ADLSerializer do
8 it_should_behave_like 'sample archetype'
9
10 before(:all) do
11 current_dir = File.dirname(__FILE__)
12 adl_file = File.open(current_dir + '/openEHR-EHR-SECTION.test.v1.adl')
13 adl = adl_file.readlines
14 @sample_header = adl[0..7].join
15 @sample_description = adl[9..22].join
16 @sample_definition = adl[24..25].join
17 @sample_ontology = adl[27..37].join
18 @sample_archetype = adl.join
19 adl_file.close
20 end
21
22 before(:each) do
23 @adl_serializer = ADLSerializer.new(@archetype)
24 end
25
26 it 'should be an instance of ADLSerializer' do
27 @adl_serializer.should be_an_instance_of ADLSerializer
28 end
29
30 it 'header should return archetype context' do
31 @adl_serializer.header.should == @sample_header
32 end
33
34 it 'description should return archetype description' do
35 @adl_serializer.description.should == @sample_description
36 end
37
38 it 'definition should return ADL formatted definition' do
39 @adl_serializer.definition.should == @sample_definition
40 end
41
42 it 'ontology should return ADL formatted ontology' do
43 @adl_serializer.ontology.should == @sample_ontology
44 end
45
46 it 'should return serialized ADL format' do
47 @adl_serializer.serialize.should == @sample_archetype
48 end
49end
Note: See TracBrowser for help on using the repository browser.