diff options
author | tyler-ball <tyleraball@gmail.com> | 2014-11-06 07:33:35 -0800 |
---|---|---|
committer | tyler-ball <tyleraball@gmail.com> | 2014-12-17 18:47:26 -0800 |
commit | 2bb912157470f55975f2e50e3792132478639a78 (patch) | |
tree | 717d21be119adb2e072146d6f7c2183a11d013d9 /lib/chef/audit | |
parent | b9b4d3bfd6ec6196cb78094e589c094edb61b501 (diff) | |
download | chef-2bb912157470f55975f2e50e3792132478639a78.tar.gz |
Preparing for demo - using rspec documentation formatter for output instead of the proxy
Diffstat (limited to 'lib/chef/audit')
-rw-r--r-- | lib/chef/audit/audit_event_proxy.rb | 4 | ||||
-rw-r--r-- | lib/chef/audit/chef_example_group.rb | 9 | ||||
-rw-r--r-- | lib/chef/audit/control_group_data.rb | 1 | ||||
-rw-r--r-- | lib/chef/audit/runner.rb | 18 |
4 files changed, 15 insertions, 17 deletions
diff --git a/lib/chef/audit/audit_event_proxy.rb b/lib/chef/audit/audit_event_proxy.rb index 1052821946..d56c7f0ac5 100644 --- a/lib/chef/audit/audit_event_proxy.rb +++ b/lib/chef/audit/audit_event_proxy.rb @@ -16,10 +16,6 @@ class Chef @@events end - def initialize(output) - super - end - def example_group_started(notification) events.control_group_start(notification.group.description.strip) end diff --git a/lib/chef/audit/chef_example_group.rb b/lib/chef/audit/chef_example_group.rb deleted file mode 100644 index 482647cd03..0000000000 --- a/lib/chef/audit/chef_example_group.rb +++ /dev/null @@ -1,9 +0,0 @@ - -class Chef - class Audit - class ChefExampleGroup < ::RSpec::Core::ExampleGroup - # Can encompass tests in a `control` block or `describe` block - define_example_group_method :control - end - end -end diff --git a/lib/chef/audit/control_group_data.rb b/lib/chef/audit/control_group_data.rb index 93abfb3c21..fc758e45ba 100644 --- a/lib/chef/audit/control_group_data.rb +++ b/lib/chef/audit/control_group_data.rb @@ -15,6 +15,7 @@ class Chef def example_success(opts={}) @number_success += 1 control = create_control(opts) + control.status = "success" controls << control control end diff --git a/lib/chef/audit/runner.rb b/lib/chef/audit/runner.rb index 1408c67327..4a76b7e65b 100644 --- a/lib/chef/audit/runner.rb +++ b/lib/chef/audit/runner.rb @@ -18,6 +18,7 @@ require 'chef/audit' require 'chef/audit/audit_event_proxy' +require 'chef/audit/chef_json_formatter' require 'chef/config' class Chef @@ -25,6 +26,7 @@ class Chef class Runner attr_reader :run_context + private :run_context def initialize(run_context) @run_context = run_context @@ -48,11 +50,11 @@ class Chef # RSpec configuration and world objects are heavy, so let's wait until # we actually need them. def configuration - @configuration ||= RSpec::Core::Configuration.new + RSpec.configuration end def world - @world ||= RSpec::Core::World.new(configuration) + RSpec.world end # Configure audits before run. @@ -62,8 +64,14 @@ class Chef def setup # We're setting the output stream, but that will only be used for error situations # Our formatter forwards events to the Chef event message bus + # TODO so some testing to see if these output to a log file - we probably need + # to register these before any formatters are added. configuration.output_stream = Chef::Config[:log_location] configuration.error_stream = Chef::Config[:log_location] + # TODO im pretty sure I only need this because im running locally in rvmsudo + configuration.backtrace_exclusion_patterns.push(Regexp.new("/Users".gsub("/", File::SEPARATOR))) + configuration.backtrace_exclusion_patterns.push(Regexp.new("(eval)")) + configuration.color = Chef::Config[:color] add_formatters disable_should_syntax @@ -71,8 +79,10 @@ class Chef end def add_formatters - configuration.add_formatter(Chef::Audit::AuditEventProxy) - Chef::Audit::AuditEventProxy.events = run_context.events + configuration.add_formatter(RSpec::Core::Formatters::DocumentationFormatter) + configuration.add_formatter(Chef::Audit::ChefJsonFormatter) + #configuration.add_formatter(Chef::Audit::AuditEventProxy) + #Chef::Audit::AuditEventProxy.events = run_context.events end # Explicitly disable :should syntax. |