require 'stringio'

def capture_stdout
  captured_output = StringIO.new
  real_stdout = $stdout
  $stdout = captured_output
  yield
ensure
  $stdout = real_stdout
  return captured_output.string
end

Add spec helper for capturing stdout to a string
Add spec helper for capturing stdout to a string

* Shout out to @avdi for his awesome RubyTapas!
* http://www.rubytapas.com/episodes/29-Redirecting-Output
