Sha256: a043ef5a907028babd911b542c045a95b5e65e690436e9dc796f91cb60216a78

Contents?: true

Size: 550 Bytes

Versions: 5

Compression:

Stored size: 550 Bytes

Contents

# Capturing the stdout
# Need to rescue SystemExit
# https://github.com/cldwalker/hirb/blob/master/test/test_helper.rb
def capture_stdout(&block)
  original_stdout = $stdout
  fake_stdout = StringIO.new
  $stdout = fake_stdout
  begin
    yield
  rescue SystemExit
  ensure
    $stdout = original_stdout
  end
  return fake_stdout.string
end

# for hiding the stdout from tests
def hide_stdout(&block)
  original_stdout = $stdout
  fake_stdout = StringIO.new
  $stdout = fake_stdout
  begin
    yield
  ensure
    $stdout = original_stdout
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
snapdragon-1.0.0 spec/spec_helper.rb
snapdragon-0.2.0 spec/spec_helper.rb
snapdragon-0.1.12 spec/spec_helper.rb
snapdragon-0.1.11 spec/spec_helper.rb
snapdragon-0.1.10 spec/spec_helper.rb