diff options
Diffstat (limited to 'spec/unit/platform/query_helpers_spec.rb')
-rw-r--r-- | spec/unit/platform/query_helpers_spec.rb | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/spec/unit/platform/query_helpers_spec.rb b/spec/unit/platform/query_helpers_spec.rb index ac5158e913..82ed4de9c6 100644 --- a/spec/unit/platform/query_helpers_spec.rb +++ b/spec/unit/platform/query_helpers_spec.rb @@ -51,9 +51,9 @@ describe "Chef::Platform#windows_nano_server?" do it "returns true when the registry value is 1" do allow(ChefConfig).to receive(:windows?).and_return(true) allow(Chef::Platform).to receive(:require).with("win32/registry") - expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open). - with(key, access). - and_yield(registry) + expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open) + .with(key, access) + .and_yield(registry) expect(registry).to receive(:[]).with("NanoServer").and_return(1) expect(Chef::Platform.windows_nano_server?).to be true end @@ -61,9 +61,9 @@ describe "Chef::Platform#windows_nano_server?" do it "returns false when the registry value is not 1" do allow(ChefConfig).to receive(:windows?).and_return(true) allow(Chef::Platform).to receive(:require).with("win32/registry") - expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open). - with(key, access). - and_yield(registry) + expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open) + .with(key, access) + .and_yield(registry) expect(registry).to receive(:[]).with("NanoServer").and_return(0) expect(Chef::Platform.windows_nano_server?).to be false end @@ -71,20 +71,20 @@ describe "Chef::Platform#windows_nano_server?" do it "returns false when the registry value does not exist" do allow(ChefConfig).to receive(:windows?).and_return(true) allow(Chef::Platform).to receive(:require).with("win32/registry") - expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open). - with(key, access). - and_yield(registry) - expect(registry).to receive(:[]).with("NanoServer"). - and_raise(Win32::Registry::Error, "The system cannot find the file specified.") + expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open) + .with(key, access) + .and_yield(registry) + expect(registry).to receive(:[]).with("NanoServer") + .and_raise(Win32::Registry::Error, "The system cannot find the file specified.") expect(Chef::Platform.windows_nano_server?).to be false end it "returns false when the registry key does not exist" do allow(ChefConfig).to receive(:windows?).and_return(true) allow(Chef::Platform).to receive(:require).with("win32/registry") - expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open). - with(key, access). - and_raise(Win32::Registry::Error, "The system cannot find the file specified.") + expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open) + .with(key, access) + .and_raise(Win32::Registry::Error, "The system cannot find the file specified.") expect(Chef::Platform.windows_nano_server?).to be false end end @@ -122,18 +122,18 @@ describe "Chef::Platform#supports_msi?" do it "returns true when the registry key exists" do allow(ChefConfig).to receive(:windows?).and_return(true) allow(Chef::Platform).to receive(:require).with("win32/registry") - expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open). - with(key, access). - and_yield(registry) + expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open) + .with(key, access) + .and_yield(registry) expect(Chef::Platform.supports_msi?).to be true end it "returns false when the registry key does not exist" do allow(ChefConfig).to receive(:windows?).and_return(true) allow(Chef::Platform).to receive(:require).with("win32/registry") - expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open). - with(key, access). - and_raise(Win32::Registry::Error, "The system cannot find the file specified.") + expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open) + .with(key, access) + .and_raise(Win32::Registry::Error, "The system cannot find the file specified.") expect(Chef::Platform.supports_msi?).to be false end end @@ -188,18 +188,18 @@ describe "Chef::Platform#dsc_refresh_mode_disabled?" do let(:cmdlet_result) { instance_double("Chef::Util::Powershell::CmdletResult") } it "returns true when RefreshMode is Disabled" do - expect(Chef::Util::Powershell::Cmdlet).to receive(:new). - with(node, "Get-DscLocalConfigurationManager", :object). - and_return(cmdlet) + expect(Chef::Util::Powershell::Cmdlet).to receive(:new) + .with(node, "Get-DscLocalConfigurationManager", :object) + .and_return(cmdlet) expect(cmdlet).to receive(:run!).and_return(cmdlet_result) expect(cmdlet_result).to receive(:return_value).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::Util::Powershell::Cmdlet).to receive(:new). - with(node, "Get-DscLocalConfigurationManager", :object). - and_return(cmdlet) + expect(Chef::Util::Powershell::Cmdlet).to receive(:new) + .with(node, "Get-DscLocalConfigurationManager", :object) + .and_return(cmdlet) expect(cmdlet).to receive(:run!).and_return(cmdlet_result) expect(cmdlet_result).to receive(:return_value).and_return({ "RefreshMode" => "LaLaLa" }) expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be false |