File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -39,8 +39,9 @@ def enable_test_adapter(test_adapter)
39
39
end
40
40
41
41
def before_setup # :nodoc:
42
+ queue_adapter_specific_to_this_test_class = queue_adapter_for_test
42
43
queue_adapter_changed_jobs . each do |klass |
43
- if ( queue_adapter_specific_to_this_test_class = queue_adapter_for_test )
44
+ if queue_adapter_specific_to_this_test_class
44
45
klass . enable_test_adapter ( queue_adapter_specific_to_this_test_class )
45
46
elsif klass . _queue_adapter . nil?
46
47
klass . enable_test_adapter ( ActiveJob ::QueueAdapters ::TestAdapter . new )
Original file line number Diff line number Diff line change @@ -806,6 +806,24 @@ def test_assert_enqueued_jobs_with_performed
806
806
end
807
807
end
808
808
809
+ class QueueAdapterTest < ActiveJob ::TestCase
810
+ class JobWithAnAdapter < ActiveJob ::Base
811
+ self . queue_adapter = :async
812
+
813
+ def perform ; end
814
+ end
815
+
816
+ def queue_adapter_for_test
817
+ ActiveJob ::QueueAdapters ::TestAdapter . new
818
+ end
819
+
820
+ test "assert_enqueued_with enqueues a job with a queue_adapter and queue_adapter_for_test" do
821
+ assert_enqueued_with ( job : JobWithAnAdapter ) do
822
+ JobWithAnAdapter . perform_later
823
+ end
824
+ end
825
+ end
826
+
809
827
class PerformedJobsTest < ActiveJob ::TestCase
810
828
if adapter_is? ( :test )
811
829
include DoNotPerformEnqueuedJobs
You can’t perform that action at this time.
0 commit comments