Sha256: 4f16e075c7a4ce37295cd8bde57cb24c80e7b10c11102d009a9d1d5e7b80ccb0
Contents?: true
Size: 1.59 KB
Versions: 4
Compression:
Stored size: 1.59 KB
Contents
require_relative '../test_helper' module Appender class AsyncBatchTest < Minitest::Test describe SemanticLogger::Appender::Async do include InMemoryAppenderHelper let :appender do InMemoryBatchAppender.new end describe 'with default batch_size' do let :appender_options do {appender: appender, batch: true} end it 'uses the batch proxy' do assert_instance_of SemanticLogger::Appender::AsyncBatch, added_appender end it 'logs messages after a flush' do logger.info('hello world1') refute appender.message logger.info('hello world2') refute appender.message logger.info('hello world3') refute appender.message # Calls flush assert logs = log_message assert_equal 3, logs.size, logs assert_equal 'hello world1', logs[0].message assert_equal 'hello world2', logs[1].message assert_equal 'hello world3', logs[2].message end end # :batch_size, :batch_seconds describe 'with batch_size 1' do let :appender_options do {appender: appender, batch: true, batch_size: 1} end it 'uses the batch proxy' do assert_instance_of SemanticLogger::Appender::AsyncBatch, added_appender end it 'logs message immediately' do logger.info('hello world') assert logs = log_message assert_equal 1, logs.size, logs assert_equal 'hello world', logs.first.message end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems