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

Markus Roberts Markus at reality.com
Wed Jul 14 10:35:12 UTC 2010


The following commit has been merged in the upstream branch:
commit db44a32695ae2b1249461f187b4b3321c24cfd84
Author: Markus Roberts <Markus at reality.com>
Date:   Thu Jun 24 11:59:27 2010 -0700

    Tweak for fix for #1175 to fix test failures
    
    Tests that weren't managing the environment but were still expecting to have
    functions defined in it were appalled when the functions/environments binding
    actually started working.  This patch fixes those tests.

diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index bb548dd..39317a7 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -497,6 +497,6 @@ class Puppet::Parser::Scope
 
     def extend_with_functions_module
         extend Puppet::Parser::Functions.environment_module(Puppet::Node::Environment.root)
-        extend Puppet::Parser::Functions.environment_module(compiler ? environment : nil )
+        extend Puppet::Parser::Functions.environment_module(compiler ? environment : nil)
     end
 end
diff --git a/spec/unit/parser/scope_spec.rb b/spec/unit/parser/scope_spec.rb
index b665ebd..37cf4bd 100755
--- a/spec/unit/parser/scope_spec.rb
+++ b/spec/unit/parser/scope_spec.rb
@@ -70,6 +70,8 @@ describe Puppet::Parser::Scope do
             mod = Module.new
             Puppet::Parser::Functions.expects(:environment_module).with(Puppet::Node::Environment.root).returns(mod)
 
+            Puppet::Parser::Functions.expects(:environment_module).with(nil).returns mod
+
             Puppet::Parser::Scope.new().metaclass.ancestors.should be_include(mod)
         end
     end
diff --git a/test/language/functions.rb b/test/language/functions.rb
index 8797a46..5463cf2 100755
--- a/test/language/functions.rb
+++ b/test/language/functions.rb
@@ -12,6 +12,7 @@ class TestLangFunctions < Test::Unit::TestCase
     include PuppetTest::ParserTesting
     include PuppetTest::ResourceTesting
     def test_functions
+        Puppet::Node::Environment.stubs(:current).returns nil
         assert_nothing_raised do
             Puppet::Parser::AST::Function.new(
                 :name => "fakefunction",
@@ -370,14 +371,14 @@ class TestLangFunctions < Test::Unit::TestCase
                 end
             }
         }
-
+        Puppet::Node::Environment.stubs(:current).returns nil
         obj = nil
         assert_nothing_raised {
             obj = Puppet::Parser::Functions.function(:autofunc)
         }
 
         assert(obj, "Did not autoload function")
-        assert(Puppet::Parser::Scope.method_defined?(:function_autofunc),
+        assert(Puppet::Parser::Functions.environment_module.method_defined?(:function_autofunc),
             "Did not set function correctly")
     end
 
@@ -465,6 +466,7 @@ class TestLangFunctions < Test::Unit::TestCase
         assert_equal("yay\n", %x{#{command}}, "command did not work")
         assert_equal("yay-foo\n", %x{#{command} foo}, "command did not work")
 
+        Puppet::Node::Environment.stubs(:current).returns nil
         generate = Puppet::Parser::Functions.function(:generate)
 
         scope = mkscope

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list