Skip to content

Commit

Permalink
WIP Adding a test
Browse files Browse the repository at this point in the history
  • Loading branch information
mayorova committed May 29, 2023
1 parent cf91669 commit 79e97d6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/unit/sidekiq_initializer_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require 'test_helper'
require 'sidekiq/manager'

class SidekiqInitializerTest < ActiveSupport::TestCase

test 'log job arguments' do
options = {:queues => ['default']}

logger = Sidekiq.logger = Sidekiq::Logging.initialize_logger

mgr = Sidekiq::Manager.new(options)
processor = ::Sidekiq::Processor.new(mgr)

invoice = FactoryBot.create(:invoice)

msg = Sidekiq.dump_json({ 'class' => InvoiceFriendlyIdWorker.to_s, 'args' => [invoice.id] })
job = Sidekiq::BasicFetch::UnitOfWork.new('queue:default', msg)
processor.send(:process, job)

# Sidekiq.logger.expects(:info) #.with { |message| message.match("ARGS-[#{invoice.id}]") }

logger.expects(:info)
end
end

0 comments on commit 79e97d6

Please sign in to comment.