puppetlabs/puppet — pull request #951 by jeffmccune (2012-07-18 19:44:01+00:00)
Title: (maint) Add Puppet::Parser::Scope.new_for_test_harness

Without this patch there is no clear path into the internals of Puppet for
third parties who intended to exercise Puppet parser functions.

This is a problem because many 3rd parties, such as the stdlib module and
hiera-puppet extend Puppet using parser functions. These modules create
instances of Puppet::Parser::Scope objects in their test harness to invoke
the parser functions they're testing.

The specific problem this patch means to address is the dependency of Puppet
modules on the specific method signature of Puppet::Parser::Scope#initialize
This patch addresses the problem my adding a new method,
Puppet::Parser::Scope.new_for_test_harness which accepts a single argument,
the node name, and returns a scope instance bound to a compiler instance and
a node instance.

The common spec helper should be augmented to invoke this method. All Puppet
modules that exercise parser functions should then decouple themselves from
Puppet itself and instead depend upon the common spec helper behavior.