mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Removed deprecated support to passing the adapter class to .queue_adapter
This commit is contained in:
parent
d861a1fcf8
commit
d1fc0a5eb2
3 changed files with 4 additions and 23 deletions
|
@ -1,3 +1,7 @@
|
|||
* Removed deprecated support to passing the adapter class to `.queue_adapter`.
|
||||
|
||||
*Rafael Mendonça França*
|
||||
|
||||
* Removed deprecated `#original_exception` in `ActiveJob::DeserializationError`.
|
||||
|
||||
*Rafael Mendonça França*
|
||||
|
|
|
@ -37,12 +37,6 @@ module ActiveJob
|
|||
else
|
||||
if queue_adapter?(name_or_adapter_or_class)
|
||||
name_or_adapter_or_class
|
||||
elsif queue_adapter_class?(name_or_adapter_or_class)
|
||||
ActiveSupport::Deprecation.warn "Passing an adapter class is deprecated " \
|
||||
"and will be removed in Rails 5.1. Please pass an adapter name " \
|
||||
"(.queue_adapter = :#{name_or_adapter_or_class.name.demodulize.remove('Adapter').underscore}) " \
|
||||
"or an instance (.queue_adapter = #{name_or_adapter_or_class.name}.new) instead."
|
||||
name_or_adapter_or_class.new
|
||||
else
|
||||
raise ArgumentError
|
||||
end
|
||||
|
@ -54,10 +48,6 @@ module ActiveJob
|
|||
def queue_adapter?(object)
|
||||
QUEUE_ADAPTER_METHODS.all? { |meth| object.respond_to?(meth) }
|
||||
end
|
||||
|
||||
def queue_adapter_class?(object)
|
||||
object.is_a?(Class) && QUEUE_ADAPTER_METHODS.all? { |meth| object.public_method_defined?(meth) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,19 +20,6 @@ class QueueAdapterTest < ActiveJob::TestCase
|
|||
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
|
||||
base_queue_adapter = ActiveJob::Base.queue_adapter
|
||||
|
||||
|
|
Loading…
Reference in a new issue