Sha256: 9ebc661f96779908638c04ba3314bc539ed59d7eb6f4d3dbcacde2dfdf7db3ec

Contents?: true

Size: 734 Bytes

Versions: 1

Compression:

Stored size: 734 Bytes

Contents

require 'builder'

module JunitModel
  # Convert Junit::TestGroup to XML
  class XMLBuilder
    def self.xml_for_result(result)
      builder = Builder::XmlMarkup.new indent: 2
      builder.instruct! :xml, version: '1.0', encoding: 'UTF-8'
      builder.testsuites(tests: result.test_count, failures: result.failures_count) do |suite_builder|
        result.test_suites.each do |suite|
          suite_builder.testsuite(name: suite.name, tests: suite.tests, failures: suite.failures) do |test_builder|
            suite.test_cases.each do |test_case|
              test_builder.testcase(classname: test_case.classname, name: test_case.name, time: test_case.time)
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
junit_model-0.1.0 lib/junit_model/xml.rb