diff options
-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 |