aboutsummaryrefslogtreecommitdiffstats
path: root/activejob
diff options
context:
space:
mode:
authorbogdanvlviv <bogdanvlviv@gmail.com>2018-08-16 18:24:43 +0300
committerbogdanvlviv <bogdanvlviv@gmail.com>2018-08-20 13:05:22 +0300
commite0cf042fa2c499c2e0b8fe95ec02ed79f9178feb (patch)
treeb1f94e946d7606e979184e46ab7a3e9af4ccc347 /activejob
parentec2e8f645eded183224420e209420376c63b99bb (diff)
downloadrails-e0cf042fa2c499c2e0b8fe95ec02ed79f9178feb.tar.gz
rails-e0cf042fa2c499c2e0b8fe95ec02ed79f9178feb.tar.bz2
rails-e0cf042fa2c499c2e0b8fe95ec02ed79f9178feb.zip
Fix `perform_enqueued_jobs`
Set ```` queue_adapter.perform_enqueued_jobs = true queue_adapter.perform_enqueued_at_jobs = true queue_adapter.filter = only queue_adapter.reject = except queue_adapter.queue = queue ``` if block given. Execution of `flush_enqueued_jobs` doesn't require that.
Diffstat (limited to 'activejob')
-rw-r--r--activejob/lib/active_job/test_helper.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activejob/lib/active_job/test_helper.rb b/activejob/lib/active_job/test_helper.rb
index 8f798ac2aa..22568c9aa5 100644
--- a/activejob/lib/active_job/test_helper.rb
+++ b/activejob/lib/active_job/test_helper.rb
@@ -415,7 +415,10 @@ module ActiveJob
# end
#
def perform_enqueued_jobs(only: nil, except: nil, queue: nil)
+ return flush_enqueued_jobs(only: only, except: except, queue: queue) unless block_given?
+
validate_option(only: only, except: except)
+
old_perform_enqueued_jobs = queue_adapter.perform_enqueued_jobs
old_perform_enqueued_at_jobs = queue_adapter.perform_enqueued_at_jobs
old_filter = queue_adapter.filter
@@ -429,7 +432,7 @@ module ActiveJob
queue_adapter.reject = except
queue_adapter.queue = queue
- block_given? ? yield : flush_enqueued_jobs(only: only, except: except, queue: queue)
+ yield
ensure
queue_adapter.perform_enqueued_jobs = old_perform_enqueued_jobs
queue_adapter.perform_enqueued_at_jobs = old_perform_enqueued_at_jobs