aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/cases/test_helper_test.rb
diff options
context:
space:
mode:
authorWojciech Wnętrzak <w.wnetrzak@gmail.com>2015-10-03 13:25:16 +0200
committerWojciech Wnętrzak <w.wnetrzak@gmail.com>2015-10-03 13:25:16 +0200
commit8a67c56efbb4824cd693b47a48520932b0b84b70 (patch)
tree547e17f9737898808d2fa4fdb1f039fd12a29f1b /activejob/test/cases/test_helper_test.rb
parent1b00c36d8535e88ffcc6e4401f3c91acd6138ba3 (diff)
downloadrails-8a67c56efbb4824cd693b47a48520932b0b84b70.tar.gz
rails-8a67c56efbb4824cd693b47a48520932b0b84b70.tar.bz2
rails-8a67c56efbb4824cd693b47a48520932b0b84b70.zip
Support passing array to `assert_enqueued_jobs` in `:only` option
Diffstat (limited to 'activejob/test/cases/test_helper_test.rb')
-rw-r--r--activejob/test/cases/test_helper_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/activejob/test/cases/test_helper_test.rb b/activejob/test/cases/test_helper_test.rb
index 8c60f037d2..18cf35562b 100644
--- a/activejob/test/cases/test_helper_test.rb
+++ b/activejob/test/cases/test_helper_test.rb
@@ -140,6 +140,16 @@ class EnqueuedJobsTest < ActiveJob::TestCase
assert_match(/1 .* but 2/, error.message)
end
+ def test_assert_enqueued_jobs_with_only_option_as_array
+ assert_nothing_raised do
+ assert_enqueued_jobs 2, only: [HelloJob, LoggingJob] do
+ HelloJob.perform_later('jeremy')
+ LoggingJob.perform_later('stewie')
+ RescueJob.perform_later('david')
+ end
+ end
+ end
+
def test_assert_no_enqueued_jobs_with_only_option
assert_nothing_raised do
assert_no_enqueued_jobs only: HelloJob do
@@ -159,6 +169,14 @@ class EnqueuedJobsTest < ActiveJob::TestCase
assert_match(/0 .* but 1/, error.message)
end
+ def test_assert_no_enqueued_jobs_with_only_option_as_array
+ assert_nothing_raised do
+ assert_no_enqueued_jobs only: [HelloJob, RescueJob] do
+ LoggingJob.perform_later
+ end
+ end
+ end
+
def test_assert_enqueued_job
assert_enqueued_with(job: LoggingJob, queue: 'default') do
LoggingJob.set(wait_until: Date.tomorrow.noon).perform_later