def capture_io
      require "stringio"

      orig_stdout = $stdout
      orig_stderr = $stderr
      captured_stdout = StringIO.new
      captured_stderr = StringIO.new
      $stdout = captured_stdout
      $stderr = captured_stderr

      yield

      return captured_stdout.string, captured_stderr.string
    ensure
      $stdout = orig_stdout
      $stderr = orig_stderr
    end
def capture_io
      require "stringio"

      orig_stdout = $stdout
      orig_stderr = $stderr
      captured_stdout = StringIO.new
      captured_stderr = StringIO.new
      $stdout = captured_stdout
      $stderr = captured_stderr

      yield

      return captured_stdout.string, captured_stderr.string
    ensure
      $stdout = orig_stdout
      $stderr = orig_stderr
    end
ripped from MiniTest :)
 RSpec doesn't have a method for this? Am I missing something?