Class: RSpec::Puppet::FunctionExampleGroup::V4FunctionWrapper
- Inherits:
- 
      Object
      
        - Object
- RSpec::Puppet::FunctionExampleGroup::V4FunctionWrapper
 
- Defined in:
- lib/rspec-puppet/example/function_example_group.rb
Instance Attribute Summary collapse
- 
  
    
      #func  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute func. 
- 
  
    
      #func_name  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute func_name. 
Instance Method Summary collapse
- 
  
    
      #call(_scope, *args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    compatibility alias for existing tests. 
- 
  
    
      #execute(*args, &block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    This method is used by the ‘run` matcher to trigger the function execution, and provides a uniform interface across all puppet versions. 
- 
  
    
      #initialize(name, func, overrides)  ⇒ V4FunctionWrapper 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of V4FunctionWrapper. 
Constructor Details
#initialize(name, func, overrides) ⇒ V4FunctionWrapper
Returns a new instance of V4FunctionWrapper.
| 12 13 14 15 16 | # File 'lib/rspec-puppet/example/function_example_group.rb', line 12 def initialize(name, func, overrides) @func_name = name @func = func @overrides = overrides end | 
Instance Attribute Details
#func ⇒ Object (readonly)
Returns the value of attribute func.
| 10 11 12 | # File 'lib/rspec-puppet/example/function_example_group.rb', line 10 def func @func end | 
#func_name ⇒ Object (readonly)
Returns the value of attribute func_name.
| 10 11 12 | # File 'lib/rspec-puppet/example/function_example_group.rb', line 10 def func_name @func_name end | 
Instance Method Details
#call(_scope, *args) ⇒ Object
compatibility alias for existing tests
| 26 27 28 29 | # File 'lib/rspec-puppet/example/function_example_group.rb', line 26 def call(_scope, *args) RSpec.deprecate('subject.call', replacement: 'is_expected.to run.with().and_raise_error(), or execute()') execute(*args) end | 
#execute(*args, &block) ⇒ Object
This method is used by the ‘run` matcher to trigger the function execution, and provides a uniform interface across all puppet versions.
| 19 20 21 22 23 | # File 'lib/rspec-puppet/example/function_example_group.rb', line 19 def execute(*args, &block) Puppet.override(@overrides, 'rspec-test scope') do @func.call(@overrides[:global_scope], *freeze_arg(args), &block) end end |