summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-12-07 18:04:14 -0600
committerJames Turnbull <james@lovedthanlost.net>2008-12-08 15:45:06 +1100
commit18fe5c3ac2ad4c42afd30ba2effad28607fe746d (patch)
tree7c4ba6b654aa6799d83a65861fc2ade479cf08b3 /spec/unit
parentb22303e31654b44c300c713426d7f16ef37f4210 (diff)
downloadpuppet-18fe5c3ac2ad4c42afd30ba2effad28607fe746d.tar.gz
puppet-18fe5c3ac2ad4c42afd30ba2effad28607fe746d.tar.xz
puppet-18fe5c3ac2ad4c42afd30ba2effad28607fe746d.zip
Fixing #1750 again - All of the properties and now :ensure check replace?
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/type/file/ensure.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/unit/type/file/ensure.rb b/spec/unit/type/file/ensure.rb
new file mode 100755
index 000000000..b336c7c7a
--- /dev/null
+++ b/spec/unit/type/file/ensure.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+
+Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
+
+property = Puppet::Type.type(:file).attrclass(:ensure)
+
+describe property do
+ before do
+ @resource = stub 'resource', :line => "foo", :file => "bar", :replace? => true
+ @resource.stubs(:[]).returns "foo"
+ @resource.stubs(:[]).with(:path).returns "/my/file"
+ @ensure = property.new :resource => @resource
+ end
+
+ describe "when testing whether in sync" do
+ it "should always be in sync if replace is 'false' unless the file is missing" do
+ @resource.expects(:replace?).returns false
+ @ensure.insync?(:link).should be_true
+ end
+ end
+end