aboutsummaryrefslogtreecommitdiffstats
path: root/activejob
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Add a way to check for subset of arguments when performing jobs:Edouard CHIN2018-09-263-2/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
* | | Change the empty block style to have space inside of the blockRafael Mendonça França2018-09-251-1/+1
| |/ |/|
* | Extract `instrument` method.Kasper Timm Hansen2018-09-231-26/+11
| | | | | | | | Similar to Action View's and Action Controller's instrument helpers.
* | Fix "warning: shadowing outer local variable - job"yuuji.yaginuma2018-09-221-2/+2
| |
* | Merge pull request #33906 from dark-panda/ignore-psqlrc-when-using-psqlRafael França2018-09-202-4/+4
|\ \ | | | | | | Ignore psqlrc files when executing psql commands
| * | Ignore psqlrc files when executing psql commandsJ Smith2018-09-172-4/+4
| | | | | | | | | | | | | | | | | | psqlrc files can affect the execution of commands in ways that can hold up execution by blocking or otherwise cause unexpected side effects and should best be ignored when using psql programmatically.
* | | Make `assert_<enqueued|performed>_with()` compare hashes ignoring order of keysSharang Dashputre2018-09-213-9/+38
| | | | | | | | | | | | The test helpers now treat `{ a: 1, b: 2 }` and `{ b: 2, a: 1 }` as equals
* | | Merge pull request #33897 from bogdanvlviv/follow-up-33751Rafael França2018-09-183-12/+23
|\ \ \ | |/ / |/| | Follow up #33751
| * | `retry_job` should publish `enqueue_retry.active_job` notificationbogdanvlviv2018-09-163-12/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also this commit removes `:wait` from payload of `retry_stopped.active_job`. Related to https://github.com/rails/rails/pull/33751#discussion_r214140008 Follow up #33751 /cc @kaspth, @rafaelfranca
* | | Print correct rake command on running AJ integration testsbogdanvlviv2018-09-171-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently when executing `bundle exec rake test:integration` under `activejob/` derectory, it prints helpful info like: ``` (snip) *** rake aj:integration:async *** (snip) *** rake aj:integration:delayed_job *** (snip) ``` but there is no defined `:aj` scope in `activejob/Rakefile`, so I think output should be like: ``` (snip) *** rake test:integration:async *** (snip) *** rake test:integration:delayed_job *** (snip) ``` By the way `rake test:integration` doesn't work if execute it without prepending `bundle exec` to that command. It is probably what we should fix too.
* | Update arguments.rb [ci skip]Sharang Dashputre2018-09-131-1/+1
| | | | | | | | Fix typo `Instrinsic` -> `Intrinsic`
* | Add changelog entries for #33849 [ci skip]bogdanvlviv2018-09-131-0/+4
| | | | | | | | | | | | | | Since these changes related to the public API, I think we should add changelog entries. Related to #33838, #33849
* | Merge pull request #33849 from ↵Rafael França2018-09-121-0/+4
|\ \ | | | | | | | | | | | | ricardotk002/include-helpers-action-dispatch-integration-test Include test helpers in ActionDispatch::IntegrationTest
| * | Include test helpers when ActionDispatch::IntegrationTest is loadedRicardo Díaz2018-09-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As @dhh brings up, the point of `ActionDispatch::IntegrationTest` is to allow users to test the integration of all the pieces called by a controller. Asserting about the emails and jobs queued is part of that task. This commit includes the `ActionMailer::TestHelper` and `ActiveJob::TestHelper` modules when the ActionMailer and ActiveJob railties are initialized respectively.
* | | Update test_helper_test.rbSharang Dashputre2018-09-121-1/+1
|/ / | | | | Fix typo `wiht` -> `with`
* | Merge pull request #33823 from stoodfarback/aj_backburner_fix_priorityRafael França2018-09-102-2/+14
|\ \ | | | | | | ActiveJob Backburner adapter: fix priority
| * | ActiveJob Backburner adapter: fix prioritystoodfarback2018-09-072-2/+14
| | | | | | | | | | | | | | | | | | | | | The priority wasn't being passed from ActiveJob to Backburner, despite priority being supported. This also brings it inline with the docs, which mark Backburner as supporting priorities in the "Backend Features" table: https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters.html
* | | Merge pull request #33826 from tgturner/activejob-retry-attemptsEileen M. Uchitelle2018-09-091-1/+3
|\ \ \ | | | | | | | | retry_on argument `attempts` clarification
| * | | clarifies documentation around the attempts arugment to retry_onGraham Turner2018-09-091-1/+3
| |/ /
* / / Add missing `perform_enqueued_jobs` to error logging testyuuji.yaginuma2018-09-091-1/+1
|/ / | | | | | | Without `perform_enqueued_jobs`, job are not executed and assertion is not done.
* | Merge pull request #33751 from steves/add_retry_notifications_to_ajRafael França2018-08-304-35/+128
|\ \ | | | | | | Add hooks to ActiveJob around retries and discards
| * | Move ActiveJob retry and discard logging into log subscriberSteve S2018-08-303-32/+103
| | |
| * | Add hooks to ActiveJob around retries and discardsSteve S2018-08-292-7/+29
| | |
* | | Merge pull request #33718 from kddeisz/permit-listMatthew Draper2018-08-291-9/+11
|\ \ \ | | | | | | | | Finish converting whitelist and blacklist references
| * | | Permit list usage cleanup and clearer documentationKevin Deisz2018-08-271-6/+8
| | | |
| * | | Convert remaining usage of whitelist and blacklistKevin Deisz2018-08-241-5/+5
| |/ /
* / / Add test to make sure the custom object key can't be serializedRafael Mendonça França2018-08-281-2/+4
|/ /
* | Remove duplicate testutilum2018-08-221-2/+2
| | | | | | | | | | | | This patch corrects a duplicate method name introduced in #33635. Also fixes typo in method names.
* | DRY in `assert_enqueued_jobs`bogdanvlviv2018-08-201-2/+6
| |
* | Fix formatting of `ActiveJob::TestHelper` api docsbogdanvlviv2018-08-201-4/+4
| |
* | Allow `assert_performed_with` to be called without a block.bogdanvlviv2018-08-203-14/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Fix `assert_performed_jobs` and `assert_no_performed_jobs`bogdanvlviv2018-08-203-24/+289
| | | | | | | | | | Execution of `assert_performed_jobs`, and `assert_no_performed_jobs` without a block should respect passed `:except`, `:only`, and `:queue` options.
* | Add changelog entry about adding `:queue` option to job assertions and helpersbogdanvlviv2018-08-201-13/+4
| | | | | | | | | | Note that it removes changelog entry of #33265 since the entry in this commits includes that too.
* | Allow `:queue` option to `assert_no_performed_jobs`.bogdanvlviv2018-08-202-2/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* | Allow `:queue` option to `assert_performed_jobs`.bogdanvlviv2018-08-202-2/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* | Fix `perform_enqueued_jobs`bogdanvlviv2018-08-201-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Set ```` queue_adapter.perform_enqueued_jobs = true queue_adapter.perform_enqueued_at_jobs = true queue_adapter.filter = only queue_adapter.reject = except queue_adapter.queue = queue ``` if block given. Execution of `flush_enqueued_jobs` doesn't require that.
* | Allow `:queue` option to `perform_enqueued_jobs`.bogdanvlviv2018-08-203-12/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]
* | Increment execution count before deserialize argumentsyuuji.yaginuma2018-08-183-3/+12
| | | | | | | | | | | | | | | | Currently, the execution count increments after deserializes arguments. Therefore, if an error occurs with deserialize, it retries indefinitely. In order to prevent this, the count is moved before deserialize. Fixes #33344.
* | Add example `perform_enqueued_jobs` without block to api docs [ci skip]bogdanvlviv2018-08-161-0/+8
| | | | | | | | Follow up #33626
* | Allow `perform_enqueued_jobs` to be called without a block.Kevin Deisz2018-08-153-8/+45
| | | | | | | | Performs all of the jobs that have been enqueued up to this point in the test.
* | perform_or_enqueue instead of enqueue_or_performMohit Natoo2018-08-091-3/+3
|/
* Rails guides are now served over httpsPaul McMahon2018-07-241-1/+1
| | | | | http links will be redirected to the https version, but still better to just directly link to the https version.
* [ci skip] Fixup changelog. Trim title. Mention benefit.Kasper Timm Hansen2018-07-202-5/+8
|
* Wrap ActiveJob::Enqueue in evented ActiveSupport::Notificationzvkemp2018-07-173-6/+27
|
* ActiveJob::Base no longer dependents on Serializersalpaca-tc2018-07-032-2/+0
|
* Revert "Merge pull request #33234 from alpaca-tc/autoload_activejob_arguments"Kasper Timm Hansen2018-07-013-1/+3
| | | | | | | | | | | It breaks Active Job when run in isolation. E.g. bin/test test/cases/logging_test.rb: https://travis-ci.org/rails/rails/jobs/398779028 Consider Rafaels suggestion of reviewing the eager loading instead: https://github.com/rails/rails/pull/33234#issuecomment-401027419 This reverts commit cb0fdaacb277bd0595bfd73178329922aa24477e, reversing changes made to a0a1abb3c7942084111d87ae95837a83bcc794f6.
* Allow `queue` option to `assert_no_enqueued_jobs`bogdanvlviv2018-06-303-2/+96
| | | | | | | | | | | 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 ```
* Merge pull request #33257 from utilum/ruby-warningsRyuta Kamizono2018-06-302-4/+6
|\ | | | | Fix Ruby warnings tickled by the test suite
| * Fix Ruby warnings tickled by the test suiteutilum2018-06-302-4/+6
| |
* | Clarify activejob/lib/active_job/test_helper.rbbogdanvlviv2018-06-292-4/+10
|/ | | | | | | | | | | 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.