diff options
author | Claire McQuin <claire@getchef.com> | 2014-11-03 16:35:43 -0800 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-11-03 16:35:43 -0800 |
commit | 461d5221d9fd78c2748ac74e8fe175e632307ad6 (patch) | |
tree | 8925baa30fcad35ef87f8ee53e5f6154cb492fb3 /lib/chef/audit.rb | |
parent | 1aa6737e000e1261f49a8ff0d6960f9d482e2023 (diff) | |
download | chef-runner.tar.gz |
Refactor runner into own class.runner
Diffstat (limited to 'lib/chef/audit.rb')
-rw-r--r-- | lib/chef/audit.rb | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/lib/chef/audit.rb b/lib/chef/audit.rb index 6fd067448b..1e3668396f 100644 --- a/lib/chef/audit.rb +++ b/lib/chef/audit.rb @@ -18,47 +18,5 @@ require 'rspec/core' -require 'chef/config' - -class Chef - class Audit - - def initialize - @configuration = RSpec::Core::Configuration.new - @world = RSpec::Core::World.new(@configuration) - @runner = RSpec::Core::Runner.new(nil, @configuration, @world) - end - - def setup - @configuration.output_stream = Chef::Config[:log_location] - @configuration.error_stream = Chef::Config[:log_location] - - configure_formatters - configure_expectation_frameworks - end - - private - # Adds formatters to RSpec. - # By default, two formatters are added: one for outputting readable text - # of audits run and one for sending JSON data back to reporting. - def configure_formatters - # TODO (future): We should allow for an audit-mode formatter config option - # and use this formatter as default/fallback if none is specified. - @configuration.add_formatter(RSpec::Core::Formatters::DocumentationFormatter) - # TODO: Add JSON formatter for audit reporting to analytics. - end - - def configure_expectation_frameworks - @configuration.expect_with(:rspec) do |config| - # :should is deprecated in RSpec 3+ and we have chosen to explicitly disable - # it in audits. If :should is used in an audit, this will cause the audit to - # fail with message "undefined method `should`" rather than print a deprecation - # message. - config.syntax = :expect - end - - #TODO: serverspec? - end - - end -end +require 'chef/dsl/audit' +require 'chef/audit/chef_json_formatter' |