1
0
mirror of https://github.com/meineerde/rackstash.git synced 2026-02-01 01:37:12 +00:00

Add a shortcut to enable auto_flush on a Flow with Flow#auto_flush!

This commit is contained in:
Holger Just 2018-05-16 20:46:59 +02:00
parent d502bece9c
commit cdc237897f
2 changed files with 15 additions and 0 deletions

View File

@ -137,6 +137,14 @@ module Rackstash
@auto_flush
end
# Enable the {#auto_flush} feature for the current flow.
#
# @return [true]
# @see #auto_flush
def auto_flush!
self.auto_flush = true
end
# @param bool [Bool] `true` to cause buffering Buffers to write their added
# messages and fields to the flow as soon as they are logged, `false` to
# write the whole event only on an explicit call to {Buffer#flush}.

View File

@ -113,6 +113,13 @@ RSpec.describe Rackstash::Flow do
end
end
describe '#auto_flush!' do
it 'enables the auto_flush property' do
flow.auto_flush!
expect(flow.auto_flush?).to eql true
end
end
describe '#close!' do
it 'calls adapter#close' do
expect(adapter).to receive(:close).and_return(true)