Class: InspecRspecJUnit
- Inherits:
-
InspecRspecJson
- Object
- RSpec::Core::Formatters::JsonFormatter
- InspecRspecMiniJson
- InspecRspecJson
- InspecRspecJUnit
- Defined in:
- lib/inspec/rspec_json_formatter.rb
Instance Attribute Summary
Attributes inherited from InspecRspecJson
Instance Method Summary collapse
-
#close(_notification) ⇒ Object
This is the last method is invoked through the formatter interface.
Methods inherited from InspecRspecJson
#add_profile, #initialize, #stop
Methods inherited from InspecRspecMiniJson
Constructor Details
This class inherits a constructor from InspecRspecJson
Instance Method Details
#close(_notification) ⇒ Object
This is the last method is invoked through the formatter interface. Converts the junit formatter constructed output_hash into nokogiri generated XML and writes it to output.
801 802 803 804 805 806 807 808 809 810 811 |
# File 'lib/inspec/rspec_json_formatter.rb', line 801 def close(_notification) require 'nokogiri' xml_output = Nokogiri::XML::Builder.new { |xml| xml.testsuites do @output_hash[:profiles].each do |profile| build_profile_xml(xml, profile) end end }.to_xml output.puts xml_output end |