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-9.0.24 spec/support/output_helpers.rb
omnibus-9.0.23 spec/support/output_helpers.rb
omnibus-9.0.22 spec/support/output_helpers.rb
omnibus-9.0.17 spec/support/output_helpers.rb
omnibus-9.0.12 spec/support/output_helpers.rb
omnibus-9.0.11 spec/support/output_helpers.rb
omnibus-9.0.8 spec/support/output_helpers.rb
omnibus-8.3.2 spec/support/output_helpers.rb
omnibus-8.2.2 spec/support/output_helpers.rb
omnibus-8.1.15 spec/support/output_helpers.rb
omnibus-8.0.15 spec/support/output_helpers.rb
omnibus-8.0.9 spec/support/output_helpers.rb
omnibus-7.0.34 spec/support/output_helpers.rb
omnibus-7.0.13 spec/support/output_helpers.rb
omnibus-7.0.12 spec/support/output_helpers.rb
omnibus-6.1.9 spec/support/output_helpers.rb
omnibus-6.1.7 spec/support/output_helpers.rb
omnibus-6.1.4 spec/support/output_helpers.rb
omnibus-6.0.30 spec/support/output_helpers.rb
omnibus-6.0.25 spec/support/output_helpers.rb