Method: InspecRspecMiniJson#stop
- Defined in:
- lib/inspec/rspec_json_formatter.rb
#stop(notification) ⇒ Object
Called at the end of a complete RSpec run.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/inspec/rspec_json_formatter.rb', line 48 def stop(notification) # This might be a bit confusing. The results are not actually organized # by control. It is organized by test. So if a control has 3 tests, the # output will have 3 control entries, each one with the same control id # and different test results. An rspec example maps to an inspec test. @output_hash[:controls] = notification.examples.map do |example| format_example(example).tap do |hash| e = example.exception next unless e hash[:message] = e. next if e.is_a? RSpec::Expectations::ExpectationNotMetError hash[:exception] = e.class.name hash[:backtrace] = e.backtrace end end end |