Module: RSpec::Puppet::FunctionExampleGroup

Includes:
FunctionMatchers
Defined in:
lib/rspec-puppet/example/function_example_group.rb

Instance Method Summary collapse

Instance Method Details

#subjectObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/rspec-puppet/example/function_example_group.rb', line 5

def subject
  function_name = self.class.top_level_description.downcase

  Puppet[:modulepath] = self.respond_to?(:module_path) ? module_path : RSpec.configuration.module_path
  Puppet[:libdir] = Dir["#{Puppet[:modulepath]}/*/lib"].entries.join(File::PATH_SEPARATOR)
  Puppet::Parser::Functions.autoloader.loadall

  scope = Puppet::Parser::Scope.new

  scope.method "function_#{function_name}".to_sym
end