Sha256: 8f15d7cbb5d1d8aedf5c5330c64a7c699f3b349910c0c9058775db58398ceae8

Contents?: true

Size: 956 Bytes

Versions: 1

Compression:

Stored size: 956 Bytes

Contents

require "rubygems"
require "bundler/setup"
Bundler.require(:default, :test)
SimpleCov.start if ENV["COVERAGE"]
require File.expand_path("../../lib/hisyo.rb", __FILE__)


RSpec.configure do |conf|
  conf.before(:all) do
    @root = File.expand_path("../../", __FILE__)
    @approot = File.expand_path("../testapp", __FILE__)
  end

  # https://github.com/seattlerb/minitest/blob/master/lib/minitest/unit.rb#L431
  ##
  # Captures $stdout and $stderr into strings:
  #
  #   out, err = capture_io do
  #     warn "You did a bad thing"
  #   end
  #
  #   assert_match %r%bad%, err
  def capture_io
    require 'stringio'

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

    yield

    return captured_stdout.string, captured_stderr.string
  ensure
    $stdout = orig_stdout
    $stderr = orig_stderr
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hisyo-0.0.3 spec/spec_helper.rb