- 14 4月, 2020 1 次提交
-
-
由 Étienne Barrié 提交于
assert_enqueued_with with a block ignores all the jobs enqueued before the block for its assertions by counting the number of jobs and dropping the n first elements from the Array, but since we're now mutating the Array in perform_enqueued_jobs without a block, it's broken. This uses another implementation which is correct when the array is mutated, by getting a duplicated array of jobs, then removing them from the original array. Similarly assert_enqueued_jobs with a block was using counts only, now keeps track of the specific jobs to count them at the end.
-
- 17 3月, 2020 2 次提交
-
-
由 Étienne Barrié 提交于
This makes sure jobs don't run twice if `perform_enqueued_jobs` is called twice without a block. This also mimics the behavior of using `perform_enqueued_jobs` with a block, where at the end of the block performed jobs are not in `enqueued_jobs` but instead in `performed_jobs`.
-
由 Étienne Barrié 提交于
-
- 10 3月, 2020 2 次提交
-
-
由 Edouard CHIN 提交于
- ### Problem If we use `perform_enqueued_jobs` without a block, a job that uses a retry mechanism to reeenqueue itself would get performed right away. This behaviour make sense when using `perform_enqueued_jobs` with a block. However I'm expecting `perform_enqueued_jobs` without a block to perform jobs that are **already** in the queue not the ones that will get enqueued afterwards. ### Solution Dup the array of jobs given to avoid future mutation.
-
由 Edouard CHIN 提交于
- ### Problem If we use `perform_enqueued_jobs` without a block, a job that raises an error wouldn't be appended to the list of `performed_jobs`. ### Solution Push the job in the array before it is actually performed.
-
- 28 2月, 2020 1 次提交
-
-
由 dmitry 提交于
-
- 11 2月, 2020 1 次提交
-
-
由 Edouard CHIN 提交于
- ### Problem Given the below example the test adapter will retry the job indefinitely: ```ruby class BuggyJob < ActiveJob::Base retry_on(Exception, attempts: 2) def perform raise "error" end end BuggyJob.perform_later perform_enqueued_jobs ``` The problem is that when the job get retried, the `exception_executions` variable is not serialized/deserialized, resulting in ActiveJob to not be able to determine how many time this job was retried. The solution in this PR is to deserialize the whole job in the test adapter, and reserialize it before retrying. Fix #38391
-
- 13 8月, 2019 1 次提交
-
-
由 Gareth du Plooy 提交于
Adds logging of potential matches when calling `assert_enqueued_with` and `assert_performed_with` to provide more information on test failures.
-
- 06 8月, 2019 1 次提交
-
-
由 John Crepezzi 提交于
Currently, the `perform_enqueued_jobs` helpers will also immediately perform jobs that are scheduled via `set(wait:)` to run in the future. This commit adds a new argument to `perform_enqueued_jobs` to make it only run jobs scheduled at or before the passed in `Time`. This allows testing the side effects of immediate job execution separate of jobs delayed in the future.
-
- 26 7月, 2019 1 次提交
-
-
由 Vlado Cingel 提交于
`assert_enqueued_with` and `assert_performed_with` were not able to properly test jobs with relative delay. `:at` option was asserted for equality and test will always fail cause small fraction of time will pass between job call and assertion. This commit fixes that by droping microseconds from `:at` argument assertions.
-
- 25 3月, 2019 1 次提交
-
-
由 Gannon McGibbon 提交于
-
- 23 3月, 2019 1 次提交
-
-
由 Gannon McGibbon 提交于
-
- 29 1月, 2019 1 次提交
-
-
由 alkesh26 提交于
-
- 22 11月, 2018 1 次提交
-
-
由 Edouard CHIN 提交于
- That feature is useful to enqueue or assert that jobs got enqueued or performed based on dynamic conditions. We will be able to leverage that feature to fix all ActionMailer assertion helper issue when a Mailer define a custom delivery job (see next commit).
-
- 13 10月, 2018 1 次提交
-
-
由 Alan Wu 提交于
`assert_enqueued_with` and `assert_performed_with` return a instantiated instance of the matching job for further assertion (#21010). Before this commit the `arguments` method on the returned instance returns a serialized version of the arguments.
-
- 27 9月, 2018 1 次提交
-
-
由 Edouard CHIN 提交于
- When calling `assert_performed_with`/`assert_enqueued_with`, the +args+ needs to match exactly what the job get passed. Some jobs can have lot of arguments, or even a simple hash argument has many key. This is not convenient to test as most tests doesn't need to check if the arguments matches perfectly. This PR make it possible to only check if a subset of arguments were passed to the job.
-
- 26 9月, 2018 1 次提交
-
-
由 Rafael Mendonça França 提交于
-
- 21 9月, 2018 1 次提交
-
-
由 Sharang Dashputre 提交于
The test helpers now treat `{ a: 1, b: 2 }` and `{ b: 2, a: 1 }` as equals
-
- 12 9月, 2018 1 次提交
-
-
由 Sharang Dashputre 提交于
Fix typo `wiht` -> `with`
-
- 22 8月, 2018 1 次提交
-
-
由 utilum 提交于
This patch corrects a duplicate method name introduced in #33635. Also fixes typo in method names.
-
- 20 8月, 2018 5 次提交
-
-
由 bogdanvlviv 提交于
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 #33626.
-
由 bogdanvlviv 提交于
Execution of `assert_performed_jobs`, and `assert_no_performed_jobs` without a block should respect passed `:except`, `:only`, and `:queue` options.
-
由 bogdanvlviv 提交于
If the `:queue` option is specified, then only the job(s) enqueued to a specific queue will not be performed. Example: ``` def test_assert_no_performed_jobs_with_queue_option assert_no_performed_jobs queue: :some_queue do HelloJob.set(queue: :other_queue).perform_later("jeremy") end end ```
-
由 bogdanvlviv 提交于
If the `:queue` option is specified, then only the job(s) enqueued to a specific queue will be performed. Example: ``` def test_assert_performed_jobs_with_queue_option assert_performed_jobs 1, queue: :some_queue do HelloJob.set(queue: :some_queue).perform_later("jeremy") HelloJob.set(queue: :other_queue).perform_later("bogdan") end end ```
-
由 bogdanvlviv 提交于
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 #33265 [bogdanvlviv & Jeremy Daer]
-
- 16 8月, 2018 1 次提交
-
-
由 Kevin Deisz 提交于
Performs all of the jobs that have been enqueued up to this point in the test.
-
- 30 6月, 2018 2 次提交
-
-
由 bogdanvlviv 提交于
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 ```
-
由 bogdanvlviv 提交于
Rename `in_block_job` to `enqueued_job` since this variable can refer not only to jobs that were created in the block. See #33258. Return back accidentally removed test to activejob/test/cases/test_helper_test.rb See #33258. Fix name of tests.
-
- 29 6月, 2018 1 次提交
-
-
由 bogdanvlviv 提交于
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 #33243
-
- 20 7月, 2017 1 次提交
-
-
由 yuuji.yaginuma 提交于
If the argument is invalid, I think that it is more intuitive to use `ArgumentError` than its own error class.
-
- 18 7月, 2017 1 次提交
-
-
由 posthumanism 提交于
-
- 11 7月, 2017 1 次提交
-
-
由 Koichi ITO 提交于
-
- 10 7月, 2017 1 次提交
-
-
由 Kir Shatrov 提交于
-
- 02 7月, 2017 1 次提交
-
-
由 Matthew Draper 提交于
This reverts commit 3420a145, reversing changes made to afb66a5a.
-
- 01 7月, 2017 1 次提交
-
-
由 Kir Shatrov 提交于
-
- 16 3月, 2017 1 次提交
-
-
由 David Heinemeier Hansson 提交于
-
- 01 2月, 2017 1 次提交
-
-
由 Yuji Yaginuma 提交于
The `ActiveJob::TestHelper` replace the adapter to test adapter in `before_setup`. It gets the target class using the `descendants`, but if the test target job class is not loaded, will not be a replacement of the adapter. Therefore, instead of replacing with `before_setup`, modified to replace when setting adapter. Fixes #26360
-
- 31 1月, 2017 1 次提交
-
-
由 Alexander Pauly 提交于
Refactored ActiveJob TestAdapter Updated ActiveJob changelog Fixed typo in changelog Fixed formatting issue in changelog
-
- 18 1月, 2017 1 次提交
-
-
由 Michael Elfassy 提交于
-
- 25 12月, 2016 1 次提交
-
-
由 Akira Matsuda 提交于
-