Allow call assert_enqueued_with and assert_enqueued_email_with with no block - #33258
Merged
rafaelfranca merged 1 commit intoJun 29, 2018
Conversation
…th no block
Example of `assert_enqueued_with` with no block
```ruby
def test_assert_enqueued_with
MyJob.perform_later(1,2,3)
assert_enqueued_with(job: MyJob, args: [1,2,3], queue: 'low')
MyJob.set(wait_until: Date.tomorrow.noon).perform_later
assert_enqueued_with(job: MyJob, at: Date.tomorrow.noon)
end
```
Example of `assert_enqueued_email_with` with no block:
```ruby
def test_email
ContactMailer.welcome.deliver_later
assert_enqueued_email_with ContactMailer, :welcome
end
def test_email_with_arguments
ContactMailer.welcome("Hello", "Goodbye").deliver_later
assert_enqueued_email_with ContactMailer, :welcome, args: ["Hello", "Goodbye"]
end
```
Related to rails#33243
|
r? @sgrif (@rails-bot has picked a reviewer for you, use r? to override) |
bogdanvlviv
added a commit
to bogdanvlviv/rails
that referenced
this pull request
Jun 29, 2018
It isn't allowed to execute `assert_enqueued_email_with` without block See rails#33243 We might allow to do it in Rails 6.0. See rails#33258.
bogdanvlviv
added a commit
to bogdanvlviv/rails
that referenced
this pull request
Jun 29, 2018
Rename `in_block_job` to `enqueued_job` since this variable can refer not only to jobs that were created in the block. See rails#33258. Return back accidentally removed test to activejob/test/cases/test_helper_test.rb See rails#33258. Fix name of tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Example of
assert_enqueued_withwith no blockExample of
assert_enqueued_email_withwith no block:Related to #33243