aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/cases
diff options
context:
space:
mode:
authorKevin Deisz <kevin.deisz@gmail.com>2018-08-15 15:00:40 -0400
committerKevin Deisz <kevin.deisz@gmail.com>2018-08-15 15:00:40 -0400
commitec1630148853c46a1e3b35cd48bf85aa0e049d81 (patch)
treea61e0a77b4de700625ae8dc642a4515607432b1f /activejob/test/cases
parent977d77e9e250a323f64785042d9ad8412368c19a (diff)
downloadrails-ec1630148853c46a1e3b35cd48bf85aa0e049d81.tar.gz
rails-ec1630148853c46a1e3b35cd48bf85aa0e049d81.tar.bz2
rails-ec1630148853c46a1e3b35cd48bf85aa0e049d81.zip
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.
Diffstat (limited to 'activejob/test/cases')
-rw-r--r--activejob/test/cases/test_helper_test.rb20
1 files changed, 18 insertions, 2 deletions
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