Sha256: b688830b6c072e5399b792aea8440842eb2242382014e3c51af17dc1ba6d43b9

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 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

1 entries across 1 versions & 1 rubygems

Version Path
dircat-0.1.8 spec/spec_helper.rb