Sha256: 9c8093f98222fbfdac9f5456f2855e7ae1c016f9eeeb5ba24e743387170ab1e6
Contents?: true
Size: 954 Bytes
Versions: 1
Compression:
Stored size: 954 Bytes
Contents
# encoding: utf-8 require 'coveralls' Coveralls.wear! require 'minitest' require 'minitest/autorun' require 'cri' require 'stringio' module Cri class TestCase < Minitest::Test def setup @orig_io = capture_io end def teardown uncapture_io(*@orig_io) end def capture_io_while(&block) orig_io = capture_io block.call [$stdout.string, $stderr.string] ensure uncapture_io(*orig_io) end def lines(string) string.scan(/^.*\n/).map { |s| s.chomp } end private def capture_io orig_stdout = $stdout orig_stderr = $stderr $stdout = StringIO.new $stderr = StringIO.new [orig_stdout, orig_stderr] end def uncapture_io(orig_stdout, orig_stderr) $stdout = orig_stdout $stderr = orig_stderr end end end # Unexpected system exit is unexpected ::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS.delete(SystemExit)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cri-2.7.0 | test/helper.rb |