diff options
| author | Brice Figureau <brice-puppet@daysofwonder.com> | 2010-03-21 12:07:37 +0100 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | 73c8d0d4701f10995c81633b912bc6dc65a2cf78 (patch) | |
| tree | 7ebdb31406b4f85e55e621e4cfde356d0ca7ed9b /spec/unit/parser/functions | |
| parent | c5a4de28532eaaf8abf2496ca1d4cdc02e5f450a (diff) | |
| download | puppet-73c8d0d4701f10995c81633b912bc6dc65a2cf78.tar.gz puppet-73c8d0d4701f10995c81633b912bc6dc65a2cf78.tar.xz puppet-73c8d0d4701f10995c81633b912bc6dc65a2cf78.zip | |
Fix #3186 - require function set relationship only on the last class
Due to the fact that resource.set_parameter is overwriting the previous
set_parameters, we were losing the previous relationships we set there,
either in a previous call of require or in the same call.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec/unit/parser/functions')
| -rwxr-xr-x | spec/unit/parser/functions/require.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/unit/parser/functions/require.rb b/spec/unit/parser/functions/require.rb index 532c06900..4e05069df 100755 --- a/spec/unit/parser/functions/require.rb +++ b/spec/unit/parser/functions/require.rb @@ -8,7 +8,7 @@ describe "the require function" do @catalog = stub 'catalog' @compiler = stub 'compiler', :catalog => @catalog - @resource = stub 'resource', :set_parameter => nil, :metaparam_compatibility_mode? => false + @resource = stub 'resource', :set_parameter => nil, :metaparam_compatibility_mode? => false, :[] => nil @scope = Puppet::Parser::Scope.new() @scope.stubs(:resource).returns @resource @scope.stubs(:findresource) @@ -28,7 +28,7 @@ describe "the require function" do end 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) } + @resource.expects(:set_parameter).with { |name, value| name == :require and value[0].is_a?(Puppet::Parser::Resource::Reference) } @scope.stubs(:function_include) @scope.function_require("myclass") end @@ -56,4 +56,14 @@ describe "the require function" do @scope.function_require("myclass") end + + it "should append the required class to the require parameter" do + @scope.stubs(:function_include) + Puppet::Parser::Resource::Reference.stubs(:new).returns(:require2) + + @resource.expects(:[]).with(:require).returns(:require1) + @resource.expects(:set_parameter).with(:require, [:require1, :require2]) + + @scope.function_require("myclass") + end end |
