Module: RSpec::Puppet::FunctionExampleGroup
- Includes:
- FunctionMatchers, ManifestMatchers, Support
- Defined in:
- lib/rspec-puppet/example/function_example_group.rb
Instance Method Summary collapse
Instance Method Details
#catalogue ⇒ Object
34 35 36 |
# File 'lib/rspec-puppet/example/function_example_group.rb', line 34 def catalogue @catalogue ||= compiler.catalog end |
#rspec_puppet_cleanup ⇒ Object
38 39 40 41 42 |
# File 'lib/rspec-puppet/example/function_example_group.rb', line 38 def rspec_puppet_cleanup @catalogue = nil @compiler = nil @scope = nil end |
#scope ⇒ Object
30 31 32 |
# File 'lib/rspec-puppet/example/function_example_group.rb', line 30 def scope @scope ||= build_scope(compiler, nodename(:function)) end |
#subject ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rspec-puppet/example/function_example_group.rb', line 7 def subject function_name = self.class.top_level_description.downcase vardir = setup_puppet if Puppet.version.to_f >= 4.0 env = build_4x_environment(environment) loader = Puppet::Pops::Loaders.new(env) func = loader.private_environment_loader.load(:function,function_name) return func if func end # Return the method instance for the function. This can be used with # method.call if env return nil unless Puppet::Parser::Functions.function(function_name,env) else return nil unless Puppet::Parser::Functions.function(function_name) end FileUtils.rm_rf(vardir) if File.directory?(vardir) scope.method("function_#{function_name}".intern) end |