diff options
author | Tim Smith <tsmith84@gmail.com> | 2021-10-22 12:15:33 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2021-10-22 12:15:33 -0700 |
commit | c8c5b3b41e42c43117256798094f95d3412029bb (patch) | |
tree | 46cef0c9c6bae1bbb0b914a0492408436af4be34 /spec | |
parent | 19c40fe13fe61ea7e5aff0fa17e8627100ef075c (diff) | |
download | chef-c8c5b3b41e42c43117256798094f95d3412029bb.tar.gz |
Fix all the string errorsexpeditor/chef/chefstyle_b5c712d298e240493020b8d5977f03172cc65e17
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec')
25 files changed, 143 insertions, 143 deletions
diff --git a/spec/functional/dsl/reboot_pending_spec.rb b/spec/functional/dsl/reboot_pending_spec.rb index 9ff3f5495c..a3b3b62e13 100644 --- a/spec/functional/dsl/reboot_pending_spec.rb +++ b/spec/functional/dsl/reboot_pending_spec.rb @@ -39,8 +39,8 @@ describe Chef::DSL::RebootPending, :windows_only do let(:reg_key) { nil } let(:original_set) { false } - describe 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations' do - let(:reg_key) { 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager' } + describe "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\PendingFileRenameOperations" do + let(:reg_key) { "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager" } let(:original_set) { registry.value_exists?(reg_key, { name: "PendingFileRenameOperations" }) } it "returns true if the registry value exists" do @@ -78,7 +78,7 @@ describe Chef::DSL::RebootPending, :windows_only do describe "when there is nothing to indicate a reboot is pending" do it "should return false" do - skip "reboot pending" if registry_value_exists?('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { name: "PendingFileRenameOperations" }) || + skip "reboot pending" if registry_value_exists?("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager", { name: "PendingFileRenameOperations" }) || registry_key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired') || registry_key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending') expect(recipe.reboot_pending?).to be_falsey diff --git a/spec/functional/dsl/registry_helper_spec.rb b/spec/functional/dsl/registry_helper_spec.rb index 9d043dd35f..47111ac726 100644 --- a/spec/functional/dsl/registry_helper_spec.rb +++ b/spec/functional/dsl/registry_helper_spec.rb @@ -24,7 +24,7 @@ describe Chef::Resource::RegistryKey, :windows_only do before(:all) do ::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root" ::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch" - ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root', Win32::Registry::KEY_ALL_ACCESS) do |reg| + ::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root", Win32::Registry::KEY_ALL_ACCESS) do |reg| reg["RootType1", Win32::Registry::REG_SZ] = "fibrous" reg.write("Roots", Win32::Registry::REG_MULTI_SZ, ["strong roots", "healthy tree"]) end diff --git a/spec/functional/resource/dsc_script_spec.rb b/spec/functional/resource/dsc_script_spec.rb index b22599266b..cd88200e1a 100644 --- a/spec/functional/resource/dsc_script_spec.rb +++ b/spec/functional/resource/dsc_script_spec.rb @@ -85,7 +85,7 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only, :ruby64_only d let(:dsc_test_resource_base) do Chef::Resource::DscScript.new(dsc_test_resource_name, dsc_test_run_context) end - let(:test_registry_key) { 'HKEY_LOCAL_MACHINE\Software\Chef\Spec\Functional\Resource\dsc_script_spec' } + let(:test_registry_key) { "HKEY_LOCAL_MACHINE\\Software\\Chef\\Spec\\Functional\\Resource\\dsc_script_spec" } let(:test_registry_value) { "Registration" } let(:test_registry_data1) { "LL927" } let(:test_registry_data2) { "LL928" } @@ -394,7 +394,7 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only, :ruby64_only d dsc_test_run_context.node.consume_external_attrs(OHAI_SYSTEM.data, {}) end - let(:configuration_data_path) { 'C:\\configurationdata.psd1' } + let(:configuration_data_path) { "C:\\configurationdata.psd1" } let(:self_signed_cert_path) do File.join(CHEF_SPEC_DATA, "dsc_lcm.pfx") diff --git a/spec/functional/resource/registry_spec.rb b/spec/functional/resource/registry_spec.rb index f3ad946f0e..77b73d941e 100644 --- a/spec/functional/resource/registry_spec.rb +++ b/spec/functional/resource/registry_spec.rb @@ -75,19 +75,19 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do def create_deletable_keys # create them both 32-bit and 64-bit [ 0x0100, 0x0200 ].each do |flag| - hive_class.create(key_parent + '\Opscode', Win32::Registry::KEY_WRITE | flag) - hive_class.open(key_parent + '\Opscode', Win32::Registry::KEY_ALL_ACCESS | flag) do |reg| + hive_class.create(key_parent + "\\Opscode", Win32::Registry::KEY_WRITE | flag) + hive_class.open(key_parent + "\\Opscode", Win32::Registry::KEY_ALL_ACCESS | flag) do |reg| reg["Color", Win32::Registry::REG_SZ] = "Orange" reg.write("Opscode", Win32::Registry::REG_MULTI_SZ, %w{Seattle Washington}) reg["AKA", Win32::Registry::REG_SZ] = "OC" end - hive_class.create(key_parent + '\ReportKey', Win32::Registry::KEY_WRITE | flag) - hive_class.open(key_parent + '\ReportKey', Win32::Registry::KEY_ALL_ACCESS | flag) do |reg| + hive_class.create(key_parent + "\\ReportKey", Win32::Registry::KEY_WRITE | flag) + hive_class.open(key_parent + "\\ReportKey", Win32::Registry::KEY_ALL_ACCESS | flag) do |reg| reg["ReportVal4", Win32::Registry::REG_SZ] = "report4" reg["ReportVal5", Win32::Registry::REG_SZ] = "report5" end - hive_class.create(key_parent + '\OpscodeWhyRun', Win32::Registry::KEY_WRITE | flag) - hive_class.open(key_parent + '\OpscodeWhyRun', Win32::Registry::KEY_ALL_ACCESS | flag) do |reg| + hive_class.create(key_parent + "\\OpscodeWhyRun", Win32::Registry::KEY_WRITE | flag) + hive_class.open(key_parent + "\\OpscodeWhyRun", Win32::Registry::KEY_ALL_ACCESS | flag) do |reg| reg["BriskWalk", Win32::Registry::REG_SZ] = "is good for health" end end @@ -188,13 +188,13 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do end it "creates subkey if parent exists" do - @new_resource.key(reg_child + '\OpscodeTest') + @new_resource.key(reg_child + "\\OpscodeTest") @new_resource.values([{ name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} }]) @new_resource.recursive(false) @new_resource.run_action(:create) - expect(@registry.key_exists?(reg_child + '\OpscodeTest')).to eq(true) - expect(@registry.value_exists?(reg_child + '\OpscodeTest', { name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} })).to eq(true) + expect(@registry.key_exists?(reg_child + "\\OpscodeTest")).to eq(true) + expect(@registry.value_exists?(reg_child + "\\OpscodeTest", { name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} })).to eq(true) end it "raises an error if action create and parent does not exist and recursive is set to false" do @@ -258,20 +258,20 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do @registry.architecture = :machine end it "creates a key in a 32-bit registry that is not viewable in 64-bit" do - @new_resource.key(reg_child + '\Atraxi' ) + @new_resource.key(reg_child + "\\Atraxi" ) @new_resource.values([{ name: "OC", type: :string, data: "Data" }]) @new_resource.recursive(true) @new_resource.architecture(:i386) @new_resource.run_action(:create) @registry.architecture = :i386 - expect(@registry.data_exists?(reg_child + '\Atraxi', { name: "OC", type: :string, data: "Data" })).to eq(true) + expect(@registry.data_exists?(reg_child + "\\Atraxi", { name: "OC", type: :string, data: "Data" })).to eq(true) @registry.architecture = :x86_64 - expect(@registry.key_exists?(reg_child + '\Atraxi')).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Atraxi")).to eq(false) end end it "prepares the reporting data for action :create" do - @new_resource.key(reg_child + '\Ood') + @new_resource.key(reg_child + "\\Ood") @new_resource.values([{ name: "ReportingVal1", type: :string, data: "report1" }, { name: "ReportingVal2", type: :string, data: "report2" }]) @new_resource.recursive(true) @new_resource.run_action(:create) @@ -280,7 +280,7 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do expect(@report["action"]).to eq("end") expect(@report["resources"][0]["type"]).to eq("registry_key") expect(@report["resources"][0]["name"]).to eq(resource_name) - expect(@report["resources"][0]["id"]).to eq(reg_child + '\Ood') + expect(@report["resources"][0]["id"]).to eq(reg_child + "\\Ood") expect(@report["resources"][0]["after"][:values]).to eq([{ name: "ReportingVal1", type: :string, data: "report1" }, { name: "ReportingVal2", type: :string, data: "report2" }]) expect(@report["resources"][0]["before"][:values]).to eq([]) @@ -295,48 +295,48 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do end it "does not raise an exception if the keys do not exist but recursive is set to false" do - @new_resource.key(reg_child + '\Slitheen\Raxicoricofallapatorius') + @new_resource.key(reg_child + "\\Slitheen\\Raxicoricofallapatorius") @new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }]) @new_resource.recursive(false) @new_resource.run_action(:create) # should not raise_error - expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false) - expect(@registry.key_exists?(reg_child + '\Slitheen\Raxicoricofallapatorius')).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Slitheen")).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Slitheen\\Raxicoricofallapatorius")).to eq(false) end it "does not create key if the action is create" do - @new_resource.key(reg_child + '\Slitheen') + @new_resource.key(reg_child + "\\Slitheen") @new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }]) @new_resource.recursive(false) @new_resource.run_action(:create) - expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Slitheen")).to eq(false) end it "does not raise an exception if the action create and type key missing in values hash" do - @new_resource.key(reg_child + '\Slitheen') + @new_resource.key(reg_child + "\\Slitheen") @new_resource.values([{ name: "BriskWalk", data: "my_data" }]) @new_resource.run_action(:create) # should not raise_error - expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Slitheen")).to eq(false) end it "does not raise an exception if the action create and data key missing in values hash" do - @new_resource.key(reg_child + '\Slitheen') + @new_resource.key(reg_child + "\\Slitheen") @new_resource.values([{ name: "BriskWalk", type: :string }]) @new_resource.run_action(:create) # should not raise_error - expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Slitheen")).to eq(false) end it "does not raise an exception if the action create and only name key present in values hash" do - @new_resource.key(reg_child + '\Slitheen') + @new_resource.key(reg_child + "\\Slitheen") @new_resource.values([{ name: "BriskWalk" }]) @new_resource.run_action(:create) # should not raise_error - expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Slitheen")).to eq(false) end it "does not raise an exception if the action create and all keys are present in values hash" do - @new_resource.key(reg_child + '\Slitheen') + @new_resource.key(reg_child + "\\Slitheen") @new_resource.values([{ name: "BriskWalk", type: :string, data: "my_data" }]) @new_resource.run_action(:create) # should not raise_error - expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Slitheen")).to eq(false) end end end @@ -374,17 +374,17 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do end it "creates subkey if parent exists" do - @new_resource.key(reg_child + '\Pyrovile') + @new_resource.key(reg_child + "\\Pyrovile") @new_resource.values([{ name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} }]) @new_resource.recursive(false) @new_resource.run_action(:create_if_missing) - expect(@registry.key_exists?(reg_child + '\Pyrovile')).to eq(true) - expect(@registry.value_exists?(reg_child + '\Pyrovile', { name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} })).to eq(true) + expect(@registry.key_exists?(reg_child + "\\Pyrovile")).to eq(true) + expect(@registry.value_exists?(reg_child + "\\Pyrovile", { name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} })).to eq(true) end it "raises an error if action create and parent does not exist and recursive is set to false" do - @new_resource.key(reg_child + '\Sontaran\Sontar') + @new_resource.key(reg_child + "\\Sontaran\\Sontar") @new_resource.values([{ name: "OC", type: :string, data: "MissingData" }]) @new_resource.recursive(false) expect { @new_resource.run_action(:create_if_missing) }.to raise_error(Chef::Exceptions::Win32RegNoRecursive) @@ -415,28 +415,28 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do end it "creates missing keys if action create and parent does not exist and recursive is set to true" do - @new_resource.key(reg_child + '\Sontaran\Sontar') + @new_resource.key(reg_child + "\\Sontaran\\Sontar") @new_resource.values([{ name: "OC", type: :string, data: "MissingData" }]) @new_resource.recursive(true) @new_resource.run_action(:create_if_missing) - expect(@registry.key_exists?(reg_child + '\Sontaran\Sontar')).to eq(true) - expect(@registry.value_exists?(reg_child + '\Sontaran\Sontar', { name: "OC", type: :string, data: "MissingData" })).to eq(true) + expect(@registry.key_exists?(reg_child + "\\Sontaran\\Sontar")).to eq(true) + expect(@registry.value_exists?(reg_child + "\\Sontaran\\Sontar", { name: "OC", type: :string, data: "MissingData" })).to eq(true) end it "creates key with multiple value as specified" do - @new_resource.key(reg_child + '\Adipose') + @new_resource.key(reg_child + "\\Adipose") @new_resource.values([{ name: "one", type: :string, data: "1" }, { name: "two", type: :string, data: "2" }, { name: "three", type: :string, data: "3" }]) @new_resource.recursive(true) @new_resource.run_action(:create_if_missing) @new_resource.each_value do |value| - expect(@registry.value_exists?(reg_child + '\Adipose', value)).to eq(true) + expect(@registry.value_exists?(reg_child + "\\Adipose", value)).to eq(true) end end it "prepares the reporting data for :create_if_missing" do - @new_resource.key(reg_child + '\Judoon') + @new_resource.key(reg_child + "\\Judoon") @new_resource.values([{ name: "ReportingVal3", type: :string, data: "report3" }]) @new_resource.recursive(true) @new_resource.run_action(:create_if_missing) @@ -445,7 +445,7 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do expect(@report["action"]).to eq("end") expect(@report["resources"][0]["type"]).to eq("registry_key") expect(@report["resources"][0]["name"]).to eq(resource_name) - expect(@report["resources"][0]["id"]).to eq(reg_child + '\Judoon') + expect(@report["resources"][0]["id"]).to eq(reg_child + "\\Judoon") expect(@report["resources"][0]["after"][:values]).to eq([{ name: "ReportingVal3", type: :string, data: "report3" }]) expect(@report["resources"][0]["before"][:values]).to eq([]) expect(@report["resources"][0]["result"]).to eq("create_if_missing") @@ -459,48 +459,48 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do end it "does not raise an exception if the keys do not exist but recursive is set to false" do - @new_resource.key(reg_child + '\Zygons\Zygor') + @new_resource.key(reg_child + "\\Zygons\\Zygor") @new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }]) @new_resource.recursive(false) @new_resource.run_action(:create_if_missing) # should not raise_error - expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false) - expect(@registry.key_exists?(reg_child + '\Zygons\Zygor')).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Zygons")).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Zygons\\Zygor")).to eq(false) end it "does nothing if the action is create_if_missing" do - @new_resource.key(reg_child + '\Zygons') + @new_resource.key(reg_child + "\\Zygons") @new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }]) @new_resource.recursive(false) @new_resource.run_action(:create_if_missing) - expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Zygons")).to eq(false) end it "does not raise an exception if the action create_if_missing and type key missing in values hash" do - @new_resource.key(reg_child + '\Zygons') + @new_resource.key(reg_child + "\\Zygons") @new_resource.values([{ name: "BriskWalk", data: "my_data" }]) @new_resource.run_action(:create_if_missing) # should not raise_error - expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Zygons")).to eq(false) end it "does not raise an exception if the action create_if_missing and data key missing in values hash" do - @new_resource.key(reg_child + '\Zygons') + @new_resource.key(reg_child + "\\Zygons") @new_resource.values([{ name: "BriskWalk", type: :string }]) @new_resource.run_action(:create_if_missing) # should not raise_error - expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Zygons")).to eq(false) end it "does not raise an exception if the action create_if_missing and only name key present in values hash" do - @new_resource.key(reg_child + '\Zygons') + @new_resource.key(reg_child + "\\Zygons") @new_resource.values([{ name: "BriskWalk" }]) @new_resource.run_action(:create_if_missing) # should not raise_error - expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Zygons")).to eq(false) end it "does not raise an exception if the action create_if_missing and all keys are present in values hash" do - @new_resource.key(reg_child + '\Zygons') + @new_resource.key(reg_child + "\\Zygons") @new_resource.values([{ name: "BriskWalk", type: :string, data: "my_data" }]) @new_resource.run_action(:create_if_missing) # should not raise_error - expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false) + expect(@registry.key_exists?(reg_child + "\\Zygons")).to eq(false) end end end @@ -512,61 +512,61 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do end it "takes no action if the specified key path does not exist in the system" do - expect(@registry.key_exists?(reg_parent + '\Osirian')).to eq(false) + expect(@registry.key_exists?(reg_parent + "\\Osirian")).to eq(false) - @new_resource.key(reg_parent + '\Osirian') + @new_resource.key(reg_parent + "\\Osirian") @new_resource.recursive(false) @new_resource.run_action(:delete) - expect(@registry.key_exists?(reg_parent + '\Osirian')).to eq(false) + expect(@registry.key_exists?(reg_parent + "\\Osirian")).to eq(false) end it "takes no action if the key exists but the value does not" do - expect(@registry.data_exists?(reg_parent + '\Opscode', { name: "Color", type: :string, data: "Orange" })).to eq(true) + expect(@registry.data_exists?(reg_parent + "\\Opscode", { name: "Color", type: :string, data: "Orange" })).to eq(true) - @new_resource.key(reg_parent + '\Opscode') + @new_resource.key(reg_parent + "\\Opscode") @new_resource.values([{ name: "LooksLike", type: :multi_string, data: %w{SeattleGrey OCOrange} }]) @new_resource.recursive(false) @new_resource.run_action(:delete) - expect(@registry.data_exists?(reg_parent + '\Opscode', { name: "Color", type: :string, data: "Orange" })).to eq(true) + expect(@registry.data_exists?(reg_parent + "\\Opscode", { name: "Color", type: :string, data: "Orange" })).to eq(true) end it "deletes only specified values under a key path" do - @new_resource.key(reg_parent + '\Opscode') + @new_resource.key(reg_parent + "\\Opscode") @new_resource.values([{ name: "Opscode", type: :multi_string, data: %w{Seattle Washington} }, { name: "AKA", type: :string, data: "OC" }]) @new_resource.recursive(false) @new_resource.run_action(:delete) - expect(@registry.data_exists?(reg_parent + '\Opscode', { name: "Color", type: :string, data: "Orange" })).to eq(true) - expect(@registry.value_exists?(reg_parent + '\Opscode', { name: "AKA", type: :string, data: "OC" })).to eq(false) - expect(@registry.value_exists?(reg_parent + '\Opscode', { name: "Opscode", type: :multi_string, data: %w{Seattle Washington} })).to eq(false) + expect(@registry.data_exists?(reg_parent + "\\Opscode", { name: "Color", type: :string, data: "Orange" })).to eq(true) + expect(@registry.value_exists?(reg_parent + "\\Opscode", { name: "AKA", type: :string, data: "OC" })).to eq(false) + expect(@registry.value_exists?(reg_parent + "\\Opscode", { name: "Opscode", type: :multi_string, data: %w{Seattle Washington} })).to eq(false) end it "it deletes the values with the same name irrespective of it type and data" do - @new_resource.key(reg_parent + '\Opscode') + @new_resource.key(reg_parent + "\\Opscode") @new_resource.values([{ name: "Color", type: :multi_string, data: %w{Black Orange} }]) @new_resource.recursive(false) @new_resource.run_action(:delete) - expect(@registry.value_exists?(reg_parent + '\Opscode', { name: "Color", type: :string, data: "Orange" })).to eq(false) + expect(@registry.value_exists?(reg_parent + "\\Opscode", { name: "Color", type: :string, data: "Orange" })).to eq(false) end it "prepares the reporting data for action :delete" do - @new_resource.key(reg_parent + '\ReportKey') + @new_resource.key(reg_parent + "\\ReportKey") @new_resource.values([{ name: "ReportVal4", type: :string, data: "report4" }, { name: "ReportVal5", type: :string, data: "report5" }]) @new_resource.recursive(true) @new_resource.run_action(:delete) @report = @resource_reporter.prepare_run_data - expect(@registry.value_exists?(reg_parent + '\ReportKey', [{ name: "ReportVal4", type: :string, data: "report4" }, { name: "ReportVal5", type: :string, data: "report5" }])).to eq(false) + expect(@registry.value_exists?(reg_parent + "\\ReportKey", [{ name: "ReportVal4", type: :string, data: "report4" }, { name: "ReportVal5", type: :string, data: "report5" }])).to eq(false) expect(@report["action"]).to eq("end") expect(@report["resources"].count).to eq(1) expect(@report["resources"][0]["type"]).to eq("registry_key") expect(@report["resources"][0]["name"]).to eq(resource_name) - expect(@report["resources"][0]["id"]).to eq(reg_parent + '\ReportKey') + expect(@report["resources"][0]["id"]).to eq(reg_parent + "\\ReportKey") expect(@report["resources"][0]["before"][:values]).to eq([{ name: "ReportVal4", type: :string, data: "report4" }, { name: "ReportVal5", type: :string, data: "report5" }]) # Not testing for after values to match since after -> new_resource values. @@ -580,12 +580,12 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do Chef::Config[:why_run] = true end it "does nothing if the action is delete" do - @new_resource.key(reg_parent + '\OpscodeWhyRun') + @new_resource.key(reg_parent + "\\OpscodeWhyRun") @new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }]) @new_resource.recursive(false) @new_resource.run_action(:delete) - expect(@registry.key_exists?(reg_parent + '\OpscodeWhyRun')).to eq(true) + expect(@registry.key_exists?(reg_parent + "\\OpscodeWhyRun")).to eq(true) end end end @@ -597,21 +597,21 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do end it "takes no action if the specified key path does not exist in the system" do - expect(@registry.key_exists?(reg_parent + '\Osirian')).to eq(false) + expect(@registry.key_exists?(reg_parent + "\\Osirian")).to eq(false) - @new_resource.key(reg_parent + '\Osirian') + @new_resource.key(reg_parent + "\\Osirian") @new_resource.recursive(false) @new_resource.run_action(:delete_key) - expect(@registry.key_exists?(reg_parent + '\Osirian')).to eq(false) + expect(@registry.key_exists?(reg_parent + "\\Osirian")).to eq(false) end it "deletes key if it has no subkeys and recursive == false" do - @new_resource.key(reg_parent + '\OpscodeTest') + @new_resource.key(reg_parent + "\\OpscodeTest") @new_resource.recursive(false) @new_resource.run_action(:delete_key) - expect(@registry.key_exists?(reg_parent + '\OpscodeTest')).to eq(false) + expect(@registry.key_exists?(reg_parent + "\\OpscodeTest")).to eq(false) end it "raises an exception if the key has subkeys and recursive == false" do @@ -621,22 +621,22 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do end it "ignores the values under a key" do - @new_resource.key(reg_parent + '\OpscodeIgnoredValues') + @new_resource.key(reg_parent + "\\OpscodeIgnoredValues") # @new_resource.values([{:name=>"DontExist", :type=>:string, :data=>"These will be ignored anyways"}]) @new_resource.recursive(true) @new_resource.run_action(:delete_key) end it "deletes the key if it has subkeys and recursive == true" do - @new_resource.key(reg_parent + '\Opscode') + @new_resource.key(reg_parent + "\\Opscode") @new_resource.recursive(true) @new_resource.run_action(:delete_key) - expect(@registry.key_exists?(reg_parent + '\Opscode')).to eq(false) + expect(@registry.key_exists?(reg_parent + "\\Opscode")).to eq(false) end it "prepares the reporting data for action :delete_key" do - @new_resource.key(reg_parent + '\ReportKey') + @new_resource.key(reg_parent + "\\ReportKey") @new_resource.recursive(true) @new_resource.run_action(:delete_key) @@ -644,7 +644,7 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do expect(@report["action"]).to eq("end") expect(@report["resources"][0]["type"]).to eq("registry_key") expect(@report["resources"][0]["name"]).to eq(resource_name) - expect(@report["resources"][0]["id"]).to eq(reg_parent + '\ReportKey') + expect(@report["resources"][0]["id"]).to eq(reg_parent + "\\ReportKey") # Not testing for before or after values to match since # after -> new_resource.values and # before -> current_resource.values @@ -658,18 +658,18 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do end it "does not throw an exception if the key has subkeys but recursive is set to false" do - @new_resource.key(reg_parent + '\OpscodeWhyRun') + @new_resource.key(reg_parent + "\\OpscodeWhyRun") @new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }]) @new_resource.recursive(false) @new_resource.run_action(:delete_key) end it "does nothing if the action is delete_key" do - @new_resource.key(reg_parent + '\OpscodeWhyRun') + @new_resource.key(reg_parent + "\\OpscodeWhyRun") @new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }]) @new_resource.recursive(false) @new_resource.run_action(:delete_key) - expect(@registry.key_exists?(reg_parent + '\OpscodeWhyRun')).to eq(true) + expect(@registry.key_exists?(reg_parent + "\\OpscodeWhyRun")).to eq(true) end end end diff --git a/spec/functional/win32/registry_spec.rb b/spec/functional/win32/registry_spec.rb index 2b371ee9ed..5f7f39e8d6 100644 --- a/spec/functional/win32/registry_spec.rb +++ b/spec/functional/win32/registry_spec.rb @@ -28,14 +28,14 @@ describe "Chef::Win32::Registry", :windows_only do ::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch" ::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\BĀ®anch" ::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch\\Flower" - ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root', Win32::Registry::KEY_ALL_ACCESS) do |reg| + ::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root", Win32::Registry::KEY_ALL_ACCESS) do |reg| reg["RootType1", Win32::Registry::REG_SZ] = "fibrous" reg.write("Roots", Win32::Registry::REG_MULTI_SZ, ["strong roots", "healthy tree"]) end - ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Branch', Win32::Registry::KEY_ALL_ACCESS) do |reg| + ::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root\\Branch", Win32::Registry::KEY_ALL_ACCESS) do |reg| reg["Strong", Win32::Registry::REG_SZ] = "bird nest" end - ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Branch\\Flower', Win32::Registry::KEY_ALL_ACCESS) do |reg| + ::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root\\Branch\\Flower", Win32::Registry::KEY_ALL_ACCESS) do |reg| reg["Petals", Win32::Registry::REG_MULTI_SZ] = %w{Pink Delicate} end @@ -297,7 +297,7 @@ describe "Chef::Win32::Registry", :windows_only do describe "delete_value" do before(:all) do ::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Trunk\\Peck\\Woodpecker" - ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Trunk\\Peck\\Woodpecker', Win32::Registry::KEY_ALL_ACCESS) do |reg| + ::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root\\Trunk\\Peck\\Woodpecker", Win32::Registry::KEY_ALL_ACCESS) do |reg| reg["Peter", Win32::Registry::REG_SZ] = "Tiny" end end @@ -324,11 +324,11 @@ describe "Chef::Win32::Registry", :windows_only do describe "delete_key" do before(:all) do ::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch\\Fruit" - ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Branch\\Fruit', Win32::Registry::KEY_ALL_ACCESS) do |reg| + ::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root\\Branch\\Fruit", Win32::Registry::KEY_ALL_ACCESS) do |reg| reg["Apple", Win32::Registry::REG_MULTI_SZ] = %w{Red Juicy} end ::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Trunk\\Peck\\Woodpecker" - ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Trunk\\Peck\\Woodpecker', Win32::Registry::KEY_ALL_ACCESS) do |reg| + ::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root\\Trunk\\Peck\\Woodpecker", Win32::Registry::KEY_ALL_ACCESS) do |reg| reg["Peter", Win32::Registry::REG_SZ] = "Tiny" end end @@ -519,12 +519,12 @@ describe "Chef::Win32::Registry", :windows_only do end # 64-bit ::Win32::Registry::HKEY_LOCAL_MACHINE.create("Software\\Root\\Mauve", ::Win32::Registry::KEY_ALL_ACCESS | 0x0100) - ::Win32::Registry::HKEY_LOCAL_MACHINE.open('Software\\Root\\Mauve', Win32::Registry::KEY_ALL_ACCESS | 0x0100) do |reg| + ::Win32::Registry::HKEY_LOCAL_MACHINE.open("Software\\Root\\Mauve", Win32::Registry::KEY_ALL_ACCESS | 0x0100) do |reg| reg["Alert", Win32::Registry::REG_SZ] = "Universal" end # 32-bit ::Win32::Registry::HKEY_LOCAL_MACHINE.create("Software\\Root\\Poosh", ::Win32::Registry::KEY_ALL_ACCESS | 0x0200) - ::Win32::Registry::HKEY_LOCAL_MACHINE.open('Software\\Root\\Poosh', Win32::Registry::KEY_ALL_ACCESS | 0x0200) do |reg| + ::Win32::Registry::HKEY_LOCAL_MACHINE.open("Software\\Root\\Poosh", Win32::Registry::KEY_ALL_ACCESS | 0x0200) do |reg| reg["Status", Win32::Registry::REG_SZ] = "Lost" end end diff --git a/spec/unit/dsl/reboot_pending_spec.rb b/spec/unit/dsl/reboot_pending_spec.rb index 90945c3b80..3156d31e7e 100644 --- a/spec/unit/dsl/reboot_pending_spec.rb +++ b/spec/unit/dsl/reboot_pending_spec.rb @@ -36,7 +36,7 @@ describe Chef::DSL::RebootPending do end it 'should return true if "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations" exists' do - allow(recipe).to receive(:registry_value_exists?).with('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { name: "PendingFileRenameOperations" }).and_return(true) + allow(recipe).to receive(:registry_value_exists?).with("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager", { name: "PendingFileRenameOperations" }).and_return(true) expect(recipe.reboot_pending?).to be_truthy end diff --git a/spec/unit/mixin/default_paths_spec.rb b/spec/unit/mixin/default_paths_spec.rb index 0224b8f4ce..6d16cc6f6c 100644 --- a/spec/unit/mixin/default_paths_spec.rb +++ b/spec/unit/mixin/default_paths_spec.rb @@ -84,7 +84,7 @@ describe Chef::Mixin::DefaultPaths do allow(Gem).to receive(:bindir).and_return(gem_bindir) allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return(ruby_bindir) allow(ChefUtils).to receive(:windows?).and_return(true) - env = { "PATH" => 'C:\Windows\system32;C:\mr\softie' } + env = { "PATH" => "C:\\Windows\\system32;C:\\mr\\softie" } @default_paths.enforce_default_paths(env) expect(env["PATH"]).to eq("#{gem_bindir};#{ruby_bindir};C:\\Windows\\system32;C:\\mr\\softie") end diff --git a/spec/unit/mixin/securable_spec.rb b/spec/unit/mixin/securable_spec.rb index bbbd6bab84..b672dc19f5 100644 --- a/spec/unit/mixin/securable_spec.rb +++ b/spec/unit/mixin/securable_spec.rb @@ -53,8 +53,8 @@ describe Chef::Mixin::Securable do end it "should accept group/owner names with spaces and backslashes" do - expect { @securable.group 'test\ group' }.not_to raise_error - expect { @securable.owner 'test\ group' }.not_to raise_error + expect { @securable.group "test\\ group" }.not_to raise_error + expect { @securable.owner "test\\ group" }.not_to raise_error end it "should accept group/owner names that are a single character or digit" do @@ -186,7 +186,7 @@ describe Chef::Mixin::Securable do end it "should not accept a group name or id for group with spaces and multiple backslashes" do - expect { @securable.group 'test\ \group' }.to raise_error(ArgumentError) + expect { @securable.group "test\\ \\group" }.to raise_error(ArgumentError) end it "should accept a unix file mode in string form as an octal number" do diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb index 5013b6505c..6ef63d3961 100644 --- a/spec/unit/provider/package/rubygems_spec.rb +++ b/spec/unit/provider/package/rubygems_spec.rb @@ -503,11 +503,11 @@ describe Chef::Provider::Package::Rubygems do platform_mock :windows do allow(ENV).to receive(:[]).with("PATH").and_return('C:\windows\system32;C:\windows;C:\Ruby186\bin') allow(ENV).to receive(:[]).with("PATHEXT").and_return(nil) - allow(File).to receive(:executable?).with('C:\\windows\\system32/gem').and_return(false) - allow(File).to receive(:executable?).with('C:\\windows/gem').and_return(false) - allow(File).to receive(:executable?).with('C:\\Ruby186\\bin/gem').and_return(true) - allow(File).to receive(:executable?).with('d:\\opscode\\chef\\bin/gem').and_return(false) # should not get here - allow(File).to receive(:executable?).with('d:\\opscode\\chef\\bin/gem').and_return(false) # should not get here + allow(File).to receive(:executable?).with("C:\\windows\\system32/gem").and_return(false) + allow(File).to receive(:executable?).with("C:\\windows/gem").and_return(false) + allow(File).to receive(:executable?).with("C:\\Ruby186\\bin/gem").and_return(true) + allow(File).to receive(:executable?).with("d:\\opscode\\chef\\bin/gem").and_return(false) # should not get here + allow(File).to receive(:executable?).with("d:\\opscode\\chef\\bin/gem").and_return(false) # should not get here allow(File).to receive(:executable?).with("d:/opscode/chef/embedded/bin/gem").and_return(false) # should not get here expect(provider.gem_env.gem_binary_location).to eq('C:\Ruby186\bin/gem') end diff --git a/spec/unit/provider/package/windows_spec.rb b/spec/unit/provider/package/windows_spec.rb index 6531d9c5ec..29ca8ce521 100644 --- a/spec/unit/provider/package/windows_spec.rb +++ b/spec/unit/provider/package/windows_spec.rb @@ -39,7 +39,7 @@ describe Chef::Provider::Package::Windows, :windows_only do new_resource end let(:provider) { Chef::Provider::Package::Windows.new(new_resource, run_context) } - let(:cache_path) { 'c:\\cache\\' } + let(:cache_path) { "c:\\cache\\" } before(:each) do allow(::File).to receive(:exist?).with(new_resource.source).and_return(true) diff --git a/spec/unit/provider/registry_key_spec.rb b/spec/unit/provider/registry_key_spec.rb index fe643a0ec3..76f039a9b9 100644 --- a/spec/unit/provider/registry_key_spec.rb +++ b/spec/unit/provider/registry_key_spec.rb @@ -274,7 +274,7 @@ describe Chef::Provider::RegistryKey do end context "when the key data is safe" do - let(:keyname) { 'HKLM\Software\Opscode\Testing\Safe' } + let(:keyname) { "HKLM\\Software\\Opscode\\Testing\\Safe" } let(:testval1) { { name: "one", type: :string, data: "1" } } let(:testval1_wrong_type) { { name: "one", type: :multi_string, data: "1" } } let(:testval1_wrong_data) { { name: "one", type: :string, data: "2" } } @@ -295,7 +295,7 @@ describe Chef::Provider::RegistryKey do describe "action_create" do context "when key exists and type matches" do - let(:keyname) { 'hklm\\software\\opscode\\testing\\dword' } + let(:keyname) { "hklm\\software\\opscode\\testing\\dword" } let(:dword_passed_as_integer) { { name: "one", type: :dword, data: 12345 } } let(:testval1) { { name: "one", type: :dword, data: "12345" } } before do @@ -349,7 +349,7 @@ describe Chef::Provider::RegistryKey do end context "and key does not exist" do - let(:keyname) { 'hklm\\software\\opscode\\testing\\sensitive\missing' } + let(:keyname) { "hklm\\software\\opscode\\testing\\sensitive\\missing" } let(:testval1) { { name: "one", type: :string, data: "first_value" } } before(:each) do @@ -368,7 +368,7 @@ describe Chef::Provider::RegistryKey do describe "action_create_if_missing" do context "when sensitive is true" do - let(:keyname) { 'hklm\\software\\opscode\\testing\\create_if_missing\\sensitive' } + let(:keyname) { "hklm\\software\\opscode\\testing\\create_if_missing\\sensitive" } let(:testval1) { { name: "one", type: :string, data: "first_value" } } before(:each) do diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb index 08d4b2a620..2186298143 100644 --- a/spec/unit/provider/service/windows_spec.rb +++ b/spec/unit/provider/service/windows_spec.rb @@ -33,7 +33,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do # Actual response from Win32::Service.config_info('chef-client') let(:chef_service_binary_path_name) do - 'C:\\opscode\\chef\\embedded\\bin\\ruby.exe C:\\opscode\\chef\\bin\\chef-windows-service' + "C:\\opscode\\chef\\embedded\\bin\\ruby.exe C:\\opscode\\chef\\bin\\chef-windows-service" end let(:chef_service_config_info) do double("Struct::ServiceConfigInfo", @@ -153,11 +153,11 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do service_type: "share process", start_type: "demand start", error_control: "normal", - binary_path_name: 'C:\\Windows\\system32\\svchost.exe -k LocalServiceNetworkRestricted', + binary_path_name: "C:\\Windows\\system32\\svchost.exe -k LocalServiceNetworkRestricted", load_order_group: "TDI", tag_id: 0, dependencies: %w{NSI Tdx Afd}, - service_start_name: 'NT Authority\\LocalService', + service_start_name: "NT Authority\\LocalService", display_name: "DHCP Client") ) end @@ -169,11 +169,11 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do service_type: "share process", start_type: "demand start", error_control: "normal", - binary_path_name: 'C:\\Windows\\system32\\svchost.exe -k LocalServiceNetworkRestricted', + binary_path_name: "C:\\Windows\\system32\\svchost.exe -k LocalServiceNetworkRestricted", load_order_group: "TDI", tag_id: 0, dependencies: %w{NSI Tdx Afd}, - service_start_name: 'NT Authority\\LocalService', + service_start_name: "NT Authority\\LocalService", display_name: "DHCP Client") ) end diff --git a/spec/unit/provider/windows_env_spec.rb b/spec/unit/provider/windows_env_spec.rb index 7f64622d20..eb3f65713f 100644 --- a/spec/unit/provider/windows_env_spec.rb +++ b/spec/unit/provider/windows_env_spec.rb @@ -358,7 +358,7 @@ describe "windows_env provider", :windows_only do context "when environment is PATH" do describe "for PATH" do let(:system_root) { "%SystemRoot%" } - let(:system_root_value) { 'D:\Windows' } + let(:system_root_value) { "D:\\Windows" } let(:new_resource) do new_resource = Chef::Resource::WindowsEnv.new("PATH", run_context) new_resource.value(system_root) diff --git a/spec/unit/provider/zypper_repository_spec.rb b/spec/unit/provider/zypper_repository_spec.rb index 2cf4ed99c8..6b09c7bc9f 100644 --- a/spec/unit/provider/zypper_repository_spec.rb +++ b/spec/unit/provider/zypper_repository_spec.rb @@ -103,7 +103,7 @@ describe Chef::Provider::ZypperRepository do describe "#escaped_repo_name" do it "returns an escaped repo name" do - expect(provider.escaped_repo_name).to eq('Nginx\\ Repository') + expect(provider.escaped_repo_name).to eq("Nginx\\ Repository") end end diff --git a/spec/unit/resource/chocolatey_config_spec.rb b/spec/unit/resource/chocolatey_config_spec.rb index 8c4ebfaecf..0a37654b4e 100644 --- a/spec/unit/resource/chocolatey_config_spec.rb +++ b/spec/unit/resource/chocolatey_config_spec.rb @@ -41,7 +41,7 @@ describe Chef::Resource::ChocolateyConfig do # we save off the ENV and set ALLUSERSPROFILE so these specs will work on *nix and non-C drive Windows installs before(:each) do @original_env = ENV.to_hash - ENV["ALLUSERSPROFILE"] = 'C:\ProgramData' + ENV["ALLUSERSPROFILE"] = "C:\\ProgramData" end after(:each) do diff --git a/spec/unit/resource/chocolatey_feature_spec.rb b/spec/unit/resource/chocolatey_feature_spec.rb index 0a3ec8e314..0ad2bc4039 100644 --- a/spec/unit/resource/chocolatey_feature_spec.rb +++ b/spec/unit/resource/chocolatey_feature_spec.rb @@ -41,7 +41,7 @@ describe Chef::Resource::ChocolateyFeature do # we save off the ENV and set ALLUSERSPROFILE so these specs will work on *nix and non-C drive Windows installs before(:each) do @original_env = ENV.to_hash - ENV["ALLUSERSPROFILE"] = 'C:\ProgramData' + ENV["ALLUSERSPROFILE"] = "C:\\ProgramData" end after(:each) do diff --git a/spec/unit/resource/chocolatey_source_spec.rb b/spec/unit/resource/chocolatey_source_spec.rb index d0066d3ccb..1e9a1001a5 100644 --- a/spec/unit/resource/chocolatey_source_spec.rb +++ b/spec/unit/resource/chocolatey_source_spec.rb @@ -54,7 +54,7 @@ describe Chef::Resource::ChocolateySource do allow(resource).to receive(:provider_for_action).and_return(enable_provider) allow(resource.class).to receive(:new).and_return(current_resource) @original_env = ENV.to_hash - ENV["ALLUSERSPROFILE"] = 'C:\ProgramData' + ENV["ALLUSERSPROFILE"] = "C:\\ProgramData" end after(:each) do diff --git a/spec/unit/resource/registry_key_spec.rb b/spec/unit/resource/registry_key_spec.rb index 86bd41ef92..e52c7843c7 100644 --- a/spec/unit/resource/registry_key_spec.rb +++ b/spec/unit/resource/registry_key_spec.rb @@ -19,14 +19,14 @@ require "spec_helper" describe Chef::Resource::RegistryKey, "initialize" do - let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') } + let(:resource) { Chef::Resource::RegistryKey.new("HKCU\\Software\\Raxicoricofallapatorius") } it "sets the resource_name to :registry_key" do expect(resource.resource_name).to eql(:registry_key) end it "the key property is the name_property" do - expect(resource.key).to eql('HKCU\Software\Raxicoricofallapatorius') + expect(resource.key).to eql("HKCU\\Software\\Raxicoricofallapatorius") end it "sets the default action as :create" do @@ -60,11 +60,11 @@ describe Chef::Resource::RegistryKey, "initialize" do end describe Chef::Resource::RegistryKey, "key" do - let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') } + let(:resource) { Chef::Resource::RegistryKey.new("HKCU\\Software\\Raxicoricofallapatorius") } it "allows a string" do - resource.key 'HKCU\Software\Poosh' - expect(resource.key).to eql('HKCU\Software\Poosh') + resource.key "HKCU\\Software\\Poosh" + expect(resource.key).to eql("HKCU\\Software\\Poosh") end it "does not allow an integer" do @@ -77,7 +77,7 @@ describe Chef::Resource::RegistryKey, "key" do end describe Chef::Resource::RegistryKey, "values" do - let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') } + let(:resource) { Chef::Resource::RegistryKey.new("HKCU\\Software\\Raxicoricofallapatorius") } it "allows a single proper hash of registry values" do resource.values( { name: "poosh", type: :string, data: "carmen" } ) @@ -140,7 +140,7 @@ describe Chef::Resource::RegistryKey, "values" do end describe Chef::Resource::RegistryKey, "recursive" do - let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') } + let(:resource) { Chef::Resource::RegistryKey.new("HKCU\\Software\\Raxicoricofallapatorius") } it "allows a boolean" do resource.recursive(true) @@ -165,7 +165,7 @@ describe Chef::Resource::RegistryKey, "recursive" do end describe Chef::Resource::RegistryKey, "architecture" do - let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') } + let(:resource) { Chef::Resource::RegistryKey.new("HKCU\\Software\\Raxicoricofallapatorius") } %i{i386 x86_64 machine}.each do |arch| it "allows #{arch} as a symbol" do @@ -196,7 +196,7 @@ describe Chef::Resource::RegistryKey, "architecture" do end describe Chef::Resource::RegistryKey, ":unscrubbed_values" do - let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') } + let(:resource) { Chef::Resource::RegistryKey.new("HKCU\\Software\\Raxicoricofallapatorius") } it "returns unsafe data as-is" do key_values = [ { name: "poosh", type: :binary, data: 255.chr * 1 } ] @@ -206,7 +206,7 @@ describe Chef::Resource::RegistryKey, ":unscrubbed_values" do end describe Chef::Resource::RegistryKey, "state" do - let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') } + let(:resource) { Chef::Resource::RegistryKey.new("HKCU\\Software\\Raxicoricofallapatorius") } it "returns scrubbed values" do resource.values([ { name: "poosh", type: :binary, data: 255.chr * 1 } ]) diff --git a/spec/unit/resource/windows_auto_run_spec.rb b/spec/unit/resource/windows_auto_run_spec.rb index 2e9f4a4f33..8d9a8aac96 100644 --- a/spec/unit/resource/windows_auto_run_spec.rb +++ b/spec/unit/resource/windows_auto_run_spec.rb @@ -45,6 +45,6 @@ describe Chef::Resource::WindowsAutorun do it "coerces forward slashes to backslashes for the path" do resource.path "C:/something.exe" - expect(resource.path).to eql('C:\\something.exe') + expect(resource.path).to eql("C:\\something.exe") end end diff --git a/spec/unit/resource/windows_feature_powershell_spec.rb b/spec/unit/resource/windows_feature_powershell_spec.rb index 5b4062f34c..09e9018cf9 100644 --- a/spec/unit/resource/windows_feature_powershell_spec.rb +++ b/spec/unit/resource/windows_feature_powershell_spec.rb @@ -76,7 +76,7 @@ describe Chef::Resource::WindowsFeaturePowershell do node.default["powershell_features_cache"]["disabled"] = ["dhcp"] node.default["powershell_features_cache"]["removed"] = ["snmp"] resource.feature_name "dhcp, snmp" - resource.source 'D:\\sources\\sxs' + resource.source "D:\\sources\\sxs" expect(provider.features_to_install).to eq(%w{dhcp snmp}) end diff --git a/spec/unit/resource/windows_firewall_rule_spec.rb b/spec/unit/resource/windows_firewall_rule_spec.rb index d73e7d222a..d3feea7c0a 100644 --- a/spec/unit/resource/windows_firewall_rule_spec.rb +++ b/spec/unit/resource/windows_firewall_rule_spec.rb @@ -377,7 +377,7 @@ describe Chef::Resource::WindowsFirewallRule do resource.icmp_type("Any") resource.firewall_action(:notconfigured) resource.profile(:domain) - resource.program('%WINDIR%\System32\lsass.exe') + resource.program("%WINDIR%\\System32\\lsass.exe") resource.service("SomeService") resource.interface_type(:remoteaccess) resource.enabled(false) @@ -499,7 +499,7 @@ describe Chef::Resource::WindowsFirewallRule do resource.icmp_type("Any") resource.firewall_action(:notconfigured) resource.profile(:domain) - resource.program('%WINDIR%\System32\lsass.exe') + resource.program("%WINDIR%\\System32\\lsass.exe") resource.service("SomeService") resource.interface_type(:remoteaccess) resource.enabled(false) diff --git a/spec/unit/resource/windows_task_spec.rb b/spec/unit/resource/windows_task_spec.rb index b991cb89de..8b29e773b6 100644 --- a/spec/unit/resource/windows_task_spec.rb +++ b/spec/unit/resource/windows_task_spec.rb @@ -75,7 +75,7 @@ describe Chef::Resource::WindowsTask, :windows_only do context "a System User" do before do resource.frequency :hourly - resource.user 'NT AUTHORITY\SYSTEM' + resource.user "NT AUTHORITY\\SYSTEM" end context "for an interactive task" do @@ -88,7 +88,7 @@ describe Chef::Resource::WindowsTask, :windows_only do expect { resource.after_created }.to raise_error(ArgumentError, "Password is not required for system users.") end it "does not raises an error even when user is in lowercase" do - resource.user 'nt authority\system' + resource.user "nt authority\\system" expect { resource.after_created }.to_not raise_error end end @@ -103,7 +103,7 @@ describe Chef::Resource::WindowsTask, :windows_only do expect { resource.after_created }.to raise_error(ArgumentError, "Password is not required for system users.") end it "does not raises an error even when user is in lowercase" do - resource.user 'nt authority\system' + resource.user "nt authority\\system" expect { resource.after_created }.to_not raise_error end end diff --git a/spec/unit/resource_reporter_spec.rb b/spec/unit/resource_reporter_spec.rb index 69d5b28e7e..cea866cb17 100644 --- a/spec/unit/resource_reporter_spec.rb +++ b/spec/unit/resource_reporter_spec.rb @@ -494,7 +494,7 @@ describe Chef::ResourceReporter do context "when the resource is a RegistryKey with binary data" do let(:new_resource) do - resource = Chef::Resource::RegistryKey.new('Wubba\Lubba\Dub\Dubs') + resource = Chef::Resource::RegistryKey.new("Wubba\\Lubba\\Dub\\Dubs") resource.values([ { name: "rick", type: :binary, data: 255.chr * 1 } ]) allow(resource).to receive(:cookbook_name).and_return(cookbook_name) allow(resource).to receive(:cookbook_version).and_return(cookbook_version) @@ -502,7 +502,7 @@ describe Chef::ResourceReporter do end let(:current_resource) do - resource = Chef::Resource::RegistryKey.new('Wubba\Lubba\Dub\Dubs') + resource = Chef::Resource::RegistryKey.new("Wubba\\Lubba\\Dub\\Dubs") resource.values([ { name: "rick", type: :binary, data: 255.chr * 1 } ]) resource end diff --git a/spec/unit/util/backup_spec.rb b/spec/unit/util/backup_spec.rb index 1db64d3029..d7a57dce1a 100644 --- a/spec/unit/util/backup_spec.rb +++ b/spec/unit/util/backup_spec.rb @@ -132,7 +132,7 @@ describe Chef::Util::Backup do end it "uses the configured Chef::Config[:file_backup_path] and strips the drive on windows" do - expect(@backup).to receive(:path).and_return('c:\\a\\b\\c.txt') + expect(@backup).to receive(:path).and_return("c:\\a\\b\\c.txt") Chef::Config[:file_backup_path] = 'c:\backupdir' expect(@backup.send(:backup_path)).to match(%r|^c:\\backupdir[\\/]+a\\b\\c.txt.chef-\d{14}.\d{6}$|) end diff --git a/spec/unit/win32/registry_spec.rb b/spec/unit/win32/registry_spec.rb index 124765129b..992c5d99e2 100644 --- a/spec/unit/win32/registry_spec.rb +++ b/spec/unit/win32/registry_spec.rb @@ -23,12 +23,12 @@ describe Chef::Win32::Registry do let(:value1) { { name: "one", type: :string, data: "1" } } let(:value1_upcase_name) { { name: "ONE", type: :string, data: "1" } } - let(:key_path) { 'HKCU\Software\OpscodeNumbers' } - let(:key) { 'Software\OpscodeNumbers' } + let(:key_path) { "HKCU\\Software\\OpscodeNumbers" } + let(:key) { "Software\\OpscodeNumbers" } let(:key_parent) { "Software" } let(:key_to_delete) { "OpscodeNumbers" } let(:sub_key) { "OpscodePrimes" } - let(:missing_key_path) { 'HKCU\Software' } + let(:missing_key_path) { "HKCU\\Software" } let(:registry) { Chef::Win32::Registry.new } let(:hive_mock) { double("::Win32::Registry::HKEY_CURRENT_USER") } let(:reg_mock) { double("reg") } |