Sha256: ce2d18daaf57c1b106ef939e3c97f1b257851e1a594ee7161da16b43e484f541

Contents?: true

Size: 940 Bytes

Versions: 11

Compression:

Stored size: 940 Bytes

Contents

describe Rake::Funnel::Extensions::DisableColors do
  context 'when connected to a terminal' do
    before { allow($stdout).to receive(:tty?).and_return(true) }

    it 'should color strings' do
      expect('foo'.colored.green).to eq("\e[32mfoo\e[0m")
    end

    it 'should color strings with extension' do
      expect('foo'.green).to eq("\e[32mfoo\e[0m")
    end

    it 'should support combinators' do
      expect('foo'.green.inverse.bold).to eq("\e[1;7;32mfoo\e[0m")
    end
  end

  context 'when not connected to a terminal' do
    before { allow($stdout).to receive(:tty?).and_return(false) }

    it 'should not color strings' do
      expect('foo'.colored.green).to eq('foo')
    end

    it 'should not color strings with extension' do
      expect('foo'.green).to eq('foo')
    end

    it 'should support combinators' do
      expect('foo'.green.inverse.bold).to eq('foo')
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rake-funnel-0.3.2.pre spec/rake/funnel/extensions/disable_colors_spec.rb
rake-funnel-0.3.1.pre spec/rake/funnel/extensions/disable_colors_spec.rb
rake-funnel-0.3.0.pre spec/rake/funnel/extensions/disable_colors_spec.rb
rake-funnel-0.2.0.pre spec/rake/funnel/extensions/disable_colors_spec.rb
rake-funnel-0.1.0.pre spec/rake/funnel/extensions/disable_colors_spec.rb
rake-funnel-0.0.6.pre spec/rake/funnel/extensions/disable_colors_spec.rb
rake-funnel-0.0.5.pre spec/rake/funnel/extensions/disable_colors_spec.rb
rake-funnel-0.0.4.pre spec/rake/funnel/extensions/disable_colors_spec.rb
rake-funnel-0.0.3.pre spec/rake/funnel/extensions/disable_colors_spec.rb
rake-funnel-0.0.2.pre spec/rake/funnel/extensions/disable_colors_spec.rb
rake-funnel-0.0.1.pre spec/rake/funnel/extensions/disable_colors_spec.rb