Sha256: aed55b62a229299a55152b63dbebfcff6391e53b3ced5cfead047427eb3a13af

Contents?: true

Size: 451 Bytes

Versions: 17

Compression:

Stored size: 451 Bytes

Contents

module StdoutHelpers
  def capture_stderr
    orig_stderr = $stderr
    $stderr = StringIO.new

    yield

    $stderr.string
  ensure
    $stderr = orig_stderr
  end

  alias silence_stderr capture_stderr

  def capture_stdout
    orig_stdout = $stdout
    $stdout = StringIO.new

    yield

    $stdout.string
  ensure
    $stdout = orig_stdout
  end

  alias silence_stdout capture_stdout
end

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

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
license_finder-3.0.4 spec/support/stdout_helpers.rb
license_finder-3.0.2 spec/support/stdout_helpers.rb
license_finder-3.0.1 spec/support/stdout_helpers.rb
license_finder-3.0.0 spec/support/stdout_helpers.rb
license_finder-2.1.2 spec/support/stdout_helpers.rb
license_finder-2.1.1 spec/support/stdout_helpers.rb
license_finder-2.1.0 spec/support/stdout_helpers.rb
license_finder-2.1.0.rc9 spec/support/stdout_helpers.rb
license_finder-2.1.0.rc8 spec/support/stdout_helpers.rb
license_finder-2.1.0.rc7 spec/support/stdout_helpers.rb
license_finder-2.1.0.rc6 spec/support/stdout_helpers.rb
license_finder-2.1.0.rc5 spec/support/stdout_helpers.rb
license_finder-2.1.0.rc4 spec/support/stdout_helpers.rb
license_finder-2.1.0.rc3 spec/support/stdout_helpers.rb
license_finder-2.1.0.rc2 spec/support/stdout_helpers.rb
license_finder-2.1.0.rc1 spec/support/stdout_helpers.rb
license_finder-2.0.4 spec/support/stdout_helpers.rb