summaryrefslogtreecommitdiff
path: root/chef-config
diff options
context:
space:
mode:
authorLamont Granquist <454857+lamont-granquist@users.noreply.github.com>2021-10-25 15:07:05 -0700
committerGitHub <noreply@github.com>2021-10-25 15:07:05 -0700
commitef8aed886b6ad963cdd62d2873e7dfaca2bc8bbb (patch)
tree66e1d9ebced90cb0c8252bcd1b4d661c0ae40c13 /chef-config
parent44b787ce503c55d2ea91d2d115f75eda6653f541 (diff)
parentc8c5b3b41e42c43117256798094f95d3412029bb (diff)
downloadchef-ef8aed886b6ad963cdd62d2873e7dfaca2bc8bbb.tar.gz
Merge pull request #12204 from chef/expeditor/chef/chefstyle_b5c712d298e240493020b8d5977f03172cc65e17
Diffstat (limited to 'chef-config')
-rw-r--r--chef-config/lib/chef-config/fips.rb2
-rw-r--r--chef-config/lib/chef-config/path_helper.rb2
-rw-r--r--chef-config/spec/unit/fips_spec.rb2
-rw-r--r--chef-config/spec/unit/path_helper_spec.rb32
4 files changed, 19 insertions, 19 deletions
diff --git a/chef-config/lib/chef-config/fips.rb b/chef-config/lib/chef-config/fips.rb
index eb9e55afe6..18bd3f512e 100644
--- a/chef-config/lib/chef-config/fips.rb
+++ b/chef-config/lib/chef-config/fips.rb
@@ -39,7 +39,7 @@ module ChefConfig
Win32::Registry::KEY_READ
end
begin
- Win32::Registry::HKEY_LOCAL_MACHINE.open('System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy', reg_type) do |policy|
+ Win32::Registry::HKEY_LOCAL_MACHINE.open("System\\CurrentControlSet\\Control\\Lsa\\FIPSAlgorithmPolicy", reg_type) do |policy|
policy["Enabled"] != 0
end
rescue Win32::Registry::Error
diff --git a/chef-config/lib/chef-config/path_helper.rb b/chef-config/lib/chef-config/path_helper.rb
index adacade391..734dc35635 100644
--- a/chef-config/lib/chef-config/path_helper.rb
+++ b/chef-config/lib/chef-config/path_helper.rb
@@ -335,7 +335,7 @@ module ChefConfig
line.scan(/\s*(?>([^\s\\"]+|"([^"]*)"|'([^']*)')|(\S))(\s|\z)?/m) do |word, within_dq, within_sq, esc, sep|
# Append the string with Word & Escape Character
- field << (word || esc.gsub(/\\(.)/, '\\1'))
+ field << (word || esc.gsub(/\\(.)/, "\\1"))
# Re-build the field when any whitespace character or
# End of string is encountered
diff --git a/chef-config/spec/unit/fips_spec.rb b/chef-config/spec/unit/fips_spec.rb
index 4be6f64a2d..dd8b3e17d1 100644
--- a/chef-config/spec/unit/fips_spec.rb
+++ b/chef-config/spec/unit/fips_spec.rb
@@ -65,7 +65,7 @@ RSpec.describe "ChefConfig.fips?" do
end
context "on windows", :windows_only do
- let(:fips_key) { 'System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy' }
+ let(:fips_key) { "System\\CurrentControlSet\\Control\\Lsa\\FIPSAlgorithmPolicy" }
let(:win_reg_entry) { { "Enabled" => enabled } }
before(:each) do
diff --git a/chef-config/spec/unit/path_helper_spec.rb b/chef-config/spec/unit/path_helper_spec.rb
index de45de2a62..70998423d8 100644
--- a/chef-config/spec/unit/path_helper_spec.rb
+++ b/chef-config/spec/unit/path_helper_spec.rb
@@ -62,31 +62,31 @@ RSpec.describe ChefConfig::PathHelper do
context "platform-specific #join behavior" do
it "joins components on Windows when some end with unix separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo/', "bar", "baz", windows: true)).to eq(expected)
+ expect(path_helper.join("C:\\foo/", "bar", "baz", windows: true)).to eq(expected)
end
it "joins components when some end with separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo\\', "bar", "baz", windows: true)).to eq(expected)
+ expect(path_helper.join("C:\\foo\\", "bar", "baz", windows: true)).to eq(expected)
end
it "joins components when some end and start with separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo\\', "bar/", "/baz", windows: true)).to eq(expected)
+ expect(path_helper.join("C:\\foo\\", "bar/", "/baz", windows: true)).to eq(expected)
end
it "joins components that don't end in separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo', "bar", "baz", windows: true)).to eq(expected)
+ expect(path_helper.join("C:\\foo", "bar", "baz", windows: true)).to eq(expected)
end
end
it "cleanpath changes slashes into backslashes and leaves backslashes alone" do
- expect(path_helper.cleanpath('/a/b\\c/d/', windows: true)).to eq('\\a\\b\\c\\d')
+ expect(path_helper.cleanpath("/a/b\\c/d/", windows: true)).to eq("\\a\\b\\c\\d")
end
it "cleanpath does not remove leading double backslash" do
- expect(path_helper.cleanpath('\\\\a/b\\c/d/', windows: true)).to eq('\\\\a\\b\\c\\d')
+ expect(path_helper.cleanpath("\\\\a/b\\c/d/", windows: true)).to eq("\\\\a\\b\\c\\d")
end
end
@@ -117,11 +117,11 @@ RSpec.describe ChefConfig::PathHelper do
end
it "cleanpath changes backslashes into slashes and leaves slashes alone" do
- expect(path_helper.cleanpath('/a/b\\c/d/', windows: false)).to eq("/a/b/c/d")
+ expect(path_helper.cleanpath("/a/b\\c/d/", windows: false)).to eq("/a/b/c/d")
end
it "cleanpath does not remove leading double backslash" do
- expect(path_helper.cleanpath('\\\\a/b\\c/d/', windows: false)).to eq("//a/b/c/d")
+ expect(path_helper.cleanpath("\\\\a/b\\c/d/", windows: false)).to eq("//a/b/c/d")
end
end
end
@@ -139,31 +139,31 @@ RSpec.describe ChefConfig::PathHelper do
context "platform-specific #join behavior" do
it "joins components on Windows when some end with unix separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo/', "bar", "baz")).to eq(expected)
+ expect(path_helper.join("C:\\foo/", "bar", "baz")).to eq(expected)
end
it "joins components when some end with separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo\\', "bar", "baz")).to eq(expected)
+ expect(path_helper.join("C:\\foo\\", "bar", "baz")).to eq(expected)
end
it "joins components when some end and start with separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo\\', "bar/", "/baz")).to eq(expected)
+ expect(path_helper.join("C:\\foo\\", "bar/", "/baz")).to eq(expected)
end
it "joins components that don't end in separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo', "bar", "baz")).to eq(expected)
+ expect(path_helper.join("C:\\foo", "bar", "baz")).to eq(expected)
end
end
it "cleanpath changes slashes into backslashes and leaves backslashes alone" do
- expect(path_helper.cleanpath('/a/b\\c/d/')).to eq('\\a\\b\\c\\d')
+ expect(path_helper.cleanpath("/a/b\\c/d/")).to eq("\\a\\b\\c\\d")
end
it "cleanpath does not remove leading double backslash" do
- expect(path_helper.cleanpath('\\\\a/b\\c/d/')).to eq('\\\\a\\b\\c\\d')
+ expect(path_helper.cleanpath("\\\\a/b\\c/d/")).to eq("\\\\a\\b\\c\\d")
end
end
@@ -198,12 +198,12 @@ RSpec.describe ChefConfig::PathHelper do
end
it "cleanpath changes backslashes into slashes and leaves slashes alone" do
- expect(path_helper.cleanpath('/a/b\\c/d/', windows: false)).to eq("/a/b/c/d")
+ expect(path_helper.cleanpath("/a/b\\c/d/", windows: false)).to eq("/a/b/c/d")
end
# NOTE: this seems a bit weird to me, but this is just the way Pathname#cleanpath works
it "cleanpath does not remove leading double backslash" do
- expect(path_helper.cleanpath('\\\\a/b\\c/d/')).to eq("//a/b/c/d")
+ expect(path_helper.cleanpath("\\\\a/b\\c/d/")).to eq("//a/b/c/d")
end
end