Sha256: 26df8c389b91cb5b22ca6033faff4e891209e9a84db74ce10d64fd1c53383547

Contents?: true

Size: 1.39 KB

Versions: 34

Compression:

Stored size: 1.39 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
require 'inch/utils/buffered_ui'

describe ::Inch::Utils::BufferedUI do
  let(:described_class) { ::Inch::Utils::BufferedUI }
  it 'should trace' do
    out, err = capture_io do
      @instance = described_class.new
      @instance.trace('Test')
    end
    assert out.empty?, 'there should be output'
    assert err.empty?, 'there should be no errors'
    refute @instance.buffer.empty?
  end

  it 'should trace header' do
    out, err = capture_io do
      @instance = described_class.new
      @instance.header('Test', :red)
    end
    assert out.empty?, 'there should be output'
    assert err.empty?, 'there should be no errors'
    refute @instance.buffer.empty?
  end

  it 'should trace debug if ENV variable is set' do
    ENV['DEBUG'] = '1'
    out, err = capture_io do
      @instance = described_class.new
      @instance.debug('Test')
    end
    ENV['DEBUG'] = nil
    assert out.empty?, 'there should be output'
    assert err.empty?, 'there should be no errors'
    refute @instance.buffer.empty?
  end

  it 'should not trace debug if ENV variable is set' do
    refute ENV['DEBUG']
    out, err = capture_io do
      @instance = described_class.new
      @instance.debug('Test')
    end
    assert out.empty?, 'there should be no output'
    assert err.empty?, 'there should be no errors'
    assert @instance.buffer.empty?
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
inch-0.9.0.rc1 test/unit/utils/buffered_ui_test.rb
inch-0.8.0 test/unit/utils/buffered_ui_test.rb
inch-0.8.0.rc2 test/unit/utils/buffered_ui_test.rb
inch-0.8.0.rc1 test/unit/utils/buffered_ui_test.rb
inch-0.7.1 test/unit/utils/buffered_ui_test.rb
inch-0.7.0 test/unit/utils/buffered_ui_test.rb
inch-0.6.4 test/unit/utils/buffered_ui_test.rb
inch-0.6.3 test/unit/utils/buffered_ui_test.rb
inch-0.6.2 test/unit/utils/buffered_ui_test.rb
inch-0.6.1 test/unit/utils/buffered_ui_test.rb
inch-0.6.0 test/unit/utils/buffered_ui_test.rb
inch-0.6.0.rc6 test/unit/utils/buffered_ui_test.rb
inch-0.6.0.rc5 test/unit/utils/buffered_ui_test.rb
inch-0.6.0.rc4 test/unit/utils/buffered_ui_test.rb
inch-0.6.0.rc3 test/unit/utils/buffered_ui_test.rb
inch-0.6.0.rc2 test/unit/utils/buffered_ui_test.rb
inch-0.6.0.rc1 test/unit/utils/buffered_ui_test.rb
inch-0.5.10 test/unit/utils/buffered_ui_test.rb
inch-0.5.9 test/unit/utils/buffered_ui_test.rb
inch-0.5.8 test/unit/utils/buffered_ui_test.rb