File: spec_helper.rb

package info (click to toggle)
ruby-ruby-version 1.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 124 kB
  • sloc: ruby: 161; makefile: 5
file content (20 lines) | stat: -rw-r--r-- 323 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'ruby_version'

require 'rspec'
require 'stringio'

def capture_stdout
  capture = StringIO.new
  restore, $stdout = $stdout, capture
  yield
  $stdout = restore
  capture.string
end

def capture_stderr
  capture = StringIO.new
  restore, $stderr = $stderr, capture
  yield
  $stderr = restore
  capture.string
end