Sha256: 73f1ab10231881f6d8ec4df5960be7cb566bd6d5d67bbd3ba10b6ae6b55f74f6

Contents?: true

Size: 455 Bytes

Versions: 57

Compression:

Stored size: 455 Bytes

Contents

# This class encapsulates the pattern of faking STD IO and exposing the streams
# for testing.
class FauxIO
  def initialize(&_block)
    original_stdout = $stdout
    original_stderr = $stderr
    $stdout = @stdout = StringIO.new
    $stderr = @stderr = StringIO.new
    yield
  rescue SystemExit
  ensure
    $stdout = original_stdout
    $stderr = original_stderr
  end

  def stdout
    @stdout.string
  end

  def stderr
    @stderr.string
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
brightbox-cli-5.0.0.rc2 spec/support/faux_io.rb
brightbox-cli-5.0.0.rc1 spec/support/faux_io.rb
brightbox-cli-5.0.0.alpha spec/support/faux_io.rb
brightbox-cli-4.8.0 spec/support/faux_io.rb
brightbox-cli-4.7.0 spec/support/faux_io.rb
brightbox-cli-4.6.0 spec/support/faux_io.rb
brightbox-cli-4.5.0 spec/support/faux_io.rb
brightbox-cli-4.5.0.rc1 spec/support/faux_io.rb
brightbox-cli-4.4.0 spec/support/faux_io.rb
brightbox-cli-4.3.2 spec/support/faux_io.rb
brightbox-cli-4.3.1 spec/support/faux_io.rb
brightbox-cli-4.3.0 spec/support/faux_io.rb
brightbox-cli-4.2.1 spec/support/faux_io.rb
brightbox-cli-4.2.0 spec/support/faux_io.rb
brightbox-cli-4.1.0 spec/support/faux_io.rb
brightbox-cli-4.0.0 spec/support/faux_io.rb
brightbox-cli-4.0.0.rc2 spec/support/faux_io.rb
brightbox-cli-3.3.0 spec/support/faux_io.rb
brightbox-cli-3.2.0 spec/support/faux_io.rb
brightbox-cli-3.1.0 spec/support/faux_io.rb