[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

Luke Kanies luke at puppetlabs.com
Wed Jul 14 10:32:17 UTC 2010


The following commit has been merged in the upstream branch:
commit 84d68924c9e5538d7d40a9ff5cdd19a3f32874ad
Author: Luke Kanies <luke at puppetlabs.com>
Date:   Fri Apr 9 16:18:12 2010 -0700

    Fixing all 'require' function tests
    
    This involved making some tests better, but mostly
    just involved fixing calls to use new APIs and such.
    
    Signed-off-by: Luke Kanies <luke at puppetlabs.com>

diff --git a/spec/integration/parser/functions/require.rb b/spec/integration/parser/functions/require.rb
index fa1c1bc..3d65a50 100755
--- a/spec/integration/parser/functions/require.rb
+++ b/spec/integration/parser/functions/require.rb
@@ -26,8 +26,8 @@ describe "The require function" do
     end
 
     it "should queue relationships between the 'required' class and our classes" do
-        @parser.newclass("requiredclass1")
-        @parser.newclass("requiredclass2")
+        @compiler.known_resource_types.add Puppet::Resource::Type.new(:hostclass, "requiredclass1")
+        @compiler.known_resource_types.add Puppet::Resource::Type.new(:hostclass, "requiredclass2")
 
         @scope.function_require("requiredclass1")
         @scope.function_require("requiredclass2")
@@ -36,9 +36,9 @@ describe "The require function" do
 
         (ref1,ref2) = @scope.resource["require"]
         ref1.type.should == "Class"
-        ref1.title.should == "requiredclass1"
+        ref1.title.should == "Requiredclass1"
         ref2.type.should == "Class"
-        ref2.title.should == "requiredclass2"
+        ref2.title.should == "Requiredclass2"
     end
 
 end
diff --git a/spec/unit/parser/functions/require.rb b/spec/unit/parser/functions/require.rb
index 1d9ce93..45769cc 100755
--- a/spec/unit/parser/functions/require.rb
+++ b/spec/unit/parser/functions/require.rb
@@ -8,13 +8,15 @@ describe "the require function" do
         @catalog = stub 'catalog'
         @compiler = stub 'compiler', :catalog => @catalog
 
-        @resource = stub 'resource', :set_parameter => nil, :metaparam_compatibility_mode? => false, :[] => nil
         @scope = Puppet::Parser::Scope.new()
-        @scope.stubs(:resource).returns @resource
         @scope.stubs(:findresource)
         @scope.stubs(:compiler).returns(@compiler)
         @klass = stub 'class', :name => "myclass"
         @scope.stubs(:find_hostclass).returns(@klass)
+
+        @resource = Puppet::Parser::Resource.new(:file, "/my/file", :scope => @scope, :source => "source")
+        @resource.stubs(:metaparam_compatibility_mode?).returns false
+        @scope.stubs(:resource).returns @resource
     end
 
     it "should exist" do
@@ -28,9 +30,11 @@ 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[0].is_a?(Puppet::Resource) }
         @scope.stubs(:function_include)
         @scope.function_require("myclass")
+
+        @resource["require"].should be_instance_of(Array)
+        @resource["require"][0].should be_instance_of(Puppet::Resource)
     end
 
     it "should verify the 'include' function is loaded" do
@@ -59,11 +63,12 @@ describe "the require function" do
 
     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])
 
+        one = Puppet::Resource.new(:file, "/one")
+        @resource[:require] = one
         @scope.function_require("myclass")
+
+        @resource[:require].should be_include(one)
+        @resource[:require].detect { |r| r.to_s == "Class[Myclass]" }.should be_instance_of(Puppet::Resource)
     end
 end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list