summaryrefslogtreecommitdiff
path: root/lib/chef/audit/runner.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/audit/runner.rb')
-rw-r--r--lib/chef/audit/runner.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/chef/audit/runner.rb b/lib/chef/audit/runner.rb
index e7d1657d69..13c2823dca 100644
--- a/lib/chef/audit/runner.rb
+++ b/lib/chef/audit/runner.rb
@@ -45,6 +45,10 @@ class Chef
RSpec.world.reporter.examples.size
end
+ def exclusion_pattern
+ Regexp.new(".+[\\\/]lib[\\\/]chef[\\\/]")
+ end
+
private
# Prepare to run audits:
# - Require files
@@ -75,11 +79,15 @@ class Chef
require 'rspec'
require 'rspec/its'
require 'specinfra'
+ require 'specinfra/helper'
+ require 'specinfra/helper/set'
require 'serverspec/helper'
require 'serverspec/matcher'
require 'serverspec/subject'
require 'chef/audit/audit_event_proxy'
require 'chef/audit/rspec_formatter'
+
+ Specinfra::Backend::Cmd.send(:include, Specinfra::Helper::Set)
end
# Configure RSpec just the way we like it:
@@ -96,6 +104,7 @@ class Chef
RSpec.configure do |c|
c.color = Chef::Config[:color]
c.expose_dsl_globally = false
+ c.backtrace_exclusion_patterns << exclusion_pattern
end
end
@@ -131,9 +140,13 @@ class Chef
end
end
- # Set up the backend for Specinfra/Serverspec. :exec is the local system.
+ # Set up the backend for Specinfra/Serverspec. :exec is the local system; on Windows, it is :cmd
def configure_specinfra
- Specinfra.configuration.backend = :exec
+ if Chef::Platform.windows?
+ Specinfra.configuration.backend = :cmd
+ else
+ Specinfra.configuration.backend = :exec
+ end
end
# Iterates through the control groups registered to this run_context, builds an