summaryrefslogtreecommitdiff
path: root/spec/functional
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-11-08 14:06:33 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2019-11-08 14:06:33 -0800
commit8a7e29d52882c39d0c903eef83bd3472e4f334af (patch)
treea25a7b76416e07ebdb54e569fb0006079cf012db /spec/functional
parentc31625406530b560fab02b11fa2447955ed2faef (diff)
downloadchef-8a7e29d52882c39d0c903eef83bd3472e4f334af.tar.gz
Add chef-utils gem with various recipe DSL helpers
This is the implementation of [RFC-087](https://github.com/chef-boneyard/chef-rfc/blob/master/rfc087-distro-sugar-helpers.md) although some of the specifics have been iterated on and changed. The documentation will be in the [README.md](https://github.com/chef/chef/tree/master/chef-utils/README.md) once this is merged. While this PR mostly moves chef-sugar utilities into core-chef via this chef-utils gem, the scope of the chef-utils gem should be considered larger than just that. As an example this PR moves the Mash class into this gem for reuse in ohai as well. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/functional')
-rw-r--r--spec/functional/event_loggers/windows_eventlog_spec.rb2
-rw-r--r--spec/functional/mixin/user_context_spec.rb4
-rw-r--r--spec/functional/rebooter_spec.rb2
-rw-r--r--spec/functional/resource/cookbook_file_spec.rb4
-rw-r--r--spec/functional/resource/template_spec.rb2
-rw-r--r--spec/functional/win32/crypto_spec.rb2
-rw-r--r--spec/functional/win32/security_spec.rb2
-rw-r--r--spec/functional/win32/service_manager_spec.rb2
-rw-r--r--spec/functional/win32/sid_spec.rb4
-rw-r--r--spec/functional/win32/version_info_spec.rb2
-rw-r--r--spec/functional/win32/versions_spec.rb2
11 files changed, 14 insertions, 14 deletions
diff --git a/spec/functional/event_loggers/windows_eventlog_spec.rb b/spec/functional/event_loggers/windows_eventlog_spec.rb
index ca15d3e38d..d6c4c481f3 100644
--- a/spec/functional/event_loggers/windows_eventlog_spec.rb
+++ b/spec/functional/event_loggers/windows_eventlog_spec.rb
@@ -19,7 +19,7 @@
require "spec_helper"
require "securerandom"
require "chef/event_loggers/windows_eventlog"
-if Chef::Platform.windows?
+if ChefUtils.windows?
require "win32/eventlog"
include Win32
end
diff --git a/spec/functional/mixin/user_context_spec.rb b/spec/functional/mixin/user_context_spec.rb
index b6b8b057d5..0fe5f08824 100644
--- a/spec/functional/mixin/user_context_spec.rb
+++ b/spec/functional/mixin/user_context_spec.rb
@@ -17,8 +17,8 @@
require "spec_helper"
-require "chef/win32/api" if Chef::Platform.windows?
-require "chef/win32/api/error" if Chef::Platform.windows?
+require "chef/win32/api" if ChefUtils.windows?
+require "chef/win32/api/error" if ChefUtils.windows?
require "chef/mixin/user_context"
describe Chef::Mixin::UserContext, windows_only: true do
diff --git a/spec/functional/rebooter_spec.rb b/spec/functional/rebooter_spec.rb
index 747978cc96..689570c580 100644
--- a/spec/functional/rebooter_spec.rb
+++ b/spec/functional/rebooter_spec.rb
@@ -72,7 +72,7 @@ describe Chef::Platform::Rebooter do
shared_context "test a reboot method" do
def test_rebooter_method(method_sym, is_windows, is_solaris, expected_reboot_str)
- allow(ChefConfig).to receive(:windows?).and_return(is_windows)
+ allow(ChefUtils).to receive(:windows?).and_return(is_windows)
node.automatic["os"] = node.automatic["platform"] = node.automatic["platform_family"] = "solaris2" if is_solaris
expect(rebooter).to receive(:shell_out!).once.with(expected_reboot_str)
expect(rebooter).to receive(:raise).with(Chef::Exceptions::Reboot)
diff --git a/spec/functional/resource/cookbook_file_spec.rb b/spec/functional/resource/cookbook_file_spec.rb
index 6e964a6499..37d31188ac 100644
--- a/spec/functional/resource/cookbook_file_spec.rb
+++ b/spec/functional/resource/cookbook_file_spec.rb
@@ -68,11 +68,11 @@ describe Chef::Resource::CookbookFile do
let(:path) { File.join(windows_non_temp_dir, make_tmpname(file_base)) }
before do
- FileUtils.mkdir_p(windows_non_temp_dir) if Chef::Platform.windows?
+ FileUtils.mkdir_p(windows_non_temp_dir) if ChefUtils.windows?
end
after do
- FileUtils.rm_r(windows_non_temp_dir) if Chef::Platform.windows? && File.exists?(windows_non_temp_dir)
+ FileUtils.rm_r(windows_non_temp_dir) if ChefUtils.windows? && File.exists?(windows_non_temp_dir)
end
end
diff --git a/spec/functional/resource/template_spec.rb b/spec/functional/resource/template_spec.rb
index feef97dd27..63a950db95 100644
--- a/spec/functional/resource/template_spec.rb
+++ b/spec/functional/resource/template_spec.rb
@@ -203,7 +203,7 @@ describe Chef::Resource::Template do
it "output should contain platform's line endings" do
resource.run_action(:create)
binread(path).each_line do |line|
- expect(line).to end_with(Chef::Platform.windows? ? "\r\n" : "\n")
+ expect(line).to end_with(ChefUtils.windows? ? "\r\n" : "\n")
end
end
end
diff --git a/spec/functional/win32/crypto_spec.rb b/spec/functional/win32/crypto_spec.rb
index 70d3f42cfb..ab51e4d681 100644
--- a/spec/functional/win32/crypto_spec.rb
+++ b/spec/functional/win32/crypto_spec.rb
@@ -17,7 +17,7 @@
#
require "spec_helper"
-if Chef::Platform.windows?
+if ChefUtils.windows?
require "chef/win32/crypto"
end
diff --git a/spec/functional/win32/security_spec.rb b/spec/functional/win32/security_spec.rb
index a72088a079..3eb7bedd48 100644
--- a/spec/functional/win32/security_spec.rb
+++ b/spec/functional/win32/security_spec.rb
@@ -19,7 +19,7 @@
require "spec_helper"
require "mixlib/shellout"
require "chef/mixin/user_context"
-if Chef::Platform.windows?
+if ChefUtils.windows?
require "chef/win32/security"
end
diff --git a/spec/functional/win32/service_manager_spec.rb b/spec/functional/win32/service_manager_spec.rb
index abc8118835..bb8ed54c0e 100644
--- a/spec/functional/win32/service_manager_spec.rb
+++ b/spec/functional/win32/service_manager_spec.rb
@@ -17,7 +17,7 @@
#
require "spec_helper"
-if Chef::Platform.windows?
+if ChefUtils.windows?
require "chef/application/windows_service_manager"
end
diff --git a/spec/functional/win32/sid_spec.rb b/spec/functional/win32/sid_spec.rb
index eac62d88b6..bdc570dfe6 100644
--- a/spec/functional/win32/sid_spec.rb
+++ b/spec/functional/win32/sid_spec.rb
@@ -17,12 +17,12 @@
#
require "spec_helper"
-if Chef::Platform.windows?
+if ChefUtils.windows?
require "chef/win32/security"
end
describe "Chef::ReservedNames::Win32::SID", :windows_only do
- if Chef::Platform.windows?
+ if ChefUtils.windows?
SID ||= Chef::ReservedNames::Win32::Security::SID
end
diff --git a/spec/functional/win32/version_info_spec.rb b/spec/functional/win32/version_info_spec.rb
index b5570732a0..988339fd7a 100644
--- a/spec/functional/win32/version_info_spec.rb
+++ b/spec/functional/win32/version_info_spec.rb
@@ -17,7 +17,7 @@
#
require "spec_helper"
-if Chef::Platform.windows?
+if ChefUtils.windows?
require "chef/win32/file/version_info"
end
diff --git a/spec/functional/win32/versions_spec.rb b/spec/functional/win32/versions_spec.rb
index 19bd0e3875..9ce21c49f9 100644
--- a/spec/functional/win32/versions_spec.rb
+++ b/spec/functional/win32/versions_spec.rb
@@ -17,7 +17,7 @@
#
require "spec_helper"
-if Chef::Platform.windows?
+if ChefUtils.windows?
require "chef/win32/version"
end