From d6e4ffeb069686050b0ad1db544389be40e39b57 Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Sun, 30 Jan 2011 20:34:27 +0100 Subject: (#4914) Specs for mounted? match new behaviour The question if a filesystem is mounted or not can be answered without calling mount and the specs have to reflect that. --- spec/unit/provider/mount_spec.rb | 50 +++++++++++----------------------------- 1 file changed, 13 insertions(+), 37 deletions(-) diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb index 232c559f4..3fc8a8664 100755 --- a/spec/unit/provider/mount_spec.rb +++ b/spec/unit/provider/mount_spec.rb @@ -121,50 +121,26 @@ describe Puppet::Provider::Mount do @mounter.mounted? end - end - - describe Puppet::Provider::Mount, " when prefetching resources" do - - it "should match ' on /private/var/automount' if the operating system is Darwin" do - Facter.stubs(:value).with("operatingsystem").returns("Darwin") - @mounter.expects(:mountcmd).returns("/dev/whatever on /private/var/automount/\ndevfs on /dev") - - @mounter.should be_mounted + it "should return true if prefetched value is :mounted" do + @mounter.stubs(:get).with(:ensure).returns(:mounted) + @mounter.mounted? == true end - it "should match ' on ' if the operating system is Darwin" do - Facter.stubs(:value).with("operatingsystem").returns("Darwin") - @mounter.expects(:mountcmd).returns("/dev/disk03 on / (local, journaled)\ndevfs on /dev") - - @mounter.should be_mounted + it "should return true if prefetched value is :ghost" do + @mounter.stubs(:get).with(:ensure).returns(:ghost) + @mounter.mounted? == true end - it "should match '^ on' if the operating system is Solaris" do - Facter.stubs(:value).with("operatingsystem").returns("Solaris") - @mounter.expects(:mountcmd).returns("/ on /dev/dsk/whatever\n/var on /dev/dsk/other") - - @mounter.should be_mounted + it "should return false if prefetched value is :absent" do + @mounter.stubs(:get).with(:ensure).returns(:absent) + @mounter.mounted? == false end - it "should match '^ on' if the operating system is HP-UX" do - Facter.stubs(:value).with("operatingsystem").returns("HP-UX") - @mounter.expects(:mountcmd).returns("/ on /dev/dsk/whatever\n/var on /dev/dsk/other") - - @mounter.should be_mounted - end - - it "should match ' on ' if the operating system is not Darwin, Solaris, or HP-UX" do - Facter.stubs(:value).with("operatingsystem").returns("Debian") - @mounter.expects(:mountcmd).returns("/dev/dsk/whatever on / and stuff\n/dev/other/disk on /var and stuff") - - @mounter.should be_mounted + it "should return false if prefetched value is :unmounted" do + @mounter.stubs(:get).with(:ensure).returns(:unmounted) + @mounter.mounted? == false end - it "should not be considered mounted if it did not match the mount output" do - Facter.stubs(:value).with("operatingsystem").returns("Debian") - @mounter.expects(:mountcmd).returns("/dev/dsk/whatever on /something/else and stuff\n/dev/other/disk on /var and stuff") - - @mounter.should_not be_mounted - end end + end -- cgit