[406] | 1 | require File.dirname(__FILE__) + '/../../../spec_helper'
|
---|
| 2 | require File.dirname(__FILE__) + '/sample_archetype_spec'
|
---|
| 3 | include OpenEHR::Serializer
|
---|
| 4 | include OpenEHR::AM::Archetype
|
---|
| 5 | include OpenEHR::RM::Support::Identification
|
---|
| 6 |
|
---|
| 7 | describe ADLSerializer do
|
---|
| 8 | it_should_behave_like 'sample archetype'
|
---|
| 9 |
|
---|
[407] | 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
|
---|
[408] | 15 | @sample_description = adl[9..22].join
|
---|
[409] | 16 | @sample_definition = adl[24..25].join
|
---|
[411] | 17 | @sample_ontology = adl[27..37].join
|
---|
[414] | 18 | @sample_archetype = adl.join
|
---|
[407] | 19 | adl_file.close
|
---|
| 20 | end
|
---|
| 21 |
|
---|
[406] | 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
|
---|
[407] | 31 | @adl_serializer.header.should == @sample_header
|
---|
[406] | 32 | end
|
---|
[408] | 33 |
|
---|
| 34 | it 'description should return archetype description' do
|
---|
| 35 | @adl_serializer.description.should == @sample_description
|
---|
| 36 | end
|
---|
[409] | 37 |
|
---|
| 38 | it 'definition should return ADL formatted definition' do
|
---|
| 39 | @adl_serializer.definition.should == @sample_definition
|
---|
| 40 | end
|
---|
[411] | 41 |
|
---|
| 42 | it 'ontology should return ADL formatted ontology' do
|
---|
[412] | 43 | @adl_serializer.ontology.should == @sample_ontology
|
---|
[411] | 44 | end
|
---|
[414] | 45 |
|
---|
| 46 | it 'should return serialized ADL format' do
|
---|
| 47 | @adl_serializer.serialize.should == @sample_archetype
|
---|
| 48 | end
|
---|
[406] | 49 | end
|
---|