Sha256: bd4f5ddb8e6f1a2c917e741b397a6576fa07df5553196c7b6999185a7b0c8a31

Contents?: true

Size: 1.54 KB

Versions: 18

Compression:

Stored size: 1.54 KB

Contents

# This test requires UI be not defined to simulate using plugin outside Guard

require 'guard/compat/plugin'

Guard.send(:remove_const, :UI) if Guard.const_defined?(:UI)

RSpec.describe Guard::Compat do
  context 'when Guard is not loaded' do
    describe '.color' do
      it 'returns uncolored text' do
        expect(Guard::Compat::UI.color('foo', 'red')).to eq('foo')
      end
    end

    describe '.color_enabled?' do
      it 'returns false' do
        expect(Guard::Compat::UI.color_enabled?).to be(false)
      end
    end

    describe '.info' do
      it 'outputs to stdout' do
        expect($stdout).to receive(:puts).with('foo')
        Guard::Compat::UI.info('foo')
      end
    end

    describe '.warning' do
      it 'outputs to stdout' do
        expect($stdout).to receive(:puts).with('foo')
        Guard::Compat::UI.warning('foo')
      end
    end

    describe '.error' do
      it 'outputs to stdout' do
        expect($stderr).to receive(:puts).with('foo')
        Guard::Compat::UI.error('foo')
      end
    end

    describe '.debug' do
      it 'outputs to stdout' do
        expect($stdout).to receive(:puts).with('foo')
        Guard::Compat::UI.debug('foo')
      end
    end

    describe '.deprecation' do
      it 'outputs to stdout' do
        expect($stdout).to receive(:puts).with('foo')
        Guard::Compat::UI.deprecation('foo')
      end
    end

    describe '.notify' do
      it 'outputs to stdout' do
        expect($stdout).to receive(:puts).with('foo')
        Guard::Compat::UI.notify('foo')
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 9 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
op_connect-0.1.2 vendor/bundle/ruby/3.1.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
comiditaULL-0.1.1 vendor/bundle/ruby/2.3.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
comidita_ull-0.1.1 vendor/bundle/ruby/2.3.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
comidita_ull-0.1.0 vendor/bundle/ruby/2.3.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
gameboard-3.1.0 vendor/bundle/ruby/2.3.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
gameboard-3.0.0 vendor/bundle/ruby/2.3.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
mastermind_adeybee-0.1.4 vendor/bundle/ruby/2.2.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
mastermind_adeybee-0.1.3 vendor/bundle/ruby/2.2.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
mastermind_adeybee-0.1.2 vendor/bundle/ruby/2.2.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
mastermind_adeybee-0.1.1 vendor/bundle/ruby/2.2.0/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
geminfo-0.1.0 path/gems/guard-compat-1.2.1/spec/guard/compat/no_guard_spec.rb
guard-compat-1.2.1 spec/guard/compat/no_guard_spec.rb
guard-compat-1.2.0 spec/guard/compat/no_guard_spec.rb