Skip to content

Commit

Permalink
Add optional Sidekiq::Job alias, see #4955
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Aug 20, 2021
1 parent f1b24da commit 8e36432
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/sidekiq/job.rb
@@ -0,0 +1,8 @@
require "sidekiq/worker"

module Sidekiq
# Sidekiq::Job is a new alias for Sidekiq::Worker, coming in 6.3.0.
# You can opt into this by requiring 'sidekiq/job' in your initializer
# and then using `include Sidekiq::Job` rather than `Sidekiq::Worker`.
Job = Worker
end
13 changes: 13 additions & 0 deletions test/test_job.rb
@@ -0,0 +1,13 @@
require_relative "helper"
require "sidekiq/job"

class TestJob < Minitest::Test
class SomeJob
include Sidekiq::Job
end

def test_sidekiq_job
SomeJob.perform_async
assert_equal "TestJob::SomeJob", Sidekiq::Queue.new.first.klass
end
end

0 comments on commit 8e36432

Please sign in to comment.