Class: InspecRspecMiniJson
- Inherits:
-
RSpec::Core::Formatters::JsonFormatter
- Object
- RSpec::Core::Formatters::JsonFormatter
- InspecRspecMiniJson
- Defined in:
- lib/inspec/rspec_json_formatter.rb
Overview
Minimal JSON formatter for inspec. Only contains limited information about examples without any extras.
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#dump_summary(summary) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/inspec/rspec_json_formatter.rb', line 27 def dump_summary(summary) @output_hash[:version] = Inspec::VERSION @output_hash[:summary] = { duration: summary.duration, example_count: summary.example_count, failure_count: summary.failure_count, skip_count: summary.pending_count, } end |
#stop(notification) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/inspec/rspec_json_formatter.rb', line 37 def stop(notification) @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 |