Sha256: 737c82e9ad66402ff30411a1c52a5e90382a9ff9c23ae4459c24f49789e33663

Contents?: true

Size: 534 Bytes

Versions: 33

Compression:

Stored size: 534 Bytes

Contents

module Omnibus
  module RSpec
    module OutputHelpers
      #
      # Capture stdout within this block.
      #
      def capture_stdout(&block)
        old = $stdout
        $stdout = fake = StringIO.new
        yield
        fake.string
      ensure
        $stdout = old
      end

      #
      # Capture stderr within this block.
      #
      def capture_stderr(&block)
        old = $stderr
        $stderr = fake = StringIO.new
        yield
        fake.string
      ensure
        $stderr = old
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
omnibus-6.0.24 spec/support/output_helpers.rb
omnibus-6.0.1 spec/support/output_helpers.rb
omnibus-5.6.8 spec/support/output_helpers.rb
omnibus-5.6.6 spec/support/output_helpers.rb
omnibus-5.6.1 spec/support/output_helpers.rb
omnibus-5.6.0 spec/support/output_helpers.rb
omnibus-5.5.0 spec/support/output_helpers.rb
omnibus-5.4.0 spec/support/output_helpers.rb
omnibus-5.3.0 spec/support/output_helpers.rb
omnibus-5.2.0 spec/support/output_helpers.rb
omnibus-5.1.0 spec/support/output_helpers.rb
omnibus-5.0.0 spec/support/output_helpers.rb
omnibus-4.1.0 spec/support/output_helpers.rb