Sha256: ebc7db3b5919d1abe56b6c2470638d31ab0ed50f00e45690aa8ab23a390009b4
Contents?: true
Size: 938 Bytes
Versions: 3
Compression:
Stored size: 938 Bytes
Contents
# frozen_string_literal: true 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
3 entries across 3 versions & 1 rubygems