Skip to content

Commit

Permalink
Memoize queue_adapter_for_test
Browse files Browse the repository at this point in the history
Co-authored-by: Étienne Barrié <etienne.barrie@shopify.com>
  • Loading branch information
george-ma and etiennebarrie committed May 14, 2024
1 parent 0be846c commit 94c6de5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion activejob/lib/active_job/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ def enable_test_adapter(test_adapter)
end

def before_setup # :nodoc:
queue_adapter_specific_to_this_test_class = queue_adapter_for_test
queue_adapter_changed_jobs.each do |klass|
if (queue_adapter_specific_to_this_test_class = queue_adapter_for_test)
if queue_adapter_specific_to_this_test_class
klass.enable_test_adapter(queue_adapter_specific_to_this_test_class)
elsif klass._queue_adapter.nil?
klass.enable_test_adapter(ActiveJob::QueueAdapters::TestAdapter.new)
Expand Down

0 comments on commit 94c6de5

Please sign in to comment.