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.
51 52 53 54 |
# File 'lib/rspec-puppet/example/function_example_group.rb', line 51 def initialize(name, func) @func_name = name @func = func end |
Instance Attribute Details
#func_name ⇒ Object
Returns the value of attribute func_name.
49 50 51 |
# File 'lib/rspec-puppet/example/function_example_group.rb', line 49 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.
66 67 68 69 70 71 72 73 |
# File 'lib/rspec-puppet/example/function_example_group.rb', line 66 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.
57 58 59 60 61 62 63 |
# File 'lib/rspec-puppet/example/function_example_group.rb', line 57 def execute(*args) if args.nil? @func.call else @func.call(args) end end |