diff options
-rw-r--r-- | activejob/lib/active_job/test_helper.rb | 2 | ||||
-rw-r--r-- | activejob/test/cases/test_helper_test.rb | 7 | ||||
-rw-r--r-- | activejob/test/jobs/application_job.rb | 4 | ||||
-rw-r--r-- | activejob/test/jobs/inherited_job.rb | 5 |
4 files changed, 17 insertions, 1 deletions
diff --git a/activejob/lib/active_job/test_helper.rb b/activejob/lib/active_job/test_helper.rb index 35fee7452c..bbd2a0c06c 100644 --- a/activejob/lib/active_job/test_helper.rb +++ b/activejob/lib/active_job/test_helper.rb @@ -11,7 +11,7 @@ module ActiveJob def before_setup # :nodoc: test_adapter = queue_adapter_for_test - @old_queue_adapters = (ActiveJob::Base.subclasses << ActiveJob::Base).select do |klass| + @old_queue_adapters = (ActiveJob::Base.descendants << ActiveJob::Base).select do |klass| # only override explicitly set adapters, a quirk of `class_attribute` klass.singleton_class.public_instance_methods(false).include?(:_queue_adapter) end.map do |klass| diff --git a/activejob/test/cases/test_helper_test.rb b/activejob/test/cases/test_helper_test.rb index 2398402d5d..253c557cc5 100644 --- a/activejob/test/cases/test_helper_test.rb +++ b/activejob/test/cases/test_helper_test.rb @@ -5,6 +5,7 @@ require "jobs/hello_job" require "jobs/logging_job" require "jobs/nested_job" require "jobs/rescue_job" +require "jobs/inherited_job" require "models/person" class EnqueuedJobsTest < ActiveJob::TestCase @@ -521,3 +522,9 @@ class OverrideQueueAdapterTest < ActiveJob::TestCase assert_instance_of CustomQueueAdapter, HelloJob.queue_adapter end end + +class InheritedJobTest < ActiveJob::TestCase + def test_queue_adapter_is_test_adapter + assert_instance_of ActiveJob::QueueAdapters::TestAdapter, InheritedJob.queue_adapter + end +end diff --git a/activejob/test/jobs/application_job.rb b/activejob/test/jobs/application_job.rb new file mode 100644 index 0000000000..4a78b890ec --- /dev/null +++ b/activejob/test/jobs/application_job.rb @@ -0,0 +1,4 @@ +require_relative "../support/job_buffer" + +class ApplicationJob < ActiveJob::Base +end diff --git a/activejob/test/jobs/inherited_job.rb b/activejob/test/jobs/inherited_job.rb new file mode 100644 index 0000000000..60fca66f88 --- /dev/null +++ b/activejob/test/jobs/inherited_job.rb @@ -0,0 +1,5 @@ +require_relative "application_job" + +class InheritedJob < ApplicationJob + self.queue_adapter = :inline +end |