class RSpec::Puppet::FunctionExampleGroup::V3FunctionWrapper

Attributes

func_name[RW]

Public Class Methods

new(name, func) click to toggle source
# File lib/rspec-puppet/example/function_example_group.rb, line 56
def initialize(name, func)
  @func_name = name
  @func = func
end

Public Instance Methods

call(*args) click to toggle source

This method was formerly used by the ‘run` matcher to trigger the function execution, and provides puppet versions dependant interface.

# File lib/rspec-puppet/example/function_example_group.rb, line 71
def call(*args)
  RSpec.deprecate('subject.call', replacement: 'is_expected.to run.with().and_raise_error(), or execute()')
  if args.nil?
    @func.call
  else
    @func.call(*args)
  end
end
execute(*args) click to toggle source

This method is used by the ‘run` matcher to trigger the function execution, and provides a uniform interface across all puppet versions.

# File lib/rspec-puppet/example/function_example_group.rb, line 62
def execute(*args)
  if args.nil?
    @func.call
  else
    @func.call(args)
  end
end