summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-11-04 13:34:02 -0800
committertyler-ball <tyleraball@gmail.com>2014-12-17 18:47:25 -0800
commit9f3390ffe26abbe54b51aee19a78cf2778b9b340 (patch)
tree9f2e45df2274a02895575b2684214bed3c1b51a1
parent549b0b4d16ebb07798d9c89e3788fe26de3a4ebf (diff)
downloadchef-9f3390ffe26abbe54b51aee19a78cf2778b9b340.tar.gz
Add serverspec types and matchers.
-rw-r--r--chef.gemspec3
-rw-r--r--lib/chef/audit.rb8
-rw-r--r--lib/chef/audit/runner.rb7
3 files changed, 17 insertions, 1 deletions
diff --git a/chef.gemspec b/chef.gemspec
index 0461872668..2138f36114 100644
--- a/chef.gemspec
+++ b/chef.gemspec
@@ -45,6 +45,9 @@ Gem::Specification.new do |s|
%w(rspec-core rspec-expectations rspec-mocks).each { |gem| s.add_development_dependency gem, "~> 3.1" }
+ s.add_development_dependency "serverspec", "~> 2.3"
+ s.add_development_dependency "specinfra", "~> 2.4"
+
s.bindir = "bin"
s.executables = %w( chef-client chef-solo knife chef-shell chef-apply )
diff --git a/lib/chef/audit.rb b/lib/chef/audit.rb
index 43d5c11ee8..0c79928974 100644
--- a/lib/chef/audit.rb
+++ b/lib/chef/audit.rb
@@ -16,7 +16,13 @@
# limitations under the License.
#
-require 'rspec/core'
+require 'rspec'
+
+require 'serverspec/matcher'
+require 'serverspec/helper'
+require 'serverspec/subject'
+
+require 'specinfra'
require 'chef/dsl/audit'
require 'chef/audit/chef_json_formatter'
diff --git a/lib/chef/audit/runner.rb b/lib/chef/audit/runner.rb
index e3699266b8..0f439a1aa5 100644
--- a/lib/chef/audit/runner.rb
+++ b/lib/chef/audit/runner.rb
@@ -62,6 +62,7 @@ class Chef
add_formatters
disable_should_syntax
+ configure_specinfra
end
def add_formatters
@@ -82,6 +83,12 @@ class Chef
end
end
+ def configure_specinfra
+ # TODO: We may need to change this based on operating system (there is a
+ # powershell backend) or roll our own.
+ Specinfra.configuration.backend = :exec
+ end
+
# Register each controls group with the world, which will handle
# the ordering of the audits that will be run.
def register_controls_groups