adding a shell extension class of the rspec_junit_formatter gem formatter and including it in the formatters list with key 'junit'

Signed-off-by: jkerry <john@kerryhouse.net>
This commit is contained in:
jkerry 2016-11-20 00:18:34 -05:00
parent deff8c9e6e
commit e5038e1e5d
4 changed files with 15 additions and 0 deletions

View file

@ -15,6 +15,7 @@ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2')
end
gem 'ffi', '>= 1.9.14'
gem 'rspec_junit_formatter', '~> 0.2.3'
group :test do
gem 'bundler', '~> 1.5'

View file

@ -37,4 +37,5 @@ Gem::Specification.new do |spec|
spec.add_dependency 'mixlib-log'
spec.add_dependency 'sslshake', '~> 1'
spec.add_dependency 'parallel', '~> 1.9'
spec.add_dependency 'rspec_junit_formatter', '~> 0.2.3'
end

View file

@ -4,6 +4,7 @@
require 'rspec/core'
require 'rspec/core/formatters/json_formatter'
require 'rspec_junit_formatter'
# Vanilla RSpec JSON formatter with a slight extension to show example IDs.
# TODO: Remove these lines when RSpec includes the ID natively
@ -547,3 +548,14 @@ class InspecRspecCli < InspecRspecJson # rubocop:disable Metrics/ClassLength
data
end
end
class InspecRspecJUnit < RSpecJUnitFormatter
RSpec::Core::Formatters.register self, :close
def initialize(*args)
super(*args)
end
def close(_notification)
end
end

View file

@ -103,6 +103,7 @@ module Inspec
'json' => 'InspecRspecJson',
'json-rspec' => 'InspecRspecVanilla',
'cli' => 'InspecRspecCli',
'junit' => 'InspecRspecJUnit',
}.freeze
# Configure the output formatter and stream to be used with RSpec.