Sha256: a39bcbc35ef1e6ad1a0d89dace7eceb469e98da743bc8c2afd39383aa7dbcd47

Contents?: true

Size: 399 Bytes

Versions: 6

Compression:

Stored size: 399 Bytes

Contents

module StdoutHelpers
  def silence_stdout
    orig_stdout = $stdout
    $stdout = File.open("/dev/null", "w")
    yield
  ensure
    $stdout = orig_stdout
  end

  def capture_stdout
    orig_stdout = $stdout
    stdout_reader, $stdout = IO.pipe

    yield

    $stdout.close
    stdout_reader.read
  ensure
    $stdout = orig_stdout
  end
end

RSpec.configure do |c|
  c.include(StdoutHelpers)
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
license_finder-1.2 spec/support/stdout_helpers.rb
license_finder-1.2-java spec/support/stdout_helpers.rb
license_finder-1.1.1-java spec/support/stdout_helpers.rb
license_finder-1.1.1 spec/support/stdout_helpers.rb
license_finder-1.1.0 spec/support/stdout_helpers.rb
license_finder-1.0.1 spec/support/stdout_helpers.rb