Skip to content

Allow perform_enqueued_jobs to be called without a block. #33626

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

Merged
merged 1 commit into from
Aug 16, 2018
Merged

Allow perform_enqueued_jobs to be called without a block. #33626

merged 1 commit into from
Aug 16, 2018

Conversation

kddnewton
Copy link
Contributor

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.

Performs all of the jobs that have been enqueued up to this point in the test.
@rails-bot
Copy link

r? @kamipo

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

Copy link
Contributor

@bogdanvlviv bogdanvlviv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for improving this.

@guilleiguaran guilleiguaran merged commit f6bbbb9 into rails:master Aug 16, 2018
@kddnewton kddnewton deleted the perform-enqueued-jobs-no-block branch August 16, 2018 01:23
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
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants