Sha256: 8c0286dd4555cb6394818ee07733c44d91cf9e26b6db001a1998000e1315b2fb

Contents?: true

Size: 946 Bytes

Versions: 16

Compression:

Stored size: 946 Bytes

Contents

# frozen_string_literal: true

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
      orig_io = capture_io
      yield
      [$stdout.string, $stderr.string]
    ensure
      uncapture_io(*orig_io)
    end

    def lines(string)
      string.scan(/^.*\n/).map(&: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

16 entries across 16 versions & 1 rubygems

Version Path
cri-2.15.11 test/helper.rb
cri-2.15.10 test/helper.rb
cri-2.15.9 test/helper.rb
cri-2.15.8 test/helper.rb
cri-2.15.7 test/helper.rb
cri-2.15.6 test/helper.rb
cri-2.15.5 test/helper.rb
cri-2.15.4 test/helper.rb
cri-2.15.3 test/helper.rb
cri-2.15.2 test/helper.rb
cri-2.15.1 test/helper.rb
cri-2.15.0 test/helper.rb
cri-2.14.0 test/helper.rb
cri-2.13.0 test/helper.rb
cri-2.12.0 test/helper.rb
cri-2.11.0 test/helper.rb