Last change
on this file since 410 was 410, checked in by KOBAYASHI, Shinji, 14 years ago |
Simple definition implemented
|
File size:
1.3 KB
|
Line | |
---|
1 | require File.dirname(__FILE__) + '/../../../spec_helper'
|
---|
2 | require File.dirname(__FILE__) + '/sample_archetype_spec'
|
---|
3 | require 'rexml/document'
|
---|
4 | include OpenEHR::Serializer
|
---|
5 |
|
---|
6 | describe XMLSerializer do
|
---|
7 | it_should_behave_like 'sample archetype'
|
---|
8 |
|
---|
9 | before(:all) do
|
---|
10 | current_dir = File.dirname(__FILE__)
|
---|
11 | xml_file = File.open(current_dir + '/openEHR-EHR-SECTION.test.v1.xml')
|
---|
12 | xml = xml_file.readlines
|
---|
13 | class << xml
|
---|
14 | def unindent(s,e,num)
|
---|
15 | self[s..e].collect{|line| line[num..-1]}.join
|
---|
16 | end
|
---|
17 | end
|
---|
18 | @sample_header = xml.unindent(2, 11, 2)
|
---|
19 | @sample_description = xml.unindent(12, 27, 2)
|
---|
20 | @sample_definition = xml.unindent(28, 37, 2)
|
---|
21 | xml_file.close
|
---|
22 | end
|
---|
23 |
|
---|
24 | before(:each) do
|
---|
25 | @xml_serializer = XMLSerializer.new(@archetype)
|
---|
26 | end
|
---|
27 |
|
---|
28 | it 'should be an instance of XMLSerializer' do
|
---|
29 | @xml_serializer.should be_an_instance_of XMLSerializer
|
---|
30 | end
|
---|
31 |
|
---|
32 | it 'should return XML formatted header' do
|
---|
33 | @xml_serializer.header.should == @sample_header
|
---|
34 | end
|
---|
35 |
|
---|
36 | it 'should return XML formatted description' do
|
---|
37 | @xml_serializer.description.should == @sample_description
|
---|
38 | end
|
---|
39 |
|
---|
40 | it 'should return XML formatted definition' do
|
---|
41 | @xml_serializer.definition.should == @sample_definition
|
---|
42 | end
|
---|
43 |
|
---|
44 | def unindent(lines,n)
|
---|
45 | return lines.collect{|line| line[n..-1]}.join
|
---|
46 | end
|
---|
47 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.