Sha256: 192dfac89db7cc989c6259122bcc92eaaab2ecf83d1e8ede22c3e955662da2a7

Contents?: true

Size: 440 Bytes

Versions: 76

Compression:

Stored size: 440 Bytes

Contents

class FakeStdOut
  attr_reader :strings

  def initialize
    @strings = []
  end

  def puts(string=nil)
    @strings << string unless string.nil?
  end

  def write(x)
    puts(x)
  end

  def printf(*args)
    puts(Kernel.printf(*args))
  end

  # Returns true if the regexp matches anything in the output
  def contained?(regexp)
    strings.find{ |x| x =~ regexp }
  end

  def flush; end

  def to_s
    @strings.join("\n")
  end
end

Version data entries

76 entries across 76 versions & 3 rubygems

Version Path
gli-2.22.2 test/unit/support/fake_std_out.rb
gli-2.22.1 test/unit/support/fake_std_out.rb
curlyq-0.0.16 test/helpers/fake_std_out.rb
curlyq-0.0.15 test/helpers/fake_std_out.rb
curlyq-0.0.14 test/helpers/fake_std_out.rb
curlyq-0.0.13 test/helpers/fake_std_out.rb
gli-2.22.0 test/unit/support/fake_std_out.rb
gli-2.21.5 test/unit/support/fake_std_out.rb
gli-2.21.4 test/unit/support/fake_std_out.rb
gli-2.21.3 test/unit/support/fake_std_out.rb
gli-2.21.2 test/unit/support/fake_std_out.rb
curlyq-0.0.12 test/helpers/fake_std_out.rb
curlyq-0.0.11 test/helpers/fake_std_out.rb
curlyq-0.0.10 test/helpers/fake_std_out.rb
curlyq-0.0.9 test/helpers/fake_std_out.rb
curlyq-0.0.8 test/helpers/fake_std_out.rb
curlyq-0.0.7 test/helpers/fake_std_out.rb
curlyq-0.0.6 test/helpers/fake_std_out.rb
gli-2.21.1 test/unit/support/fake_std_out.rb
gli-2.21.0 test/unit/support/fake_std_out.rb