Class: InspecRspecCli
- Inherits:
-
InspecRspecJson
- Object
- RSpec::Core::Formatters::JsonFormatter
- InspecRspecMiniJson
- InspecRspecJson
- InspecRspecCli
- Defined in:
- lib/inspec/rspec_json_formatter.rb
Overview
rubocop:disable Metrics/ClassLength
Constant Summary collapse
- STATUS_TYPES =
{ 'unknown' => -3, 'passed' => -2, 'skipped' => -1, 'minor' => 1, 'major' => 2, 'failed' => 2.5, 'critical' => 3, }.freeze
- COLORS =
{ 'critical' => "\033[38;5;9m", 'major' => "\033[38;5;208m", 'minor' => "\033[0;36m", 'failed' => "\033[38;5;9m", 'passed' => "\033[38;5;41m", 'skipped' => "\033[38;5;247m", 'reset' => "\033[0m", }.freeze
- INDICATORS =
{ 'critical' => ' × ', 'major' => ' ∅ ', 'minor' => ' ⊚ ', 'failed' => ' × ', 'skipped' => ' ↺ ', 'passed' => ' ✔ ', 'unknown' => ' ? ', 'empty' => ' ', 'small' => ' ', }.freeze
- MULTI_TEST_CONTROL_SUMMARY_MAX_LEN =
60
Instance Attribute Summary
Attributes inherited from InspecRspecJson
Instance Method Summary collapse
-
#close(_notification) ⇒ Object
rubocop:disable Metrics/AbcSize.
-
#initialize(*args) ⇒ InspecRspecCli
constructor
A new instance of InspecRspecCli.
Methods inherited from InspecRspecJson
#add_profile, #controls_summary, #dump_one_example, #start, #stop, #tests_summary
Methods inherited from InspecRspecMiniJson
Constructor Details
#initialize(*args) ⇒ InspecRspecCli
Returns a new instance of InspecRspecCli.
282 283 284 285 286 287 288 |
# File 'lib/inspec/rspec_json_formatter.rb', line 282 def initialize(*args) @current_control = nil @anonymous_tests = [] @control_tests = [] @profile_printed = false super(*args) end |
Instance Method Details
#close(_notification) ⇒ Object
rubocop:disable Metrics/AbcSize
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/inspec/rspec_json_formatter.rb', line 290 def close(_notification) # rubocop:disable Metrics/AbcSize flush_current_control(@current_control) output.puts('') unless @current_control.nil? print_tests(@anonymous_tests) output.puts('') print_profiles_info(@current_control) if !@profile_printed controls_res = controls_summary tests_res = tests_summary s = format('Profile Summary: %s%d successful%s, %s%d failures%s, %s%d skipped%s', COLORS['passed'], controls_res['passed'], COLORS['reset'], COLORS['failed'], controls_res['failed']['total'], COLORS['reset'], COLORS['skipped'], controls_res['skipped'], COLORS['reset']) output.puts(s) if controls_res['total'] > 0 s = format('Test Summary: %s%d successful%s, %s%d failures%s, %s%d skipped%s', COLORS['passed'], tests_res['passed'], COLORS['reset'], COLORS['failed'], tests_res['failed'], COLORS['reset'], COLORS['skipped'], tests_res['skipped'], COLORS['reset']) output.puts(s) if !@anonymous_tests.empty? || @current_control.nil? end |