class ChefSpec::Stubs::Stub

def and_raise(exception)

def and_raise(exception)
  @block = Proc.new { raise exception }
  self
end

def and_return(value)

def and_return(value)
  @value = value
  self
end

def recursively_mashify(thing)

def recursively_mashify(thing)
  case thing
  when Array
    thing.collect { |item| recursively_mashify(item) }
  when Hash
    Mash.from_hash(thing)
  else
    thing
  end
end

def result

def result
  if @block
    recursively_mashify(@block.call)
  else
    recursively_mashify(@value)
  end
end