sj26 / rspec_junit_formatter

RSpec results that your CI can read
http://rubygems.org/gems/rspec_junit_formatter
MIT License
302 stars 122 forks source link

Can I configure this formatter using RSpec.configure instead of CLI options? #66

Closed jayhendren closed 6 years ago

jayhendren commented 6 years ago

I'm running my RSpec tests via a tool (TestKitchen) that only supports RSpec configuration via a spec_helper.rb file where one can configure RSpec using RSpec.configure blocks. It supports neither custom CLI flags/arguments to rspec nor .rspec files. I would still like to get jUnit output with my TestKitchen tests. Is there any way to use Rspec.configure to configure RspecJunitFormatter? I'm thinking something along the lines of the following:

RSpec.configure do |c|
  c.formatter = 'RspecJunitFormatter'
  c.output = '/path/to/output.xml'
end
jayhendren commented 6 years ago

I got this figured out:

RSpec.configure do |c|
  c.add_formatter('RspecJunitFormatter', '/path/to/output.xml')
end