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 `perform_enqueued_jobs` to be called without a block. #33626

Merged
merged 1 commit into from Aug 16, 2018

Conversation

Projects
None yet
5 participants
@kddeisz
Contributor

kddeisz commented Aug 15, 2018

Performs all of the jobs that have been enqueued up to this point in the test.

Allows you to test code that is in some intermediate state between the time that the job is enqueued to the time that the job is performed. For example in my case, when uploading an image asynchronously a default image is set until the thumbnails have been processed in the background. This allows me to test that after the job is enqueued the default image is set, then call perform_enqueued_jobs to make sure it then gets updated afterward.

Allow `perform_enqueued_jobs` to be called without a block.
Performs all of the jobs that have been enqueued up to this point in the test.
@rails-bot

This comment has been minimized.

Show comment
Hide comment
@rails-bot

rails-bot Aug 15, 2018

r? @kamipo

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

rails-bot commented Aug 15, 2018

r? @kamipo

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

@bogdanvlviv

LGTM! Thanks for improving this.

@guilleiguaran guilleiguaran merged commit f6bbbb9 into rails:master Aug 16, 2018

2 checks passed

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

@kddeisz kddeisz deleted the kddeisz:perform-enqueued-jobs-no-block branch Aug 16, 2018

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

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

Allow `assert_performed_with` to be called without a block.
Example:
```
def test_assert_performed_with
  MyJob.perform_later(1,2,3)

  perform_enqueued_jobs

  assert_performed_with(job: MyJob, args: [1,2,3], queue: 'high')
end
```

Follow up rails#33626.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment