2014-05-07 11:49:25 +02:00
|
|
|
#! /usr/bin/env ruby -S rspec
|
2014-03-05 21:43:58 +01:00
|
|
|
|
|
|
|
module PuppetSpec::Scope
|
|
|
|
# Initialize a new scope suitable for testing.
|
|
|
|
#
|
|
|
|
def create_test_scope_for_node(node_name)
|
|
|
|
node = Puppet::Node.new(node_name)
|
|
|
|
compiler = Puppet::Parser::Compiler.new(node)
|
|
|
|
scope = Puppet::Parser::Scope.new(compiler)
|
|
|
|
scope.source = Puppet::Resource::Type.new(:node, node_name)
|
|
|
|
scope.parent = compiler.topscope
|
|
|
|
scope
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|