1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-10-17 14:01:01 +00:00

Add tests for Flow#auto_flush

This commit is contained in:
Holger Just 2018-05-16 20:44:42 +02:00
parent 3b5ff3a4dc
commit d502bece9c

View File

@ -69,6 +69,50 @@ RSpec.describe Rackstash::Flow do
end
end
describe '#auto_flush' do
it 'defaults to false' do
expect(flow.auto_flush).to eql false
end
it 'sets a boolean value' do
flow.auto_flush(true)
expect(flow.auto_flush).to eql true
expect(flow.auto_flush?).to eql true
flow.auto_flush(false)
expect(flow.auto_flush).to eql false
expect(flow.auto_flush?).to eql false
flow.auto_flush('something')
expect(flow.auto_flush).to eql true
expect(flow.auto_flush?).to eql true
end
it 'ignores a nil argument' do
flow.auto_flush(true)
expect(flow.auto_flush).to eql true
flow.auto_flush(nil)
expect(flow.auto_flush?).to eql true
end
end
describe '#auto_flush=' do
it 'sets a boolean value' do
flow.auto_flush = true
expect(flow.auto_flush?).to eql true
flow.auto_flush = false
expect(flow.auto_flush?).to eql false
flow.auto_flush = 'something'
expect(flow.auto_flush?).to eql true
flow.auto_flush = nil
expect(flow.auto_flush?).to eql false
end
end
describe '#close!' do
it 'calls adapter#close' do
expect(adapter).to receive(:close).and_return(true)