Sha256: e3863b6c459d3ac38957e400f469e65fddc5f569ab47772d36a6cc6183a662ab

Contents?: true

Size: 1.37 KB

Versions: 23

Compression:

Stored size: 1.37 KB

Contents

require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/sample_archetype_spec'
require 'rexml/document'
include OpenEHR::Serializer

describe XMLSerializer do

  before(:all) do
    current_dir = File.dirname(__FILE__)
    xml_file = File.open(current_dir + '/openEHR-EHR-SECTION.test.v1.xml')
    xml = xml_file.readlines
    class << xml
      def unindent(s,e,num)
        self[s..e].collect{|line| line[num..-1]}.join
      end
    end
    @sample_header = xml.unindent(2, 11, 2)
    @sample_description = xml.unindent(12, 27, 2)
    @sample_definition = xml.unindent(28, 37, 2)
    @sample_ontology = xml.unindent(38, 56, 2)
    @sample_xml = xml.join
    xml_file.close
    @archetype = sample_archetype
  end

  before(:each) do
    @xml_serializer = XMLSerializer.new(@archetype)
  end

  it 'should be an instance of XMLSerializer' do
    @xml_serializer.should be_an_instance_of XMLSerializer
  end

  it 'should return XML formatted header' do
    @xml_serializer.header.should == @sample_header
  end

  it 'should return XML formatted description' do
    @xml_serializer.description.should == @sample_description
  end

  it 'should return XML formatted definition' do
    @xml_serializer.definition.should == @sample_definition
  end

  it 'should return XML formatted ontology' do
    @xml_serializer.ontology.should == @sample_ontology
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
openehr-1.2.5 spec/lib/openehr/serializer/xml_serializer_spec.rb
openehr-1.2.4 spec/lib/openehr/serializer/xml_serializer_spec.rb
openehr-1.2.3 spec/lib/openehr/serializer/xml_serializer_spec.rb
openehr-1.2.2 spec/lib/openehr/serializer/xml_serializer_spec.rb
openehr-1.2.1 spec/lib/openehr/serializer/xml_serializer_spec.rb
openehr-1.2.0 spec/lib/openehr/serializer/xml_serializer_spec.rb
openehr-1.1.6 spec/lib/openehr/serializer/xml_serializer_spec.rb
openehr-1.1.5 spec/lib/openehr/serializer/xml_serializer_spec.rb
openehr-1.1.4 spec/lib/openehr/serializer/xml_serializer_spec.rb
openehr-1.1.3 spec/lib/openehr/serializer/xml_serializer_spec.rb
openehr-1.1.2 spec/lib/openehr/serializer/xml_serializer_spec.rb
openehr-1.1.1 spec/lib/openehr/serializer/xml_serializer_spec.rb
openehr-1.1.0 spec/lib/openehr/serializer/xml_serializer_spec.rb
open_ehr-1.0.2 spec/lib/open_ehr/serializer/xml_serializer_spec.rb
open_ehr-1.0.1 spec/lib/open_ehr/serializer/xml_serializer_spec.rb
open_ehr-1.0.0 spec/lib/open_ehr/serializer/xml_serializer_spec.rb
open_ehr-0.9.5 spec/lib/open_ehr/serializer/xml_serializer_spec.rb
open_ehr-0.9.4 spec/lib/open_ehr/serializer/xml_serializer_spec.rb
open_ehr-0.9.3 spec/lib/open_ehr/serializer/xml_serializer_spec.rb
open_ehr-0.9.2 spec/lib/open_ehr/serializer/xml_serializer_spec.rb