summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-03-27 13:53:04 -0700
committerGitHub <noreply@github.com>2020-03-27 13:53:04 -0700
commitbde170ba297d046a8808497875f15a6347ca603d (patch)
treebd5bcab8547f46604d49c4c4a166da9504bfa235
parent24b04cc0cd19b2b17a185b138d204778fe009b08 (diff)
parentb45df41d124d0b11f7f56b38a2dab4b74e66a7f9 (diff)
downloadchef-bde170ba297d046a8808497875f15a6347ca603d.tar.gz
Merge pull request #9524 from MsysTechnologiesllc/sangmeshA/Fix_windows_share_cannot_modify_frozen_String
Fixed windows share cannot modify frozen string bug
-rw-r--r--lib/chef/resource/windows_share.rb2
-rw-r--r--spec/unit/resource/windows_share_spec.rb4
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/chef/resource/windows_share.rb b/lib/chef/resource/windows_share.rb
index 1b81eaf55f..2c4d79522a 100644
--- a/lib/chef/resource/windows_share.rb
+++ b/lib/chef/resource/windows_share.rb
@@ -39,7 +39,7 @@ class Chef
# Specifies the path of the location of the folder to share. The path must be fully qualified. Relative paths or paths that contain wildcard characters are not permitted.
property :path, String,
description: "The path of the folder to share. Required when creating. If the share already exists on a different path then it is deleted and re-created.",
- coerce: proc { |p| p.gsub!(%r{/}, "\\") || p }
+ coerce: proc { |p| p.gsub(%r{/}, "\\") || p }
# Specifies an optional description of the SMB share. A description of the share is displayed by running the Get-SmbShare cmdlet. The description may not contain more than 256 characters.
property :description, String,
diff --git a/spec/unit/resource/windows_share_spec.rb b/spec/unit/resource/windows_share_spec.rb
index 365d2c7b11..c86465e7c8 100644
--- a/spec/unit/resource/windows_share_spec.rb
+++ b/spec/unit/resource/windows_share_spec.rb
@@ -38,9 +38,11 @@ describe Chef::Resource::WindowsShare do
end
it "coerces path to a single path separator format" do
- resource.path("C:/chef")
+ resource.path("C:/chef".freeze)
expect(resource.path).to eql("C:\\chef")
resource.path("C:\\chef")
expect(resource.path).to eql("C:\\chef")
+ resource.path("C:/chef".dup)
+ expect(resource.path).to eql("C:\\chef")
end
end