diff options
| author | Luke Kanies <luke@madstop.com> | 2009-09-19 21:56:05 -0700 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-09-22 09:27:23 +1000 |
| commit | af57483e618ace39c0d4540fd0f8479f5430f0ef (patch) | |
| tree | d9ddab25529e482bb715e9b799b519169f5cb127 /spec/unit/parser/functions | |
| parent | d42bda1f22e3beca321700a78aab9c1399537c30 (diff) | |
| download | puppet-af57483e618ace39c0d4540fd0f8479f5430f0ef.tar.gz puppet-af57483e618ace39c0d4540fd0f8479f5430f0ef.tar.xz puppet-af57483e618ace39c0d4540fd0f8479f5430f0ef.zip | |
Fixing #2632 - 'require' works for 0.25 clients
I couldn't find a way to make it compatible with
earlier clients, so the docs specify that
it doesn't work with them, and it helpfully fails.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/parser/functions')
| -rwxr-xr-x | spec/unit/parser/functions/require.rb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/spec/unit/parser/functions/require.rb b/spec/unit/parser/functions/require.rb index 67a5baeb9..24c9ecc64 100755 --- a/spec/unit/parser/functions/require.rb +++ b/spec/unit/parser/functions/require.rb @@ -7,8 +7,10 @@ describe "the require function" do before :each do @catalog = stub 'catalog' @compiler = stub 'compiler', :catalog => @catalog + + @resource = stub 'resource', :set_parameter => nil, :metaparam_compatibility_mode? => false @scope = Puppet::Parser::Scope.new() - @scope.stubs(:resource).returns("ourselves") + @scope.stubs(:resource).returns @resource @scope.stubs(:findresource) @scope.stubs(:compiler).returns(@compiler) end @@ -18,19 +20,23 @@ describe "the require function" do end it "should delegate to the 'include' puppet function" do - @catalog.stubs(:add_edge) @scope.expects(:function_include).with("myclass") @scope.function_require("myclass") end - it "should add a catalog edge from our parent resource to the included one" do - @scope.stubs(:function_include).with("myclass") - @scope.stubs(:findresource).with(:class, "myclass").returns("includedclass") + it "should set the 'require' prarameter on the resource to a resource reference" do + @resource.expects(:set_parameter).with { |name, value| name == :require and value.is_a?(Puppet::Parser::Resource::Reference) } + @scope.stubs(:function_include) + @scope.function_require("myclass") + end - @catalog.expects(:add_edge).with("ourselves","includedclass") + it "should include the class but not add a dependency if used on a client not at least version 0.25" do + @resource.expects(:metaparam_compatibility_mode?).returns true + @scope.expects(:warning) + @resource.expects(:set_parameter).never + @scope.expects(:function_include) @scope.function_require("myclass") end - end |
