aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/integration
diff options
context:
space:
mode:
authorMike Perham <mperham@gmail.com>2015-03-23 15:16:07 -0700
committerMike Perham <mperham@gmail.com>2015-03-23 15:16:07 -0700
commit8d2b1406bc201d8705e931b6f043441930f2e8ac (patch)
treecbe7265263418ba20eb3cb2a3d7794b62640d493 /activejob/test/integration
parent4a0f314d8a54c090e53400f84508a3118c0fe2b4 (diff)
downloadrails-8d2b1406bc201d8705e931b6f043441930f2e8ac.tar.gz
rails-8d2b1406bc201d8705e931b6f043441930f2e8ac.tar.bz2
rails-8d2b1406bc201d8705e931b6f043441930f2e8ac.zip
Pass wrapped class name to Sidekiq for logging purposes
Sidekiq logs the name of the job class being performed. Because ActiveJob wraps the class, this means every job logs as an AJ::JobWrapper instead of the actual class name. Will help fix mperham/sidekiq#2248
Diffstat (limited to 'activejob/test/integration')
-rw-r--r--activejob/test/integration/queuing_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activejob/test/integration/queuing_test.rb b/activejob/test/integration/queuing_test.rb
index 38874b51a8..af19a92118 100644
--- a/activejob/test/integration/queuing_test.rb
+++ b/activejob/test/integration/queuing_test.rb
@@ -1,5 +1,6 @@
require 'helper'
require 'jobs/logging_job'
+require 'jobs/hello_job'
require 'active_support/core_ext/numeric/time'
class QueuingTest < ActiveSupport::TestCase
@@ -23,6 +24,18 @@ class QueuingTest < ActiveSupport::TestCase
end
end
+ test 'should supply a wrapped class name to Sidekiq' do
+ skip unless adapter_is?(:sidekiq)
+ require 'sidekiq/testing'
+
+ Sidekiq::Testing.fake! do
+ ::HelloJob.perform_later
+ hash = ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper.jobs.first
+ assert_equal "ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper", hash['class']
+ assert_equal "HelloJob", hash['wrapped']
+ end
+ end
+
test 'should not run job enqueued in the future' do
begin
TestJob.set(wait: 10.minutes).perform_later @id