Method: Beaker::LoggerJunit.write_xml

Defined in:
lib/beaker/logger_junit.rb

.write_xml(xml_file, stylesheet, &block) ⇒ Object

writes the xml created in the block to the xml file given

Note: Error Recovery should take place in the caller of this method in order to recover gracefully

Parameters:

  • xml_file (String)

    Path to the xml file

  • stylesheet (String)

    Path to the stylesheet file

  • block (Proc)

    XML message construction block

Returns:

  • nil



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/beaker/logger_junit.rb', line 20

def self.write_xml(xml_file, stylesheet, &block)
  doc, suites = self.get_xml_contents(xml_file, name, stylesheet)

  if block_given?
    case block.arity
    when 2
      yield doc, suites
    else
      raise ArgumentError.new "write_xml block takes 2 arguments, not #{block.arity}"
    end
  end

  self.finish(doc, xml_file)
end