Sha256: 24c1f1616c55445da2c4ea368c9f461deeb91cfffcb34d62a3bda233bc108f98

Contents?: true

Size: 475 Bytes

Versions: 18

Compression:

Stored size: 475 Bytes

Contents

module Lolcommits
  module TestHelpers
    module FakeIO
      # stdout captured and returned
      # stdin mapped to inputs an IO stream seperated with enter key presses
      def fake_io_capture(inputs: [])
        input_stream = "#{inputs.join("\r\n")}\r\n"
        $stdin       = StringIO.new(input_stream)
        $stdout      = StringIO.new

        yield

        $stdout.string
      ensure
        $stdin = STDIN
        $stdout = STDOUT
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
lolcommits-0.12.1 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.12.0 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.11.0 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.11.0.pre lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.10.0 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.10.0.pre1 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.9.8 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.9.7 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.9.7.pre1 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.9.6 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.9.5 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.9.5.pre1 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.9.4 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.9.4.pre1 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.9.3 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.9.3.pre3 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.9.3.pre2 lib/lolcommits/test_helpers/fake_io.rb
lolcommits-0.9.3.pre1 lib/lolcommits/test_helpers/fake_io.rb