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.0.1 spec/knapsack/logger_spec.rb
knapsack-1.0.0 spec/knapsack/logger_spec.rb
knapsack-0.5.0 spec/knapsack/logger_spec.rb
knapsack-0.4.0 spec/knapsack/logger_spec.rb
knapsack-0.3.0 spec/knapsack/logger_spec.rb
knapsack-0.2.0 spec/knapsack/logger_spec.rb