Changeset 410 for ruby/trunk/spec/lib/open_ehr
- Timestamp:
- Apr 15, 2010, 8:58:25 PM (14 years ago)
- Location:
- ruby/trunk/spec/lib/open_ehr/serializer
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/trunk/spec/lib/open_ehr/serializer/xml_serializer_spec.rb
r409 r410 6 6 describe XMLSerializer do 7 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 8 23 9 24 before(:each) do … … 16 31 17 32 it 'should return XML formatted header' do 18 @xml_serializer.header.should == <<END 19 <archetype_id> 20 <value>openEHR-EHR-SECTION.test.v1</value> 21 </archetype_id> 22 <concept>at0000</concept> 23 <original_language> 24 <terminology_id> 25 <value>ISO_639-1</value> 26 </terminology_id> 27 <code_string>ja</code_string> 28 </original_language> 29 END 33 @xml_serializer.header.should == @sample_header 30 34 end 31 35 32 36 it 'should return XML formatted description' do 33 @xml_serializer.description.should == <<END 34 <description> 35 <original_author id="name">Shinji KOBAYASHI</original_author> 36 <original_author id="organisation">openEHR.jp</original_author> 37 <original_author id="email">skoba@moss.gr.jp</original_author> 38 <lifecycle_state>draft</lifecycle_state> 39 <details> 40 <language> 41 <terminology_id> 42 <value>ISO_639-1</value> 43 </terminology_id> 44 <code_string>ja</code_string> 45 </language> 46 <purpose>Serializer test</purpose> 47 <misuse>evaluate message</misuse> 48 </details> 49 </description> 50 END 37 @xml_serializer.description.should == @sample_description 51 38 end 52 39 53 it 'should return XML formatted definition' 40 it 'should return XML formatted definition' do 41 @xml_serializer.definition.should == @sample_definition 42 end 54 43 44 def unindent(lines,n) 45 return lines.collect{|line| line[n..-1]}.join 46 end 55 47 end
Note:
See TracChangeset
for help on using the changeset viewer.