New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow `queue` option to `assert_no_enqueued_jobs` #33265

Merged
merged 1 commit into from Jun 30, 2018

Conversation

Projects
None yet
4 participants
@bogdanvlviv
Contributor

bogdanvlviv commented Jun 30, 2018

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
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
```
@rails-bot

This comment has been minimized.

Show comment
Hide comment
@rails-bot

rails-bot Jun 30, 2018

r? @pixeltrix

(@rails-bot has picked a reviewer for you, use r? to override)

rails-bot commented Jun 30, 2018

r? @pixeltrix

(@rails-bot has picked a reviewer for you, use r? to override)

@kamipo

This comment has been minimized.

Show comment
Hide comment
@kamipo

kamipo Jun 30, 2018

Member

The queue option was introduced to assert_enqueued_jobs at #27624, but didn't to assert_no_enqueued_jobs.
Probably we need to take care to sync allowing options like assert_xxx and assert_no_xxx series.

Member

kamipo commented Jun 30, 2018

The queue option was introduced to assert_enqueued_jobs at #27624, but didn't to assert_no_enqueued_jobs.
Probably we need to take care to sync allowing options like assert_xxx and assert_no_xxx series.

@kamipo kamipo merged commit b1d2735 into rails:master Jun 30, 2018

2 checks passed

codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@bogdanvlviv bogdanvlviv deleted the bogdanvlviv:allow-queue-option-to-assert_no_enqueued_jobs branch Jun 30, 2018

bogdanvlviv added a commit to bogdanvlviv/rails that referenced this pull request Aug 20, 2018

Allow `:queue` option to `perform_enqueued_jobs`.
If the `:queue` option is specified, then only the job(s) enqueued to
a specific queue will be performed.

Example:
```
def test_perform_enqueued_jobs_with_queue
  perform_enqueued_jobs queue: :some_queue do
    MyJob.set(queue: :some_queue).perform_later(1, 2, 3) # will be performed
    HelloJob.set(queue: :other_queue).perform_later(1, 2, 3) # will not be performed
  end
  assert_performed_jobs 1
end
```

Follow up rails#33265

[bogdanvlviv & Jeremy Daer]

bogdanvlviv added a commit to bogdanvlviv/rails that referenced this pull request Aug 20, 2018

Add changelog entry about adding `:queue` option to job assertions an…
…d helpers

Note that it removes changelog entry of rails#33265 since the entry in this commits
includes that too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment