Class: Chef::Audit::AuditEventProxy

Inherits:
RSpec::Core::Formatters::BaseFormatter
  • Object
show all
Defined in:
lib/chef/audit/audit_event_proxy.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.events=(events) ⇒ Object

TODO I don't like this, but I don't see another way to pass this in see rspec files configuration.rb#L671 and formatters.rb#L129


28
29
30
# File 'lib/chef/audit/audit_event_proxy.rb', line 28

def self.events=(events)
  @@events = events
end

Instance Method Details

#eventsObject


32
33
34
# File 'lib/chef/audit/audit_event_proxy.rb', line 32

def events
  @@events
end

#example_group_started(notification) ⇒ Object


36
37
38
39
40
41
42
43
# File 'lib/chef/audit/audit_event_proxy.rb', line 36

def example_group_started(notification)
  if notification.group.parent_groups.size == 1
    # top level `control_group` block
    desc = notification.group.description
    Chef::Log.debug("Entered `control_group` block named #{desc}")
    events.control_group_started(desc)
  end
end

#stop(notification) ⇒ Object


45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/chef/audit/audit_event_proxy.rb', line 45

def stop(notification)
  Chef::Log.info("Successfully executed all `control_group` blocks and contained examples")
  notification.examples.each do |example|
    control_group_name, control_data = build_control_from(example)
    e = example.exception
    if e
      events.control_example_failure(control_group_name, control_data, e)
    else
      events.control_example_success(control_group_name, control_data)
    end
  end
end