From ecb873d3a6d2eabc931457bd8f4c185c990976db Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Thu, 13 Mar 2008 12:36:21 -0500 Subject: Fixing #1118 -- downloading plugins and facts now ignores noop. Note that this changes the behaviour a bit -- the resource's noop setting always beats the global setting (previously, whichever was true would win). --- spec/unit/ral/type/noop_metaparam.rb | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 spec/unit/ral/type/noop_metaparam.rb (limited to 'spec/unit') diff --git a/spec/unit/ral/type/noop_metaparam.rb b/spec/unit/ral/type/noop_metaparam.rb new file mode 100755 index 000000000..0cbed3714 --- /dev/null +++ b/spec/unit/ral/type/noop_metaparam.rb @@ -0,0 +1,38 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../spec_helper' + +require 'puppet/metatype/metaparams' + +describe Puppet::Type.type(:file).attrclass(:noop) do + before do + @file = Puppet::Type.newfile :path => "/what/ever" + end + + after { Puppet::Type::File.clear } + + it "should accept true as a value" do + lambda { @file[:noop] = true }.should_not raise_error + end + + it "should accept false as a value" do + lambda { @file[:noop] = false }.should_not raise_error + end + + describe "when set on a resource" do + it "should default to the :noop setting" do + Puppet.settings.expects(:value).with(:noop).returns "myval" + @file.noop.should == "myval" + end + + it "should prefer true values from the attribute" do + @file[:noop] = true + @file.noop.should be_true + end + + it "should prefer false values from the attribute" do + @file[:noop] = false + @file.noop.should be_false + end + end +end -- cgit