summaryrefslogtreecommitdiff
path: root/spec/support/shared
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/support/shared
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/support/shared')
-rw-r--r--spec/support/shared/integration/integration_helper.rb2
-rw-r--r--spec/support/shared/integration/knife_support.rb2
-rw-r--r--spec/support/shared/unit/provider/file.rb8
3 files changed, 6 insertions, 6 deletions
diff --git a/spec/support/shared/integration/integration_helper.rb b/spec/support/shared/integration/integration_helper.rb
index f0dfd1dc43..af57e21c73 100644
--- a/spec/support/shared/integration/integration_helper.rb
+++ b/spec/support/shared/integration/integration_helper.rb
@@ -128,7 +128,7 @@ module IntegrationSupport
# TODO: "force" actually means "silence all exceptions". this
# silences a weird permissions error on Windows that we should track
# down, but for now there's no reason for it to blow up our CI.
- FileUtils.remove_entry_secure(@repository_dir, force = Chef::Platform.windows?)
+ FileUtils.remove_entry_secure(@repository_dir, force = ChefUtils.windows?)
ensure
@repository_dir = nil
end
diff --git a/spec/support/shared/integration/knife_support.rb b/spec/support/shared/integration/knife_support.rb
index 07d95f17cc..8de665c370 100644
--- a/spec/support/shared/integration/knife_support.rb
+++ b/spec/support/shared/integration/knife_support.rb
@@ -181,7 +181,7 @@ module KnifeSupport
expect(stderr_actual).to eq(expected[:stderr])
end
stdout_actual = @stdout
- if Chef::Platform.windows?
+ if ChefUtils.windows?
stderr_actual = stderr_actual.gsub("\r\n", "\n")
stdout_actual = stdout_actual.gsub("\r\n", "\n")
end
diff --git a/spec/support/shared/unit/provider/file.rb b/spec/support/shared/unit/provider/file.rb
index 2771a371d4..36b19675c2 100644
--- a/spec/support/shared/unit/provider/file.rb
+++ b/spec/support/shared/unit/provider/file.rb
@@ -1,6 +1,6 @@
#
# Author:: Lamont Granquist (<lamont@chef.io>)
-# Copyright:: Copyright 2013-2016, Chef Software, Inc.
+# Copyright:: Copyright 2013-2018, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -256,7 +256,7 @@ shared_examples_for Chef::Provider::File do
context "examining file security metadata on Unix with a file that exists" do
before do
# fake that we're on unix even if we're on windows
- allow(ChefConfig).to receive(:windows?).and_return(false)
+ allow(ChefUtils).to receive(:windows?).and_return(false)
# mock up the filesystem to behave like unix
setup_normal_file
stat_struct = double("::File.stat", mode: 0600, uid: 0, gid: 0, mtime: 10000)
@@ -332,7 +332,7 @@ shared_examples_for Chef::Provider::File do
context "examining file security metadata on Unix with a file that does not exist" do
before do
# fake that we're on unix even if we're on windows
- allow(ChefConfig).to receive(:windows?).and_return(false)
+ allow(ChefUtils).to receive(:windows?).and_return(false)
setup_missing_file
end
@@ -381,7 +381,7 @@ shared_examples_for Chef::Provider::File do
before do
# fake that we're on unix even if we're on windows
- allow(ChefConfig).to receive(:windows?).and_return(false)
+ allow(ChefUtils).to receive(:windows?).and_return(false)
# mock up the filesystem to behave like unix
setup_normal_file
stat_struct = double("::File.stat", mode: 0600, uid: 0, gid: 0, mtime: 10000)