aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/lib/active_job/queue_adapters/test_adapter.rb
diff options
context:
space:
mode:
authorposthumanism <lgndscntn@gmail.com>2017-07-16 17:35:17 +0900
committerposthumanism <lgndscntn@gmail.com>2017-07-18 07:48:03 +0900
commit4458b76756ada59b4b1f130213ca4ce86b02f25f (patch)
treea3240073ae453d03d15b3c84572383aaf2c5b37b /activejob/lib/active_job/queue_adapters/test_adapter.rb
parent589adea81c2f6ff04178a09986a455f6b7062dcc (diff)
downloadrails-4458b76756ada59b4b1f130213ca4ce86b02f25f.tar.gz
rails-4458b76756ada59b4b1f130213ca4ce86b02f25f.tar.bz2
rails-4458b76756ada59b4b1f130213ca4ce86b02f25f.zip
Add `except` option for ActiveJob::TestHelper methods
Diffstat (limited to 'activejob/lib/active_job/queue_adapters/test_adapter.rb')
-rw-r--r--activejob/lib/active_job/queue_adapters/test_adapter.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/activejob/lib/active_job/queue_adapters/test_adapter.rb b/activejob/lib/active_job/queue_adapters/test_adapter.rb
index 43566b433c..885f9ff01c 100644
--- a/activejob/lib/active_job/queue_adapters/test_adapter.rb
+++ b/activejob/lib/active_job/queue_adapters/test_adapter.rb
@@ -12,7 +12,7 @@ module ActiveJob
#
# Rails.application.config.active_job.queue_adapter = :test
class TestAdapter
- attr_accessor(:perform_enqueued_jobs, :perform_enqueued_at_jobs, :filter)
+ attr_accessor(:perform_enqueued_jobs, :perform_enqueued_at_jobs, :filter, :reject)
attr_writer(:enqueued_jobs, :performed_jobs)
# Provides a store of all the enqueued jobs with the TestAdapter so you can check them.
@@ -54,7 +54,13 @@ module ActiveJob
end
def filtered?(job)
- filter && !Array(filter).include?(job.class)
+ if filter
+ !Array(filter).include?(job.class)
+ elsif reject
+ Array(reject).include?(job.class)
+ else
+ false
+ end
end
end
end