class Inspec::Formatters::RspecJson

Private Instance Methods

format_example(example) click to toggle source

We are cheating and overriding a private method in RSpec's core JsonFormatter. This is to avoid having to repeat this id functionality in both dump_summary and dump_profile (both of which call format_example). See github.com/rspec/rspec-core/blob/master/lib/rspec/core/formatters/json_formatter.rb

rspec's example id here corresponds to an inspec test's control name - either explicitly specified or auto-generated by rspec itself.

Calls superclass method
# File lib/inspec/formatters/json_rspec.rb, line 14
def format_example(example)
  res = super(example)
  res[:id] = example.metadata[:id]
  res
end