Sha256: 02ecb2b3a70e256a3347b3be2f9dfd3fbc90bbd84ddc42b021acb44da582f460

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

require_relative '../test_helper'

module Appender
  class AsyncTest < Minitest::Test
    describe SemanticLogger::Appender::Async do
      include InMemoryAppenderHelper

      describe 'with capped queue' do
        let :appender_options do
          {appender: appender, async: true}
        end

        it 'uses the async proxy' do
          assert_instance_of SemanticLogger::Appender::Async, added_appender
        end

        it 'logs message immediately' do
          logger.info('hello world')

          assert log = log_message
          assert_equal 'hello world', log.message
        end

        it 'uses an capped queue' do
          assert_instance_of SizedQueue, added_appender.queue
        end
      end

      describe 'with uncapped queue' do
        let :appender_options do
          {appender: appender, async: true, max_queue_size: -1}
        end

        it 'uses the async proxy' do
          assert_instance_of SemanticLogger::Appender::Async, added_appender
        end

        it 'uses an uncapped queue' do
          assert_instance_of Queue, added_appender.queue
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
semantic_logger-4.3.1 test/appender/async_test.rb
semantic_logger-4.3.0 test/appender/async_test.rb
semantic_logger-4.2.2 test/appender/async_test.rb
semantic_logger-4.2.1 test/appender/async_test.rb