Class: GreenPepper::XmlWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/greenpepper/writer/xmlwriter.rb

Instance Method Summary collapse

Constructor Details

#initialize(document) ⇒ XmlWriter

Returns a new instance of XmlWriter.



8
9
10
11
# File 'lib/greenpepper/writer/xmlwriter.rb', line 8

def initialize(document)
  @document = document
  @modified_doc = ''
end

Instance Method Details

#outputObject



13
14
15
# File 'lib/greenpepper/writer/xmlwriter.rb', line 13

def output
  @modified_doc.to_s
end

#write_results(results) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/greenpepper/writer/xmlwriter.rb', line 17

def write_results(results)
  all_results = HtmlTableExecutionResults.get_all_results results
  @modified_doc = 
    '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' + 
    '<documents><document><statistics><success>' + 
    all_results.successes.to_s +
    '</success>'
  @modified_doc += '<failure>' + all_results.failures.to_s +
    '</failure><error>' + all_results.errors.to_s + '</error><ignored>' +
    all_results.ignored.to_s + '</ignored></statistics>'
  @modified_doc += '<results><![CDATA[' + @document +
    ']]></results></document></documents>'
end