Sha256: 62dac611a52497543fd2612ef7f610a7344319cf09fe2ef00ecb29547bb0f772

Contents?: true

Size: 837 Bytes

Versions: 12

Compression:

Stored size: 837 Bytes

Contents

# frozen_string_literal: true
require_relative 'helper'
require 'sidekiq/logging'

class TestLogging < Sidekiq::Test
  describe Sidekiq::Logging do
    describe "#with_context" do
      def context
        Sidekiq::Logging.logger.formatter.context
      end

      it "has no context by default" do
        context.must_equal nil
      end

      it "can add a context" do
        Sidekiq::Logging.with_context "xx" do
          context.must_equal " xx"
        end
        context.must_equal nil
      end

      it "can use multiple contexts" do
        Sidekiq::Logging.with_context "xx" do
          context.must_equal " xx"
          Sidekiq::Logging.with_context "yy" do
            context.must_equal " xx yy"
          end
          context.must_equal " xx"
        end
        context.must_equal nil
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
sidekiq-4.2.7 test/test_logging.rb
sidekiq-4.2.6 test/test_logging.rb
sidekiq-4.2.5 test/test_logging.rb
sidekiq-4.2.4 test/test_logging.rb
sidekiq-4.2.3 test/test_logging.rb
sidekiq-4.2.2 test/test_logging.rb
sidekiq-4.2.1 test/test_logging.rb
sidekiq-4.2.0 test/test_logging.rb
sidekiq-4.1.4 test/test_logging.rb
sidekiq-4.1.3 test/test_logging.rb
sr-sidekiq-4.1.6 test/test_logging.rb
sidekiq-4.1.2 test/test_logging.rb