Class: InspecRspecJson

Inherits:
InspecRspecMiniJson show all
Defined in:
lib/inspec/rspec_json_formatter.rb

Overview

rubocop:disable Metrics/ClassLength

Direct Known Subclasses

InspecRspecCli, InspecRspecJUnit

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from InspecRspecMiniJson

#dump_summary

Constructor Details

#initialize(*args) ⇒ InspecRspecJson

Returns a new instance of InspecRspecJson.



100
101
102
103
104
105
# File 'lib/inspec/rspec_json_formatter.rb', line 100

def initialize(*args)
  super(*args)
  @profiles = []
  @profiles_info = nil
  @backend = nil
end

Instance Attribute Details

#backend=(value) ⇒ Object (writeonly)

Sets the attribute backend

Parameters:

  • value

    the value to set the attribute backend to.



98
99
100
# File 'lib/inspec/rspec_json_formatter.rb', line 98

def backend=(value)
  @backend = value
end

Instance Method Details

#add_profile(profile) ⇒ Object

Called by the runner during example collection.



108
109
110
# File 'lib/inspec/rspec_json_formatter.rb', line 108

def add_profile(profile)
  @profiles.push(profile)
end

#stop(notification) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
# File 'lib/inspec/rspec_json_formatter.rb', line 112

def stop(notification)
  super(notification)

  @output_hash[:other_checks] = examples_without_controls
  @output_hash[:profiles] = profiles_info

  examples_with_controls.each do |example|
    control = example2control(example)
    move_example_into_control(example, control)
  end
end