aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test
diff options
context:
space:
mode:
Diffstat (limited to 'activejob/test')
-rw-r--r--activejob/test/cases/test_case_test.rb8
-rw-r--r--activejob/test/helper.rb2
-rw-r--r--activejob/test/integration/queuing_test.rb15
-rw-r--r--activejob/test/support/integration/test_case_helpers.rb4
4 files changed, 20 insertions, 9 deletions
diff --git a/activejob/test/cases/test_case_test.rb b/activejob/test/cases/test_case_test.rb
index 0a3a20d5a0..ee816e1dd5 100644
--- a/activejob/test/cases/test_case_test.rb
+++ b/activejob/test/cases/test_case_test.rb
@@ -5,11 +5,11 @@ require 'jobs/nested_job'
class ActiveJobTestCaseTest < ActiveJob::TestCase
# this tests that this job class doesn't get its adapter set.
- # that's the correct behaviour since we don't want to break
- # the `class_attribute` inheritence
- class TestClassAttributeInheritenceJob < ActiveJob::Base
+ # that's the correct behavior since we don't want to break
+ # the `class_attribute` inheritance
+ class TestClassAttributeInheritanceJob < ActiveJob::Base
def self.queue_adapter=(*)
- raise 'Attemping to break `class_attribute` inheritence, bad!'
+ raise 'Attemping to break `class_attribute` inheritance, bad!'
end
end
diff --git a/activejob/test/helper.rb b/activejob/test/helper.rb
index 72ec2b8904..57907042d9 100644
--- a/activejob/test/helper.rb
+++ b/activejob/test/helper.rb
@@ -14,5 +14,3 @@ else
end
require 'active_support/testing/autorun'
-
-ActiveSupport::TestCase.test_order = :random
diff --git a/activejob/test/integration/queuing_test.rb b/activejob/test/integration/queuing_test.rb
index 96794ffef3..d345092dee 100644
--- a/activejob/test/integration/queuing_test.rb
+++ b/activejob/test/integration/queuing_test.rb
@@ -11,7 +11,7 @@ class QueuingTest < ActiveSupport::TestCase
end
test 'should not run jobs queued on a non-listening queue' do
- skip if adapter_is?(:inline) || adapter_is?(:sucker_punch) || adapter_is?(:que)
+ skip if adapter_is?(:inline, :sucker_punch, :que)
old_queue = TestJob.queue_name
begin
@@ -55,4 +55,17 @@ class QueuingTest < ActiveSupport::TestCase
skip
end
end
+
+ test 'should supply a provider_job_id when available for immediate jobs' do
+ skip unless adapter_is?(:delayed_job, :sidekiq, :qu, :que)
+ test_job = TestJob.perform_later @id
+ refute test_job.provider_job_id.nil?, 'Provider job id should be set by provider'
+ end
+
+ test 'should supply a provider_job_id when available for delayed jobs' do
+ skip unless adapter_is?(:delayed_job, :sidekiq, :que)
+ delayed_test_job = TestJob.set(wait: 1.minute).perform_later @id
+ refute delayed_test_job.provider_job_id.nil?,
+ 'Provider job id should by set for delayed jobs by provider'
+ end
end
diff --git a/activejob/test/support/integration/test_case_helpers.rb b/activejob/test/support/integration/test_case_helpers.rb
index bed28b2900..7e87ede275 100644
--- a/activejob/test/support/integration/test_case_helpers.rb
+++ b/activejob/test/support/integration/test_case_helpers.rb
@@ -27,8 +27,8 @@ module TestCaseHelpers
jobs_manager.clear_jobs
end
- def adapter_is?(adapter_class_symbol)
- ActiveJob::Base.queue_adapter.class.name.split("::").last.gsub(/Adapter$/, '').underscore == adapter_class_symbol.to_s
+ def adapter_is?(*adapter_class_symbols)
+ adapter_class_symbols.map(&:to_s).include?(ActiveJob::Base.queue_adapter.class.name.split("::").last.gsub(/Adapter$/, '').underscore)
end
def wait_for_jobs_to_finish_for(seconds=60)