diff options
author | John McCrae <john.mccrae@progress.com> | 2022-01-04 14:58:17 -0800 |
---|---|---|
committer | John McCrae <john.mccrae@progress.com> | 2022-01-31 15:54:55 -0800 |
commit | dda1b73a8e7f26a7c81d9797aaf633241a4825ab (patch) | |
tree | 9e8fa5bd04f4c20c9d5cd09bbafa1338f4edbaa5 /spec | |
parent | d1c3379e55a76b8250402ab5a2f4087a32753b0e (diff) | |
download | chef-dda1b73a8e7f26a7c81d9797aaf633241a4825ab.tar.gz |
Updated the chef client to retrieve certs from the Windows registry. Tests included. This is PR3 since I keep trashing them
Signed-off-by: John McCrae <john.mccrae@progress.com>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/platform/query_helpers_spec.rb | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/spec/unit/platform/query_helpers_spec.rb b/spec/unit/platform/query_helpers_spec.rb index 0b4169810e..a6190b1f3e 100644 --- a/spec/unit/platform/query_helpers_spec.rb +++ b/spec/unit/platform/query_helpers_spec.rb @@ -18,46 +18,48 @@ require "spec_helper" -describe "Chef::Platform#supports_dsc_invoke_resource?" do - it "returns false if powershell is not present" do - node = Chef::Node.new - expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_falsey - end - - ["1.0", "2.0", "3.0", "4.0", "5.0.10017.9"].each do |version| - it "returns false for PowerShell #{version}" do +if ChefUtils.Windows? + describe "Chef::Platform#supports_dsc_invoke_resource?" do + it "returns false if powershell is not present" do node = Chef::Node.new - node.automatic[:languages][:powershell][:version] = version expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_falsey end - end - it "returns true for Powershell 5.0.10018.0" do - node = Chef::Node.new - node.automatic[:languages][:powershell][:version] = "5.0.10018.0" - expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_truthy + ["1.0", "2.0", "3.0", "4.0", "5.0.10017.9"].each do |version| + it "returns false for PowerShell #{version}" do + node = Chef::Node.new + node.automatic[:languages][:powershell][:version] = version + expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_falsey + end + end + + it "returns true for Powershell 5.0.10018.0" do + node = Chef::Node.new + node.automatic[:languages][:powershell][:version] = "5.0.10018.0" + expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_truthy + end end -end -describe "Chef::Platform#dsc_refresh_mode_disabled?" do - let(:node) { instance_double("Chef::Node") } - let(:powershell) { instance_double("Chef::PowerShell") } + describe "Chef::Platform#dsc_refresh_mode_disabled?" do + let(:node) { instance_double("Chef::Node") } + let(:powershell) { instance_double("Chef::PowerShell") } - it "returns true when RefreshMode is Disabled" do - expect(Chef::PowerShell).to receive(:new) - .with("Get-DscLocalConfigurationManager") - .and_return(powershell) - expect(powershell).to receive(:error!) - expect(powershell).to receive(:result).and_return({ "RefreshMode" => "Disabled" }) - expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be true - end + it "returns true when RefreshMode is Disabled" do + expect(Chef::PowerShell).to receive(:new) + .with("Get-DscLocalConfigurationManager") + .and_return(powershell) + expect(powershell).to receive(:error!) + expect(powershell).to receive(:result).and_return({ "RefreshMode" => "Disabled" }) + expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be true + end - it "returns false when RefreshMode is not Disabled" do - expect(Chef::PowerShell).to receive(:new) - .with("Get-DscLocalConfigurationManager") - .and_return(powershell) - expect(powershell).to receive(:error!) - expect(powershell).to receive(:result).and_return({ "RefreshMode" => "LaLaLa" }) - expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be false + it "returns false when RefreshMode is not Disabled" do + expect(Chef::PowerShell).to receive(:new) + .with("Get-DscLocalConfigurationManager") + .and_return(powershell) + expect(powershell).to receive(:error!) + expect(powershell).to receive(:result).and_return({ "RefreshMode" => "LaLaLa" }) + expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be false + end end -end +end
\ No newline at end of file |