Method: InspecRspecCli::Control#summary

Defined in:
lib/inspec/rspec_json_formatter.rb

#summaryObject

Return summary of the control which is usually a title with fails and skips



670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
# File 'lib/inspec/rspec_json_formatter.rb', line 670

def summary
  calculate_summary! if summary_calculation_needed?
  suffix =
    if examples.length == 1
      # Single test - be nice and just print the exception message if the test
      # failed. No need to say "1 failed".
      examples[0][:message].to_s
    else
      [
        !fails.empty? ? "#{fails.uniq.length} failed" : nil,
        !skips.empty? ? "#{skips.uniq.length} skipped" : nil,
      ].compact.join(' ')
    end

  suffix == '' ? title : title + ' (' + suffix + ')'
end