summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/platform/query_helpers.rb6
-rw-r--r--spec/functional/rebooter_spec.rb2
-rwxr-xr-xspec/functional/resource/aixinit_service_spec.rb2
-rw-r--r--spec/support/mock/platform.rb2
-rw-r--r--spec/support/shared/unit/provider/file.rb6
-rw-r--r--spec/unit/application/client_spec.rb4
-rw-r--r--spec/unit/client_spec.rb4
-rw-r--r--spec/unit/cookbook/cookbook_version_loader_spec.rb2
-rw-r--r--spec/unit/cookbook/syntax_check_spec.rb2
-rw-r--r--spec/unit/cookbook_loader_spec.rb2
-rw-r--r--spec/unit/data_bag_spec.rb2
-rw-r--r--spec/unit/knife/bootstrap_spec.rb2
-rw-r--r--spec/unit/knife/core/subcommand_loader_spec.rb2
-rw-r--r--spec/unit/knife/core/ui_spec.rb2
-rw-r--r--spec/unit/knife/data_bag_from_file_spec.rb2
-rw-r--r--spec/unit/knife/environment_from_file_spec.rb2
-rw-r--r--spec/unit/mixin/path_sanity_spec.rb4
-rw-r--r--spec/unit/mixin/template_spec.rb4
-rw-r--r--spec/unit/platform/query_helpers_spec.rb2
-rw-r--r--spec/unit/provider/deploy/revision_spec.rb2
-rw-r--r--spec/unit/provider/deploy_spec.rb2
-rw-r--r--spec/unit/provider/directory_spec.rb2
-rw-r--r--spec/unit/provider/execute_spec.rb2
-rw-r--r--spec/unit/provider/user/dscl_spec.rb2
-rw-r--r--spec/unit/role_spec.rb2
-rw-r--r--spec/unit/shell_spec.rb2
26 files changed, 32 insertions, 36 deletions
diff --git a/lib/chef/platform/query_helpers.rb b/lib/chef/platform/query_helpers.rb
index f7c85fbe23..03b1c9ca1e 100644
--- a/lib/chef/platform/query_helpers.rb
+++ b/lib/chef/platform/query_helpers.rb
@@ -21,11 +21,7 @@ class Chef
class << self
def windows?
- if RUBY_PLATFORM =~ /mswin|mingw|windows/
- true
- else
- false
- end
+ ChefConfig.windows?
end
def windows_server_2003?
diff --git a/spec/functional/rebooter_spec.rb b/spec/functional/rebooter_spec.rb
index 763021607b..485e98f247 100644
--- a/spec/functional/rebooter_spec.rb
+++ b/spec/functional/rebooter_spec.rb
@@ -70,7 +70,7 @@ describe Chef::Platform::Rebooter do
shared_context 'test a reboot method' do
def test_rebooter_method(method_sym, is_windows, expected_reboot_str)
- allow(Chef::Platform).to receive(:windows?).and_return(is_windows)
+ allow(ChefConfig).to receive(:windows?).and_return(is_windows)
expect(rebooter).to receive(:shell_out!).once.with(expected_reboot_str)
expect(rebooter).to receive(method_sym).once.and_call_original
rebooter.send(method_sym, run_context.node)
diff --git a/spec/functional/resource/aixinit_service_spec.rb b/spec/functional/resource/aixinit_service_spec.rb
index 19b65ca2a0..3d9216158e 100755
--- a/spec/functional/resource/aixinit_service_spec.rb
+++ b/spec/functional/resource/aixinit_service_spec.rb
@@ -208,4 +208,4 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
end
end
end
-end \ No newline at end of file
+end
diff --git a/spec/support/mock/platform.rb b/spec/support/mock/platform.rb
index ab2c19baff..7eae82fe7d 100644
--- a/spec/support/mock/platform.rb
+++ b/spec/support/mock/platform.rb
@@ -6,7 +6,7 @@
# testing code that mixes in platform specific modules like +Chef::Mixin::Securable+
# or +Chef::FileAccessControl+
def platform_mock(platform = :unix, &block)
- allow(Chef::Platform).to receive(:windows?).and_return(platform == :windows ? true : false)
+ allow(ChefConfig).to receive(:windows?).and_return(platform == :windows ? true : false)
ENV['SYSTEMDRIVE'] = (platform == :windows ? 'C:' : nil)
if platform == :windows
diff --git a/spec/support/shared/unit/provider/file.rb b/spec/support/shared/unit/provider/file.rb
index 018be0a015..7de9698451 100644
--- a/spec/support/shared/unit/provider/file.rb
+++ b/spec/support/shared/unit/provider/file.rb
@@ -255,7 +255,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(Chef::Platform).to receive(:windows?).and_return(false)
+ allow(ChefConfig).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)
@@ -331,7 +331,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(Chef::Platform).to receive(:windows?).and_return(false)
+ allow(ChefConfig).to receive(:windows?).and_return(false)
setup_missing_file
end
@@ -380,7 +380,7 @@ shared_examples_for Chef::Provider::File do
before do
# fake that we're on unix even if we're on windows
- allow(Chef::Platform).to receive(:windows?).and_return(false)
+ allow(ChefConfig).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)
diff --git a/spec/unit/application/client_spec.rb b/spec/unit/application/client_spec.rb
index c753ca0ab8..f358aa1c77 100644
--- a/spec/unit/application/client_spec.rb
+++ b/spec/unit/application/client_spec.rb
@@ -60,7 +60,7 @@ describe Chef::Application::Client, "reconfigure" do
context "when interval is given" do
before do
Chef::Config[:interval] = 600
- allow(Chef::Platform).to receive(:windows?).and_return(false)
+ allow(ChefConfig).to receive(:windows?).and_return(false)
end
it "should terminate with message" do
@@ -77,7 +77,7 @@ Enable chef-client interval runs by setting `:client_fork = true` in your config
context "when interval is given on windows" do
before do
Chef::Config[:interval] = 600
- allow(Chef::Platform).to receive(:windows?).and_return(true)
+ allow(ChefConfig).to receive(:windows?).and_return(true)
end
it "should not terminate" do
diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb
index c1bde072f6..d8c4ede796 100644
--- a/spec/unit/client_spec.rb
+++ b/spec/unit/client_spec.rb
@@ -719,7 +719,7 @@ describe Chef::Client do
describe "windows_admin_check" do
context "platform is not windows" do
before do
- allow(Chef::Platform).to receive(:windows?).and_return(false)
+ allow(ChefConfig).to receive(:windows?).and_return(false)
end
it "shouldn't be called" do
@@ -730,7 +730,7 @@ describe Chef::Client do
context "platform is windows" do
before do
- allow(Chef::Platform).to receive(:windows?).and_return(true)
+ allow(ChefConfig).to receive(:windows?).and_return(true)
end
it "should be called" do
diff --git a/spec/unit/cookbook/cookbook_version_loader_spec.rb b/spec/unit/cookbook/cookbook_version_loader_spec.rb
index 2c4ad11787..23ffc21f7f 100644
--- a/spec/unit/cookbook/cookbook_version_loader_spec.rb
+++ b/spec/unit/cookbook/cookbook_version_loader_spec.rb
@@ -20,7 +20,7 @@ require 'spec_helper'
describe Chef::Cookbook::CookbookVersionLoader do
before do
- allow(Chef::Platform).to receive(:windows?) { false }
+ allow(ChefConfig).to receive(:windows?) { false }
end
describe "loading a cookbook" do
diff --git a/spec/unit/cookbook/syntax_check_spec.rb b/spec/unit/cookbook/syntax_check_spec.rb
index 471fc01831..ee4e0bed02 100644
--- a/spec/unit/cookbook/syntax_check_spec.rb
+++ b/spec/unit/cookbook/syntax_check_spec.rb
@@ -21,7 +21,7 @@ require "chef/cookbook/syntax_check"
describe Chef::Cookbook::SyntaxCheck do
before do
- allow(Chef::Platform).to receive(:windows?) { false }
+ allow(ChefConfig).to receive(:windows?) { false }
end
let(:cookbook_path) { File.join(CHEF_SPEC_DATA, 'cookbooks', 'openldap') }
diff --git a/spec/unit/cookbook_loader_spec.rb b/spec/unit/cookbook_loader_spec.rb
index 45a985bafd..b1384bffe7 100644
--- a/spec/unit/cookbook_loader_spec.rb
+++ b/spec/unit/cookbook_loader_spec.rb
@@ -20,7 +20,7 @@ require 'spec_helper'
describe Chef::CookbookLoader do
before do
- allow(Chef::Platform).to receive(:windows?) {false}
+ allow(ChefConfig).to receive(:windows?) {false}
end
let(:repo_paths) do
[
diff --git a/spec/unit/data_bag_spec.rb b/spec/unit/data_bag_spec.rb
index f6db1e222a..bd9a99a1de 100644
--- a/spec/unit/data_bag_spec.rb
+++ b/spec/unit/data_bag_spec.rb
@@ -22,7 +22,7 @@ require 'chef/data_bag'
describe Chef::DataBag do
before(:each) do
@data_bag = Chef::DataBag.new
- allow(Chef::Platform)::to receive(:windows?) { false }
+ allow(ChefConfig).to receive(:windows?) { false }
end
describe "initialize" do
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index aaace60f6a..0195e6d406 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -23,7 +23,7 @@ require 'net/ssh'
describe Chef::Knife::Bootstrap do
before do
- allow(Chef::Platform).to receive(:windows?) { false }
+ allow(ChefConfig).to receive(:windows?) { false }
end
let(:knife) do
Chef::Log.logger = Logger.new(StringIO.new)
diff --git a/spec/unit/knife/core/subcommand_loader_spec.rb b/spec/unit/knife/core/subcommand_loader_spec.rb
index 7f9308b28a..76ebf154db 100644
--- a/spec/unit/knife/core/subcommand_loader_spec.rb
+++ b/spec/unit/knife/core/subcommand_loader_spec.rb
@@ -24,7 +24,7 @@ describe Chef::Knife::SubcommandLoader do
let(:plugin_dir) { File.join(home, '.chef', 'plugins', 'knife') }
before do
- allow(Chef::Platform).to receive(:windows?) { false }
+ allow(ChefConfig).to receive(:windows?) { false }
Chef::Util::PathHelper.class_variable_set(:@@home_dir, home)
end
diff --git a/spec/unit/knife/core/ui_spec.rb b/spec/unit/knife/core/ui_spec.rb
index ac42ad6dd6..4f48d4ff0d 100644
--- a/spec/unit/knife/core/ui_spec.rb
+++ b/spec/unit/knife/core/ui_spec.rb
@@ -420,7 +420,7 @@ EOM
before(:each) do
stdout = double('StringIO', :tty? => true)
allow(@ui).to receive(:stdout).and_return(stdout)
- allow(Chef::Platform).to receive(:windows?) { true }
+ allow(ChefConfig).to receive(:windows?) { true }
Chef::Config.reset
end
diff --git a/spec/unit/knife/data_bag_from_file_spec.rb b/spec/unit/knife/data_bag_from_file_spec.rb
index 3882bff349..8b6502145c 100644
--- a/spec/unit/knife/data_bag_from_file_spec.rb
+++ b/spec/unit/knife/data_bag_from_file_spec.rb
@@ -26,7 +26,7 @@ Chef::Knife::DataBagFromFile.load_deps
describe Chef::Knife::DataBagFromFile do
before :each do
- allow(Chef::Platform).to receive(:windows?) { false }
+ allow(ChefConfig).to receive(:windows?) { false }
Chef::Config[:node_name] = "webmonkey.example.com"
FileUtils.mkdir_p([db_folder, db_folder2])
db_file.write(Chef::JSONCompat.to_json(plain_data))
diff --git a/spec/unit/knife/environment_from_file_spec.rb b/spec/unit/knife/environment_from_file_spec.rb
index d150e5ee64..11ad23c919 100644
--- a/spec/unit/knife/environment_from_file_spec.rb
+++ b/spec/unit/knife/environment_from_file_spec.rb
@@ -23,7 +23,7 @@ Chef::Knife::EnvironmentFromFile.load_deps
describe Chef::Knife::EnvironmentFromFile do
before(:each) do
- allow(Chef::Platform).to receive(:windows?) { false }
+ allow(ChefConfig).to receive(:windows?) { false }
@knife = Chef::Knife::EnvironmentFromFile.new
@stdout = StringIO.new
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
diff --git a/spec/unit/mixin/path_sanity_spec.rb b/spec/unit/mixin/path_sanity_spec.rb
index ec8e182e3d..3a924b9538 100644
--- a/spec/unit/mixin/path_sanity_spec.rb
+++ b/spec/unit/mixin/path_sanity_spec.rb
@@ -35,7 +35,7 @@ describe Chef::Mixin::PathSanity do
@gem_bindir = '/some/gem/bin'
allow(Gem).to receive(:bindir).and_return(@gem_bindir)
allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return(@ruby_bindir)
- allow(Chef::Platform).to receive(:windows?).and_return(false)
+ allow(ChefConfig).to receive(:windows?).and_return(false)
end
it "adds all useful PATHs even if environment is an empty hash" do
@@ -77,7 +77,7 @@ describe Chef::Mixin::PathSanity do
gem_bindir = 'C:\gems\bin'
allow(Gem).to receive(:bindir).and_return(gem_bindir)
allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return(ruby_bindir)
- allow(Chef::Platform).to receive(:windows?).and_return(true)
+ allow(ChefConfig).to receive(:windows?).and_return(true)
env = {"PATH" => 'C:\Windows\system32;C:\mr\softie'}
@sanity.enforce_path_sanity(env)
expect(env["PATH"]).to eq("C:\\Windows\\system32;C:\\mr\\softie;#{ruby_bindir};#{gem_bindir}")
diff --git a/spec/unit/mixin/template_spec.rb b/spec/unit/mixin/template_spec.rb
index f02bd34b8f..6a867b5f9a 100644
--- a/spec/unit/mixin/template_spec.rb
+++ b/spec/unit/mixin/template_spec.rb
@@ -39,7 +39,7 @@ describe Chef::Mixin::Template, "render_template" do
describe "when running on windows" do
before do
- allow(Chef::Platform).to receive(:windows?).and_return(true)
+ allow(ChefConfig).to receive(:windows?).and_return(true)
end
it "should render the templates with windows line endings" do
@@ -54,7 +54,7 @@ describe Chef::Mixin::Template, "render_template" do
describe "when running on unix" do
before do
- allow(Chef::Platform).to receive(:windows?).and_return(false)
+ allow(ChefConfig).to receive(:windows?).and_return(false)
end
it "should render the templates with unix line endings" do
diff --git a/spec/unit/platform/query_helpers_spec.rb b/spec/unit/platform/query_helpers_spec.rb
index 1dbd07a021..33d4c2c3b7 100644
--- a/spec/unit/platform/query_helpers_spec.rb
+++ b/spec/unit/platform/query_helpers_spec.rb
@@ -20,7 +20,7 @@ require 'spec_helper'
describe "Chef::Platform#windows_server_2003?" do
it "returns false early when not on windows" do
- allow(Chef::Platform).to receive(:windows?).and_return(false)
+ allow(ChefConfig).to receive(:windows?).and_return(false)
expect(Chef::Platform).not_to receive(:require)
expect(Chef::Platform.windows_server_2003?).to be_falsey
end
diff --git a/spec/unit/provider/deploy/revision_spec.rb b/spec/unit/provider/deploy/revision_spec.rb
index 4ca64e3445..caa60878e1 100644
--- a/spec/unit/provider/deploy/revision_spec.rb
+++ b/spec/unit/provider/deploy/revision_spec.rb
@@ -21,7 +21,7 @@ require 'spec_helper'
describe Chef::Provider::Deploy::Revision do
before do
- allow(Chef::Platform).to receive(:windows?) { false }
+ allow(ChefConfig).to receive(:windows?) { false }
@temp_dir = Dir.mktmpdir
Chef::Config[:file_cache_path] = @temp_dir
@resource = Chef::Resource::Deploy.new("/my/deploy/dir")
diff --git a/spec/unit/provider/deploy_spec.rb b/spec/unit/provider/deploy_spec.rb
index c95a9b3d57..a2997d8399 100644
--- a/spec/unit/provider/deploy_spec.rb
+++ b/spec/unit/provider/deploy_spec.rb
@@ -21,7 +21,7 @@ require 'spec_helper'
describe Chef::Provider::Deploy do
before do
- allow(Chef::Platform).to receive(:windows?) { false }
+ allow(ChefConfig).to receive(:windows?) { false }
@release_time = Time.utc( 2004, 8, 15, 16, 23, 42)
allow(Time).to receive(:now).and_return(@release_time)
@expected_release_dir = "/my/deploy/dir/releases/20040815162342"
diff --git a/spec/unit/provider/directory_spec.rb b/spec/unit/provider/directory_spec.rb
index 13c57bfe56..6489f2ca50 100644
--- a/spec/unit/provider/directory_spec.rb
+++ b/spec/unit/provider/directory_spec.rb
@@ -48,7 +48,7 @@ describe Chef::Provider::Directory do
describe "scanning file security metadata on unix" do
before do
- allow(Chef::Platform).to receive(:windows?).and_return(false)
+ allow(ChefConfig).to receive(:windows?).and_return(false)
end
let(:mock_stat) do
cstats = double("stats")
diff --git a/spec/unit/provider/execute_spec.rb b/spec/unit/provider/execute_spec.rb
index 51305b6225..1274203ce3 100644
--- a/spec/unit/provider/execute_spec.rb
+++ b/spec/unit/provider/execute_spec.rb
@@ -39,7 +39,7 @@ describe Chef::Provider::Execute do
let(:new_resource) { Chef::Resource::Execute.new("foo_resource", run_context) }
before do
- allow(Chef::Platform).to receive(:windows?) { false }
+ allow(ChefConfig).to receive(:windows?) { false }
@original_log_level = Chef::Log.level
Chef::Log.level = :info
allow(STDOUT).to receive(:tty?).and_return(true)
diff --git a/spec/unit/provider/user/dscl_spec.rb b/spec/unit/provider/user/dscl_spec.rb
index 5ea037d944..32d0812d8c 100644
--- a/spec/unit/provider/user/dscl_spec.rb
+++ b/spec/unit/provider/user/dscl_spec.rb
@@ -24,7 +24,7 @@ require 'mixlib/shellout'
describe Chef::Provider::User::Dscl do
before do
- allow(Chef::Platform).to receive(:windows?) { false }
+ allow(ChefConfig).to receive(:windows?) { false }
end
let(:node) {
node = Chef::Node.new
diff --git a/spec/unit/role_spec.rb b/spec/unit/role_spec.rb
index 5421b5a7b3..f120ca6da6 100644
--- a/spec/unit/role_spec.rb
+++ b/spec/unit/role_spec.rb
@@ -21,7 +21,7 @@ require 'chef/role'
describe Chef::Role do
before(:each) do
- allow(Chef::Platform).to receive(:windows?) { false }
+ allow(ChefConfig).to receive(:windows?) { false }
@role = Chef::Role.new
@role.name("ops_master")
end
diff --git a/spec/unit/shell_spec.rb b/spec/unit/shell_spec.rb
index 3a8f1a5346..379043a017 100644
--- a/spec/unit/shell_spec.rb
+++ b/spec/unit/shell_spec.rb
@@ -43,7 +43,7 @@ describe Shell do
before do
Shell.irb_conf = {}
allow(Shell::ShellSession.instance).to receive(:reset!)
- allow(Chef::Platform).to receive(:windows?).and_return(false)
+ allow(ChefConfig).to receive(:windows?).and_return(false)
allow(Chef::Util::PathHelper).to receive(:home).and_return('/home/foo')
end