summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJose Asuncion <jeunito@gmail.com>2017-07-06 07:29:29 -0700
committerJose Asuncion <jeunito@gmail.com>2017-07-06 07:30:07 -0700
commit0eb90ddd97fa97e3a225453baaccf32194aef06d (patch)
tree8d43fe80fd80b8b00b24287712f660b705b676f7 /spec
parent606304ec18bd518c2eff9b9b4257aff55df50f2d (diff)
parent1da1234ee26dad05e8ca406d226478ef40e88195 (diff)
downloadchef-0eb90ddd97fa97e3a225453baaccf32194aef06d.tar.gz
Merge branch 'master' into feat/5556
Signed-off-by: Jose Asuncion <jeunito@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/provider/mount/aix_spec.rb34
1 files changed, 33 insertions, 1 deletions
diff --git a/spec/unit/provider/mount/aix_spec.rb b/spec/unit/provider/mount/aix_spec.rb
index 3371c270c5..615f3c3304 100644
--- a/spec/unit/provider/mount/aix_spec.rb
+++ b/spec/unit/provider/mount/aix_spec.rb
@@ -44,6 +44,11 @@ MOUNT
#MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct
/tmp/foo:/dev/sdz1:jfs2::bootfs:10485760:rw:yes:no
ENABLED
+
+ @test_wrong_output = <<-WRONG
+#MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct
+/tmp/foo::/dev/sdz1:jfs2:bootfs:10485760:rw:yes:no
+WRONG
end
before(:each) do
@@ -102,6 +107,25 @@ ENABLED
expect(@provider.current_resource.mounted).to be_falsey
end
+
+ context "mount_options_unchanged?" do
+ it "should return true if mounted device is the same" do
+ stub_mounted_enabled(@provider, @mounted_output, @enabled_output)
+ @provider.load_current_resource
+
+ allow(@provider.current_resource).to receive(:fstype).and_return("jfs2")
+ expect(@provider.send :mount_options_unchanged?).to be true
+ end
+
+ it "should return false if mounted device has changed" do
+ stub_mounted_enabled(@provider, @mounted_output, @enabled_output)
+ @provider.load_current_resource
+
+ allow(@provider.current_resource).to receive(:fstype).and_return("XXXX")
+ expect(@provider.send :mount_options_unchanged?).to be false
+ end
+ end
+
end
# tests for #enabled?
@@ -188,12 +212,20 @@ ENABLED
it "should not enable mount if it is mounted and already enabled and mount options are unchanged" do
stub_mounted_enabled(@provider, @mounted_output, @enabled_output)
- @new_resource.options "rw"
expect(@provider).not_to receive(:enable_fs)
@provider.run_action(:enable)
end
+
+ it "should return false if enabled_output is given in wrong syntax" do
+ stub_mounted_enabled(@provider, @mounted_output, @test_wrong_output)
+
+ expect(@provider).to receive(:enable_fs)
+
+ @provider.run_action(:enable)
+ end
+
end
describe "disable_fs" do