class ChefSpec::Stubs::CommandStub

def and_return(value)

def and_return(value)
  @value = value
  self
end

def initialize(command, &block)

def initialize(command, &block)
  @command = command
  @block   = block
end

def result

def result
  if @block
    @block.call
  else
    @value
  end
end

def signature

def signature
  if @block
    "stub_command(#{@command.inspect}) { # Ruby code }"
  else
    "stub_command(#{@command.inspect}).and_return(#{@value})"
  end
end