summaryrefslogtreecommitdiff
path: root/spec/unit/platform/query_helpers_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/platform/query_helpers_spec.rb')
-rw-r--r--spec/unit/platform/query_helpers_spec.rb42
1 files changed, 21 insertions, 21 deletions
diff --git a/spec/unit/platform/query_helpers_spec.rb b/spec/unit/platform/query_helpers_spec.rb
index d18b6f7902..3905b15071 100644
--- a/spec/unit/platform/query_helpers_spec.rb
+++ b/spec/unit/platform/query_helpers_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe "Chef::Platform#windows_server_2003?" do
it "returns false early when not on windows" do
@@ -51,8 +51,8 @@ describe "Chef::Platform#windows_nano_server?" do
end
after do
- Win32::Registry.send(:remove_const, 'HKEY_LOCAL_MACHINE') if defined?(Win32::Registry::HKEY_LOCAL_MACHINE)
- Win32::Registry.send(:remove_const, 'KEY_QUERY_VALUE') if defined?(Win32::Registry::KEY_QUERY_VALUE)
+ Win32::Registry.send(:remove_const, "HKEY_LOCAL_MACHINE") if defined?(Win32::Registry::HKEY_LOCAL_MACHINE)
+ Win32::Registry.send(:remove_const, "KEY_QUERY_VALUE") if defined?(Win32::Registry::KEY_QUERY_VALUE)
end
it "returns false early when not on windows" do
@@ -63,7 +63,7 @@ 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')
+ allow(Chef::Platform).to receive(:require).with("win32/registry")
expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).
with(key, access).
and_yield(registry)
@@ -73,7 +73,7 @@ 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')
+ allow(Chef::Platform).to receive(:require).with("win32/registry")
expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).
with(key, access).
and_yield(registry)
@@ -83,7 +83,7 @@ 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')
+ allow(Chef::Platform).to receive(:require).with("win32/registry")
expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).
with(key, access).
and_yield(registry)
@@ -94,7 +94,7 @@ describe "Chef::Platform#windows_nano_server?" do
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')
+ 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.")
@@ -122,8 +122,8 @@ describe "Chef::Platform#supports_msi?" do
end
after do
- Win32::Registry.send(:remove_const, 'HKEY_LOCAL_MACHINE') if defined?(Win32::Registry::HKEY_LOCAL_MACHINE)
- Win32::Registry.send(:remove_const, 'KEY_QUERY_VALUE') if defined?(Win32::Registry::KEY_QUERY_VALUE)
+ Win32::Registry.send(:remove_const, "HKEY_LOCAL_MACHINE") if defined?(Win32::Registry::HKEY_LOCAL_MACHINE)
+ Win32::Registry.send(:remove_const, "KEY_QUERY_VALUE") if defined?(Win32::Registry::KEY_QUERY_VALUE)
end
it "returns false early when not on windows" do
@@ -134,7 +134,7 @@ 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')
+ allow(Chef::Platform).to receive(:require).with("win32/registry")
expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).
with(key, access).
and_yield(registry)
@@ -143,7 +143,7 @@ describe "Chef::Platform#supports_msi?" do
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')
+ 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.")
@@ -152,12 +152,12 @@ describe "Chef::Platform#supports_msi?" do
end
describe 'Chef::Platform#supports_dsc?' do
- it 'returns false if powershell is not present' do
+ it "returns false if powershell is not present" do
node = Chef::Node.new
expect(Chef::Platform.supports_dsc?(node)).to be_falsey
end
- ['1.0', '2.0', '3.0'].each do |version|
+ ["1.0", "2.0", "3.0"].each do |version|
it "returns false for Powershell #{version}" do
node = Chef::Node.new
node.automatic[:languages][:powershell][:version] = version
@@ -165,7 +165,7 @@ describe 'Chef::Platform#supports_dsc?' do
end
end
- ['4.0', '5.0'].each do |version|
+ ["4.0", "5.0"].each do |version|
it "returns true for Powershell #{version}" do
node = Chef::Node.new
node.automatic[:languages][:powershell][:version] = version
@@ -175,12 +175,12 @@ describe 'Chef::Platform#supports_dsc?' do
end
describe 'Chef::Platform#supports_dsc_invoke_resource?' do
- it 'returns false if powershell is not present' 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|
+ ["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
@@ -196,16 +196,16 @@ describe 'Chef::Platform#supports_dsc_invoke_resource?' do
end
describe 'Chef::Platform#dsc_refresh_mode_disabled?' do
- let(:node) { instance_double('Chef::Node') }
- let(:cmdlet) { instance_double('Chef::Util::Powershell::Cmdlet') }
- let(:cmdlet_result) { instance_double('Chef::Util::Powershell::CmdletResult')}
+ let(:node) { instance_double("Chef::Node") }
+ let(:cmdlet) { instance_double("Chef::Util::Powershell::Cmdlet") }
+ 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(cmdlet).to receive(:run!).and_return(cmdlet_result)
- expect(cmdlet_result).to receive(:return_value).and_return({ 'RefreshMode' => 'Disabled' })
+ expect(cmdlet_result).to receive(:return_value).and_return({ "RefreshMode" => "Disabled" })
expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be true
end
@@ -214,7 +214,7 @@ describe 'Chef::Platform#dsc_refresh_mode_disabled?' do
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(cmdlet_result).to receive(:return_value).and_return({ "RefreshMode" => "LaLaLa" })
expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be false
end
end