Class: RSpec::Puppet::FunctionExampleGroup::V3FunctionWrapper
- Inherits:
-
Object
- Object
- RSpec::Puppet::FunctionExampleGroup::V3FunctionWrapper
- Defined in:
- lib/rspec-puppet/example/function_example_group.rb
Instance Attribute Summary collapse
-
#func_name ⇒ Object
Returns the value of attribute func_name.
Instance Method Summary collapse
-
#call(*args) ⇒ Object
This method was formerly used by the ‘run` matcher to trigger the function execution, and provides puppet versions dependant interface.
-
#execute(*args) ⇒ 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) ⇒ V3FunctionWrapper
constructor
A new instance of V3FunctionWrapper.
Constructor Details
#initialize(name, func) ⇒ V3FunctionWrapper
Returns a new instance of V3FunctionWrapper.
56 57 58 59 |
# File 'lib/rspec-puppet/example/function_example_group.rb', line 56 def initialize(name, func) @func_name = name @func = func end |
Instance Attribute Details
#func_name ⇒ Object
Returns the value of attribute func_name.
54 55 56 |
# File 'lib/rspec-puppet/example/function_example_group.rb', line 54 def func_name @func_name end |
Instance Method Details
#call(*args) ⇒ Object
This method was formerly used by the ‘run` matcher to trigger the function execution, and provides puppet versions dependant interface.
71 72 73 74 75 76 77 78 |
# 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) ⇒ Object
This method is used by the ‘run` matcher to trigger the function execution, and provides a uniform interface across all puppet versions.
62 63 64 65 66 67 68 |
# 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 |