summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorJiSoo <jskim910118@gmail.com>2021-09-13 13:06:53 -0500
committerJiSoo <jskim910118@gmail.com>2021-09-13 13:07:30 -0500
commitffe6af31264124488f7e16e288ad8a3fafa39a11 (patch)
treef4258088ce5eb55f55c54b3c49469f510a133396 /spec/unit
parent296edf56682fcf5c6f512bc8255325b869a4b36c (diff)
downloadchef-ffe6af31264124488f7e16e288ad8a3fafa39a11.tar.gz
Coerce mount_point only when it is not root directory
Signed-off-by: JiSoo Kim <jskim910118@gmail.com>
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/resource/mount_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/unit/resource/mount_spec.rb b/spec/unit/resource/mount_spec.rb
index c9800f1381..1e1c36a5dd 100644
--- a/spec/unit/resource/mount_spec.rb
+++ b/spec/unit/resource/mount_spec.rb
@@ -59,6 +59,16 @@ describe Chef::Resource::Mount do
expect(resource.mount_point).to eql("//192.168.11.102/Share/backup")
end
+ it "does not strip slash when mount_point is root directory" do
+ resource.mount_point "/"
+ expect(resource.mount_point).to eql("/")
+ end
+
+ it "does not strip slash when mount_point is root of network mount" do
+ resource.mount_point "127.0.0.1:/"
+ expect(resource.mount_point).to eql("127.0.0.1:/")
+ end
+
it "raises error when mount_point property is not set" do
expect { resource.mount_point nil }.to raise_error(Chef::Exceptions::ValidationFailed, "Property mount_point must be one of: String! You passed nil.")
end