Class: RSpecPuppetUtils::MockFunction
- Inherits:
-
Object
- Object
- RSpecPuppetUtils::MockFunction
- Defined in:
- lib/mock_function.rb
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ MockFunction
constructor
A new instance of MockFunction.
Constructor Details
#initialize(name, options = {}) ⇒ MockFunction
Returns a new instance of MockFunction.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mock_function.rb', line 7 def initialize(name, = {}) if [:type] == :rvalue this = self Puppet::Parser::Functions.newfunction(name.to_sym, ) { |args| this.call args} yield self if block_given? else # Even though the puppet function does not return a value, # this mock still needs to do something, what it returns doesn't really matter. Puppet::Parser::Functions.newfunction(name.to_sym, ) { |args| args } end end |