Skip to content
Permalink
Browse files

Removed deprecated support to passing the adapter class to .queue_ada…

…pter
  • Loading branch information
rafaelfranca committed Oct 10, 2016
1 parent d861a1f commit d1fc0a5eb286600abf8505516897b96c2f1ef3f6
Showing with 4 additions and 23 deletions.
  1. +4 −0 activejob/CHANGELOG.md
  2. +0 −10 activejob/lib/active_job/queue_adapter.rb
  3. +0 −13 activejob/test/cases/queue_adapter_test.rb
@@ -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 @@ def interpret_adapter(name_or_adapter_or_class)
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 @@ def interpret_adapter(name_or_adapter_or_class)
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

2 comments on commit d1fc0a5

@artur-beljajev

This comment has been minimized.

Copy link

@artur-beljajev artur-beljajev replied Dec 23, 2017

@rafaelfranca Perhaps input param name_or_adapter_or_class of a method queue_adapter= would be better named name_or_adapter (given that class passing has been removed)?

Same might apply to interpret_adapter method.

@kamipo

This comment has been minimized.

Copy link
Member

@kamipo kamipo replied Jan 5, 2018

Fixed in 5a50146. Thanks!

Please sign in to comment.
You can’t perform that action at this time.