1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-12-19 15:01:12 +00:00

Test that a Logger can be created without defining flows

This commit is contained in:
Holger Just 2017-09-21 22:29:39 +02:00
parent 20e3f28273
commit bcc481bfbe

View File

@ -13,11 +13,15 @@ describe Rackstash::Logger do
let(:logger) { described_class.new(target) }
describe '#initialize' do
it 'requires flows' do
it 'accepts flows' do
expect(Rackstash::Sink).to receive(:new).with('output.log')
described_class.new('output.log')
end
it 'does not require any flows' do
expect(described_class.new).to be_instance_of described_class
end
it 'allows to set #level' do
logger = described_class.new('output.log', level: 'ERROR')
expect(logger.level).to eql 3
@ -64,6 +68,10 @@ describe Rackstash::Logger do
expect(block_called).to eql 1
expect(block_self).to be_instance_of(Rackstash::Flow)
end
it 'does not yield without given flows' do
expect { |b| described_class.new(&b) }.not_to yield_control
end
end
describe 'subscript accessors' do