aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test
diff options
context:
space:
mode:
authorWojciech Wnętrzak <w.wnetrzak@gmail.com>2015-10-07 19:55:57 +0200
committerWojciech Wnętrzak <w.wnetrzak@gmail.com>2015-10-07 20:02:15 +0200
commitc2854af74784a059318d691d4e021c04719028cf (patch)
treefa405ab1b5760d30f813305a40e00e3ee7f2f111 /activejob/test
parente70ec9e91cb63fd63cfc0a285e5d2268a0297e46 (diff)
downloadrails-c2854af74784a059318d691d4e021c04719028cf.tar.gz
rails-c2854af74784a059318d691d4e021c04719028cf.tar.bz2
rails-c2854af74784a059318d691d4e021c04719028cf.zip
Added missing specs for not modifying queues when using AJ test helpers
Diffstat (limited to 'activejob/test')
-rw-r--r--activejob/test/cases/test_helper_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/activejob/test/cases/test_helper_test.rb b/activejob/test/cases/test_helper_test.rb
index a66f5d762c..f7ee763e8a 100644
--- a/activejob/test/cases/test_helper_test.rb
+++ b/activejob/test/cases/test_helper_test.rb
@@ -242,6 +242,15 @@ class EnqueuedJobsTest < ActiveJob::TestCase
assert_equal "No enqueued job found with {:job=>HelloJob, :args=>[#{wilma.inspect}]}", error.message
end
+
+ def test_assert_enqueued_job_does_not_change_jobs_count
+ HelloJob.perform_later
+ assert_enqueued_with(job: HelloJob) do
+ HelloJob.perform_later
+ end
+
+ assert_equal 2, ActiveJob::Base.queue_adapter.enqueued_jobs.count
+ end
end
class PerformedJobsTest < ActiveJob::TestCase
@@ -487,4 +496,16 @@ class PerformedJobsTest < ActiveJob::TestCase
assert_equal "No performed job found with {:job=>HelloJob, :args=>[#{wilma.inspect}]}", error.message
end
+
+ def test_assert_performed_job_does_not_change_jobs_count
+ assert_performed_with(job: HelloJob) do
+ HelloJob.perform_later
+ end
+
+ assert_performed_with(job: HelloJob) do
+ HelloJob.perform_later
+ end
+
+ assert_equal 2, ActiveJob::Base.queue_adapter.performed_jobs.count
+ end
end