mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
![Andrew Babichev](/assets/img/avatar_default.png)
* Refactor CLI test Extracted 3 main parts: - parse - run - signal handling * Move demonization and pid write from parse to run phase * Move queues default from validate to setup options phase * Add pry-byebug gem * Drop Sidekiq::Test * Require launcher in CLI * Remove TODOs
35 lines
806 B
Ruby
35 lines
806 B
Ruby
# frozen_string_literal: true
|
|
require_relative 'helper'
|
|
require 'sidekiq/logging'
|
|
|
|
class TestLogging < Minitest::Test
|
|
describe Sidekiq::Logging do
|
|
describe "#with_context" do
|
|
def ctx
|
|
Sidekiq::Logging.logger.formatter.context
|
|
end
|
|
|
|
it "has no context by default" do
|
|
assert_nil ctx
|
|
end
|
|
|
|
it "can add a context" do
|
|
Sidekiq::Logging.with_context "xx" do
|
|
assert_equal " xx", ctx
|
|
end
|
|
assert_nil ctx
|
|
end
|
|
|
|
it "can use multiple contexts" do
|
|
Sidekiq::Logging.with_context "xx" do
|
|
assert_equal " xx", ctx
|
|
Sidekiq::Logging.with_context "yy" do
|
|
assert_equal " xx yy", ctx
|
|
end
|
|
assert_equal " xx", ctx
|
|
end
|
|
assert_nil ctx
|
|
end
|
|
end
|
|
end
|
|
end
|