diff options
| author | David Schmitt <david@schmitt.edv-bus.at> | 2007-11-09 19:19:11 +0100 |
|---|---|---|
| committer | David Schmitt <david@schmitt.edv-bus.at> | 2007-11-09 19:19:11 +0100 |
| commit | 5726412cb7289c6cfbc421d9081d690ffa48ba9a (patch) | |
| tree | fe7cb7cc6a83242c2c5e02349a37bfb5b433487e /spec | |
| parent | 3f583dc133ce50ae34bfc151474c6d4196f803ca (diff) | |
| download | puppet-5726412cb7289c6cfbc421d9081d690ffa48ba9a.tar.gz puppet-5726412cb7289c6cfbc421d9081d690ffa48ba9a.tar.xz puppet-5726412cb7289c6cfbc421d9081d690ffa48ba9a.zip | |
tests for #872: check interaction between "replace" and "content"
Currently "Puppet::Type::File when used with replace=>false and content should
be insync if the file exists and the content is different" fails.
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/ral/types/file.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/unit/ral/types/file.rb b/spec/unit/ral/types/file.rb new file mode 100755 index 000000000..823d643b0 --- /dev/null +++ b/spec/unit/ral/types/file.rb @@ -0,0 +1,32 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../spec_helper' +require 'tempfile' + +describe Puppet::type(:file), " when used with replace=>false and content" do + + before do + @path = Tempfile.new("puppetspec") + @path.close!() + @path = @path.path + @file = Puppet::type(:file).create( { :name => @path, :content => "foo", :replace => :false } ) + end + + after do + end + + it "should be insync if the file exists and the content is different" do + File.open(@path, "w") do |f| f.puts "bar" end + @file.property(:content).insync?("bar").should be_true + end + + it "should be insync if the file exists and the content is right" do + File.open(@path, "w") do |f| f.puts "foo" end + @file.property(:content).insync?("foo").should be_true + end + + it "should not be insync if the file doesnot exist" do + @file.property(:content).insync?(:nil).should be_false + end + +end |
