class ChefSpec::Stubs::CommandStub
Attributes
block[R]
command[R]
value[R]
Public Class Methods
new(command, &block)
click to toggle source
# File lib/chefspec/stubs/command_stub.rb, line 10 def initialize(command, &block) @command = command @block = block end
Public Instance Methods
and_return(value)
click to toggle source
# File lib/chefspec/stubs/command_stub.rb, line 15 def and_return(value) @value = value self end
result()
click to toggle source
# File lib/chefspec/stubs/command_stub.rb, line 20 def result if @block @block.call else @value end end
signature()
click to toggle source
# File lib/chefspec/stubs/command_stub.rb, line 28 def signature if @block "stub_command(#{@command.inspect}) { # Ruby code }" else "stub_command(#{@command.inspect}).and_return(#{@value})" end end