summaryrefslogtreecommitdiffstats
path: root/spec/unit/provider/parsedfile.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/provider/parsedfile.rb')
-rwxr-xr-xspec/unit/provider/parsedfile.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/spec/unit/provider/parsedfile.rb b/spec/unit/provider/parsedfile.rb
index 11a91c8d7..f20b6b235 100755
--- a/spec/unit/provider/parsedfile.rb
+++ b/spec/unit/provider/parsedfile.rb
@@ -56,18 +56,27 @@ describe Puppet::Provider::ParsedFile do
@class.initvars
@class.prefetch
- @filetype = mock 'filetype'
- Puppet::Util::FileType.filetype(:flat).expects(:new).with("/my/file").returns @filetype
+ @filetype = Puppet::Util::FileType.filetype(:flat).new("/my/file")
+ Puppet::Util::FileType.filetype(:flat).stubs(:new).with("/my/file").returns @filetype
@filetype.stubs(:write)
end
- it "should back up the file being written" do
+ it "should back up the file being written if the filetype can be backed up" do
@filetype.expects(:backup)
@class.flush_target("/my/file")
end
+ it "should not try to back up the file if the filetype cannot be backed up" do
+ @filetype = Puppet::Util::FileType.filetype(:ram).new("/my/file")
+ Puppet::Util::FileType.filetype(:flat).expects(:new).returns @filetype
+
+ @filetype.stubs(:write)
+
+ @class.flush_target("/my/file")
+ end
+
it "should not back up the file more than once between calls to 'prefetch'" do
@filetype.expects(:backup).once