Sha256: 7b5e1e1bf70d15ac33ae19f10a9556d5162e2c977e7c3e0dddbd2bb0953dd010

Contents?: true

Size: 1.67 KB

Versions: 26

Compression:

Stored size: 1.67 KB

Contents

describe Knapsack::Logger do
  let(:text) { 'Text' }

  describe '#debug' do
    before { subject.level = level }

    context 'when level is DEBUG' do
      let(:level) { described_class::DEBUG }
      it { expect { subject.debug(text) }.to output(/#{text}/).to_stdout }
    end

    context 'when level is INFO' do
      let(:level) { described_class::INFO }
      it { expect { subject.debug(text) }.to output('').to_stdout }
    end

    context 'when level is WARN' do
      let(:level) { described_class::WARN }
      it { expect { subject.debug(text) }.to output('').to_stdout }
    end
  end

  describe '#info' do
    before { subject.level = level }

    context 'when level is DEBUG' do
      let(:level) { described_class::DEBUG }
      it { expect { subject.info(text) }.to output(/#{text}/).to_stdout }
    end

    context 'when level is INFO' do
      let(:level) { described_class::INFO }
      it { expect { subject.info(text) }.to output(/#{text}/).to_stdout }
    end

    context 'when level is WARN' do
      let(:level) { described_class::WARN }
      it { expect { subject.info(text) }.to output('').to_stdout }
    end
  end

  describe '#warn' do
    before { subject.level = level }

    context 'when level is DEBUG' do
      let(:level) { described_class::DEBUG }
      it { expect { subject.warn(text) }.to output(/#{text}/).to_stdout }
    end

    context 'when level is INFO' do
      let(:level) { described_class::INFO }
      it { expect { subject.warn(text) }.to output(/#{text}/).to_stdout }
    end

    context 'when level is WARN' do
      let(:level) { described_class::WARN }
      it { expect { subject.warn(text) }.to output(/#{text}/).to_stdout }
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
knapsack-1.9.0 spec/knapsack/logger_spec.rb
knapsack-1.8.0 spec/knapsack/logger_spec.rb
knapsack-1.7.0 spec/knapsack/logger_spec.rb
knapsack-1.6.1 spec/knapsack/logger_spec.rb
knapsack-1.6.0 spec/knapsack/logger_spec.rb
knapsack-1.5.1 spec/knapsack/logger_spec.rb
knapsack-1.5.0 spec/knapsack/logger_spec.rb
knapsack-1.4.1 spec/knapsack/logger_spec.rb
knapsack-1.4.0 spec/knapsack/logger_spec.rb
knapsack-1.3.4 spec/knapsack/logger_spec.rb
knapsack-1.3.3 spec/knapsack/logger_spec.rb
knapsack-1.3.1 spec/knapsack/logger_spec.rb
knapsack-1.3.0 spec/knapsack/logger_spec.rb
knapsack-1.2.1 spec/knapsack/logger_spec.rb
knapsack-1.2.0 spec/knapsack/logger_spec.rb
knapsack-1.1.1 spec/knapsack/logger_spec.rb
knapsack-1.1.0 spec/knapsack/logger_spec.rb
knapsack-1.0.4 spec/knapsack/logger_spec.rb
knapsack-1.0.3 spec/knapsack/logger_spec.rb
knapsack-1.0.2 spec/knapsack/logger_spec.rb