diff options
Diffstat (limited to 'activejob/test/cases/queue_adapter_test.rb')
-rw-r--r-- | activejob/test/cases/queue_adapter_test.rb | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/activejob/test/cases/queue_adapter_test.rb b/activejob/test/cases/queue_adapter_test.rb index fb3fdc392f..e71cfa49cf 100644 --- a/activejob/test/cases/queue_adapter_test.rb +++ b/activejob/test/cases/queue_adapter_test.rb @@ -1,4 +1,6 @@ -require 'helper' +# frozen_string_literal: true + +require "helper" module ActiveJob module QueueAdapters @@ -15,36 +17,29 @@ module ActiveJob end class QueueAdapterTest < ActiveJob::TestCase - test 'should forbid nonsense arguments' do + test "should forbid nonsense arguments" do assert_raises(ArgumentError) { ActiveJob::Base.queue_adapter = Mutex } assert_raises(ArgumentError) { ActiveJob::Base.queue_adapter = Mutex.new } end - test 'should warn on passing an adapter class' do - klass = Class.new do - def self.name - 'fake' - end - - def enqueue(*); end - def enqueue_at(*); end - end - - assert_deprecated { ActiveJob::Base.queue_adapter = klass } - end - - test 'should allow overriding the queue_adapter at the child class level without affecting the parent or its sibling' do + test "should allow overriding the queue_adapter at the child class level without affecting the parent or its sibling" do + ActiveJob::Base.disable_test_adapter base_queue_adapter = ActiveJob::Base.queue_adapter child_job_one = Class.new(ActiveJob::Base) + assert_equal child_job_one.queue_adapter_name, ActiveJob::Base.queue_adapter_name + child_job_one.queue_adapter = :stub_one assert_not_equal ActiveJob::Base.queue_adapter, child_job_one.queue_adapter + assert_equal "stub_one", child_job_one.queue_adapter_name assert_kind_of ActiveJob::QueueAdapters::StubOneAdapter, child_job_one.queue_adapter child_job_two = Class.new(ActiveJob::Base) child_job_two.queue_adapter = :stub_two + assert_equal "stub_two", child_job_two.queue_adapter_name + assert_kind_of ActiveJob::QueueAdapters::StubTwoAdapter, child_job_two.queue_adapter assert_kind_of ActiveJob::QueueAdapters::StubOneAdapter, child_job_one.queue_adapter, "child_job_one's queue adapter should remain unchanged" assert_equal base_queue_adapter, ActiveJob::Base.queue_adapter, "ActiveJob::Base's queue adapter should remain unchanged" |