From ec1630148853c46a1e3b35cd48bf85aa0e049d81 Mon Sep 17 00:00:00 2001 From: Kevin Deisz Date: Wed, 15 Aug 2018 15:00:40 -0400 Subject: Allow `perform_enqueued_jobs` to be called without a block. Performs all of the jobs that have been enqueued up to this point in the test. --- activejob/test/cases/test_helper_test.rb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'activejob/test/cases/test_helper_test.rb') diff --git a/activejob/test/cases/test_helper_test.rb b/activejob/test/cases/test_helper_test.rb index d0a21a5da3..53b332f6e3 100644 --- a/activejob/test/cases/test_helper_test.rb +++ b/activejob/test/cases/test_helper_test.rb @@ -610,7 +610,7 @@ class EnqueuedJobsTest < ActiveJob::TestCase end class PerformedJobsTest < ActiveJob::TestCase - def test_performed_enqueue_jobs_with_only_option_doesnt_leak_outside_the_block + def test_perform_enqueued_jobs_with_only_option_doesnt_leak_outside_the_block assert_nil queue_adapter.filter perform_enqueued_jobs only: HelloJob do assert_equal HelloJob, queue_adapter.filter @@ -618,7 +618,7 @@ class PerformedJobsTest < ActiveJob::TestCase assert_nil queue_adapter.filter end - def test_performed_enqueue_jobs_with_except_option_doesnt_leak_outside_the_block + def test_perform_enqueued_jobs_with_except_option_doesnt_leak_outside_the_block assert_nil queue_adapter.reject perform_enqueued_jobs except: HelloJob do assert_equal HelloJob, queue_adapter.reject @@ -626,6 +626,22 @@ class PerformedJobsTest < ActiveJob::TestCase assert_nil queue_adapter.reject end + def test_perform_enqueued_jobs_without_block + HelloJob.perform_later("kevin") + + assert_performed_jobs 1, only: HelloJob do + perform_enqueued_jobs + end + end + + def test_perform_enqueued_jobs_without_block_respects_filter + HelloJob.perform_later("kevin") + + assert_no_performed_jobs do + perform_enqueued_jobs only: LoggingJob + end + end + def test_assert_performed_jobs assert_nothing_raised do assert_performed_jobs 1 do -- cgit v1.2.3