Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add optional Sidekiq::Job alias, see #4955
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |