diff options
author | Tim Smith <tsmith@chef.io> | 2020-11-11 11:18:39 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-11 11:18:39 -0800 |
commit | 400012b72eef2f8d1ab4112e4c5554c50a819d25 (patch) | |
tree | cbafac4ee584102fe9955d339e5dff36d90503d8 | |
parent | c8dfa0b4691d1e75d53117ea53ee6c6c2755f150 (diff) | |
parent | d37b99dd4493c3f16606e3f63eb3f745aace9180 (diff) | |
download | chef-400012b72eef2f8d1ab4112e4c5554c50a819d25.tar.gz |
Merge pull request #10625 from chef/mount_spec
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | spec/unit/resource/mount_spec.rb | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/spec/unit/resource/mount_spec.rb b/spec/unit/resource/mount_spec.rb index 933c4f1947..c9800f1381 100644 --- a/spec/unit/resource/mount_spec.rb +++ b/spec/unit/resource/mount_spec.rb @@ -49,6 +49,16 @@ describe Chef::Resource::Mount do expect(resource.mount_point).to eql("U:") end + it "splits strings passed to the mount_point property" do + resource.mount_point "U:" + expect(resource.mount_point).to eql("U:") + end + + it "strips trailing slashes from mount_point values" do + resource.mount_point "//192.168.11.102/Share/backup/" + expect(resource.mount_point).to eql("//192.168.11.102/Share/backup") + 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 @@ -87,12 +97,17 @@ describe Chef::Resource::Mount do it "allows options to be sent as a string, and convert to array" do resource.options "rw,noexec" - expect(resource.options).to be_a_kind_of(Array) + expect(resource.options).to eql(%w{rw noexec}) + end + + it "strips whitespace around options in a comma deliminated string" do + resource.options "rw, noexec" + expect(resource.options).to eql(%w{rw noexec}) end it "allows options property as an array" do resource.options %w{ro nosuid} - expect(resource.options).to be_a_kind_of(Array) + expect(resource.options).to eql(%w{ro nosuid}) end it "allows options to be sent as a delayed evaluator" do @@ -102,7 +117,6 @@ describe Chef::Resource::Mount do it "allows options to be sent as a delayed evaluator, and convert to array" do resource.options Chef::DelayedEvaluator.new { "rw,noexec" } - expect(resource.options).to be_a_kind_of(Array) expect(resource.options).to eql(%w{rw noexec}) end |