diff options
author | bogdanvlviv <bogdanvlviv@gmail.com> | 2018-06-30 18:20:04 +0300 |
---|---|---|
committer | bogdanvlviv <bogdanvlviv@gmail.com> | 2018-06-30 18:30:55 +0300 |
commit | 22c7d5650cb22ac75b5ee06830a58fcc22bb7acc (patch) | |
tree | 5ddfc6a769f5a871bbb2d4a79c1c770871bcc2d3 /activejob/lib | |
parent | b3653aee947a5f8c3a298913e539493d17c1932b (diff) | |
download | rails-22c7d5650cb22ac75b5ee06830a58fcc22bb7acc.tar.gz rails-22c7d5650cb22ac75b5ee06830a58fcc22bb7acc.tar.bz2 rails-22c7d5650cb22ac75b5ee06830a58fcc22bb7acc.zip |
Allow `queue` option to `assert_no_enqueued_jobs`
It can be asserted that no jobs are enqueued to a specific queue:
```ruby
def test_no_logging
assert_no_enqueued_jobs queue: 'default' do
LoggingJob.set(queue: :some_queue).perform_later
end
end
```
Diffstat (limited to 'activejob/lib')
-rw-r--r-- | activejob/lib/active_job/test_helper.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/activejob/lib/active_job/test_helper.rb b/activejob/lib/active_job/test_helper.rb index 0ab3c5126d..04cde28a96 100644 --- a/activejob/lib/active_job/test_helper.rb +++ b/activejob/lib/active_job/test_helper.rb @@ -159,11 +159,19 @@ module ActiveJob # end # end # + # It can be asserted that no jobs are enqueued to a specific queue: + # + # def test_no_logging + # assert_no_enqueued_jobs queue: 'default' do + # LoggingJob.set(queue: :some_queue).perform_later + # end + # end + # # Note: This assertion is simply a shortcut for: # # assert_enqueued_jobs 0, &block - def assert_no_enqueued_jobs(only: nil, except: nil, &block) - assert_enqueued_jobs 0, only: only, except: except, &block + def assert_no_enqueued_jobs(only: nil, except: nil, queue: nil, &block) + assert_enqueued_jobs 0, only: only, except: except, queue: queue, &block end # Asserts that the number of performed jobs matches the given number. |