lib/active_job/test_helper.rb in activejob-7.1.0 vs lib/active_job/test_helper.rb in activejob-7.1.1
- old
+ new
@@ -52,19 +52,14 @@
super
queue_adapter_changed_jobs.each { |klass| klass.disable_test_adapter }
end
- # Specifies the queue adapter to use with all Active Job test helpers.
- #
- # Returns an instance of the queue adapter and defaults to
- # ActiveJob::QueueAdapters::TestAdapter.
- #
- # Note: The adapter provided by this method must provide some additional
- # methods from those expected of a standard ActiveJob::QueueAdapter
- # in order to be used with the active job test helpers. Refer to
- # ActiveJob::QueueAdapters::TestAdapter.
+ # Returns a queue adapter instance to use with all Active Job test helpers.
+ # By default, returns an instance of ActiveJob::QueueAdapters::TestAdapter.
+ # Override this method to specify a different adapter. The adapter must
+ # implement the same interface as ActiveJob::QueueAdapters::TestAdapter.
def queue_adapter_for_test
ActiveJob::QueueAdapters::TestAdapter.new
end
# Asserts that the number of enqueued jobs matches the given number.
@@ -598,14 +593,15 @@
# HelloJob.set(queue: :other_queue).perform_later(1, 2, 3) # will not be performed
# end
# assert_performed_jobs 1
# end
#
- # If the +:at+ option is specified, then only run jobs enqueued to run
- # immediately or before the given time
+ # If the +:at+ option is specified, then only jobs that have been enqueued
+ # to run at or before the given time will be performed. This includes jobs
+ # that have been enqueued without a time.
#
- # If an adapter other than the test adapter is in use, this method just yields.
- # See queue_adapter_for_test for more information.
+ # If queue_adapter_for_test is overridden to return a different adapter,
+ # +perform_enqueued_jobs+ will merely execute the block.
def perform_enqueued_jobs(only: nil, except: nil, queue: nil, at: nil, &block)
return flush_enqueued_jobs(only: only, except: except, queue: queue, at: at) unless block_given?
return _assert_nothing_raised_or_warn("perform_enqueued_jobs", &block) unless using_test_adapter?