Sha256: a744834e9932ad53cb6bc7396c5426fc1183f02439c2f7f99be75680e0303b18

Contents?: true

Size: 271 Bytes

Versions: 3

Compression:

Stored size: 271 Bytes

Contents

require 'stringio'

def capture_stdout(&blk)
  old = $stdout
  $stdout = fake = StringIO.new
  blk.call
  fake.string
ensure
  $stdout = old
end

def capture_stderr(&blk)
  old = $stderr
  $stderr = fake = StringIO.new
  blk.call
  fake.string
ensure
  $stderr = old
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
natophone-0.0.3 spec/helpers.rb
natophone-0.0.2 spec/helpers.rb
natophone-0.0.1 spec/helpers.rb