spec/knapsack_spec.rb in knapsack-0.1.4 vs spec/knapsack_spec.rb in knapsack-0.2.0

- old
+ new

@@ -26,6 +26,34 @@ expect(Knapsack::TaskLoader).to receive(:new).and_return(task_loader) expect(task_loader).to receive(:load_tasks) described_class.load_tasks end end + + describe '.logger' do + subject { described_class.logger } + + before { described_class.logger = nil } + after { described_class.logger = nil } + + context 'when default logger' do + let(:logger) { instance_double(Knapsack::Logger) } + + before do + expect(Knapsack::Logger).to receive(:new).and_return(logger) + expect(logger).to receive(:level=).with(Knapsack::Logger::INFO) + end + + it { should eql logger } + end + + context 'when custom logger' do + let(:logger) { double('custom logger') } + + before do + described_class.logger = logger + end + + it { should eql logger } + end + end end