Sha256: b492bd9d7a7330eb24faad4ce3b80ad35c866d9e3659ebebe66a88682d69ac48

Contents?: true

Size: 683 Bytes

Versions: 2

Compression:

Stored size: 683 Bytes

Contents

# -*- coding: utf-8 -*-

require "stringio"
require 'ostruct'

$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'dircat'
include DirCat

TEST_DIR = File.expand_path(File.join(File.dirname(__FILE__), "fixtures"))

def capture_out
  old_stdout, old_stderr = $stdout, $stderr
  out, err = StringIO.new, StringIO.new
  $stdout, $stderr = out, err
  begin
    yield
  ensure
    $stdout, $stderr = old_stdout, old_stderr
  end
  OpenStruct.new(:out => out.string, :err => err.string)
end

#def with_stdout_captured
#  old_stdout = $stdout
#  out        = StringIO.new
#  $stdout    = out
#  begin
#    yield
#  ensure
#    $stdout = old_stdout
#  end
#  out.string
#end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dircat-0.1.10 spec/spec_helper.rb
dircat-0.1.9 spec/spec_helper.rb