Sha256: 0b9d3f456a4d911b45f6f0f037e1ee4f89f4c8868d44147e2d7cc131361b1f79
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
# Dumps rspec results as a JUnit XML file. # Based on XML schema: http://windyroad.org/dl/Open%20Source/JUnit.xsd class RSpec::Core::Formatters::JUnitFormatter < RSpec::Core::Formatters::BaseFormatter def xml @xml ||= Builder::XmlMarkup.new :target => output, :indent => 2 end def start example_count @start = Time.now super end def dump_summary duration, example_count, failure_count, pending_count super xml.instruct! xml.testsuite :tests => example_count, :failures => failure_count, :errors => 0, :time => '%.6f' % duration, :timestamp => @start.iso8601 do xml.properties examples.each do |example| send :"dump_summary_example_#{example.execution_result[:status]}", example end end end def xml_example example, &block xml.testcase :classname => example.file_path, :name => example.full_description, :time => '%.6f' % example.execution_result[:run_time], &block end def dump_summary_example_passed example xml_example example end def dump_summary_example_pending example xml_example example do xml.skipped end end def dump_summary_example_failed example exception = example.execution_result[:exception] backtrace = format_backtrace exception.backtrace, example xml_example example do xml.failure :message => exception.to_s, :type => exception.class.name do xml.cdata! "#{exception.message}\n#{backtrace.join "\n"}" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rspec_junit_formatter-0.1.1 | lib/rspec/core/formatters/j_unit_formatter.rb |
rspec_junit_formatter-0.1.0 | lib/rspec/core/formatters/j_unit_formatter.rb |