aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* | Make `assert_<enqueued|performed>_with()` compare hashes ignoring order of keysSharang Dashputre2018-09-211-9/+16
| | | | | | | | The test helpers now treat `{ a: 1, b: 2 }` and `{ b: 2, a: 1 }` as equals
* | `retry_job` should publish `enqueue_retry.active_job` notificationbogdanvlviv2018-09-162-12/+18
| | | | | | | | | | | | | | | | | | | | 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
* | Update arguments.rb [ci skip]Sharang Dashputre2018-09-131-1/+1
| | | | | | | | Fix typo `Instrinsic` -> `Intrinsic`
* | 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.
* | Merge pull request #33823 from stoodfarback/aj_backburner_fix_priorityRafael França2018-09-101-2/+2
|\ \ | | | | | | ActiveJob Backburner adapter: fix priority
| * | ActiveJob Backburner adapter: fix prioritystoodfarback2018-09-071-2/+2
| | | | | | | | | | | | | | | | | | | | | 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
* | | clarifies documentation around the attempts arugment to retry_onGraham Turner2018-09-091-1/+3
|/ /
* | Merge pull request #33751 from steves/add_retry_notifications_to_ajRafael França2018-08-302-8/+52
|\ \ | | | | | | Add hooks to ActiveJob around retries and discards
| * | Move ActiveJob retry and discard logging into log subscriberSteve S2018-08-302-5/+31
| | |
| * | Add hooks to ActiveJob around retries and discardsSteve S2018-08-291-7/+25
| | |
* | | Permit list usage cleanup and clearer documentationKevin Deisz2018-08-271-6/+8
| | |
* | | Convert remaining usage of whitelist and blacklistKevin Deisz2018-08-241-5/+5
|/ /
* | 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-201-7/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-201-14/+28
| | | | | | | | | | Execution of `assert_performed_jobs`, and `assert_no_performed_jobs` without a block should respect passed `:except`, `:only`, and `:queue` options.
* | Allow `:queue` option to `assert_no_performed_jobs`.bogdanvlviv2018-08-201-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-201-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-202-7/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-181-3/+3
| | | | | | | | | | | | | | | | 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-151-6/+21
| | | | | | | | 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-201-4/+4
|
* Wrap ActiveJob::Enqueue in evented ActiveSupport::Notificationzvkemp2018-07-171-3/+3
|
* 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-301-2/+10
| | | | | | | | | | | 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 ```
* Clarify activejob/lib/active_job/test_helper.rbbogdanvlviv2018-06-291-2/+2
| | | | | | | | | | | 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.
* Allow call `assert_enqueued_with` and `assert_enqueued_email_with` with no blockbogdanvlviv2018-06-291-5/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert "Merge pull request #33243 from ↵Rafael Mendonça França2018-06-281-1/+1
| | | | | | | | | evopark/fix/action-mailer-test-helper-no-block" This reverts commit 9d6bbf4e0b2d2b2e2fccd87a778de2893bb28a25, reversing changes made to 5a1ea09062eaed78e21253a128d433a1beb745ad. This method only works with block.
* Fix ActionMailer assert_enqueued_email_withMarcus Ilgner2018-06-281-1/+1
| | | | | | The documentation for assert_enqueued_email_with states that it's supposed to work without a block yet it calls assert_enqueued_with which doesn't check whether a block was passed before calling `yield`
* Autoload ActiveJob::Argumentsalpaca-tc2018-06-271-0/+1
|
* ActiveJob::Arguments is no longer used in filealpaca-tc2018-06-272-3/+0
|
* Allow passing multiple exceptions to retry_on/discard_onGeorge Claghorn2018-06-251-7/+7
|
* Fix name of the second parameter of block executed by `discard_on` and ↵bogdanvlviv2018-05-291-4/+4
| | | | | | | | `retry_on` [ci skip] Follow up #32854 and ba07b5fc12a740d41d288bea6347f15f4948483c.
* update README link: md instead rdoc [ci skip]Oscar Amado2018-05-241-1/+1
|
* correct link to activejob readme [ci skip]Oscar Amado2018-05-241-1/+1
|
* Pass the error instance as the second parameter of block executed by ↵yuuji.yaginuma2018-05-121-1/+1
| | | | | | | | | | | `discard_on` I'm not sure what originally wanted to pass to the argument. However, as long as see the document added along with the commit, it seems just to be mistaken that trying to pass the error instance. https://github.com/rails/rails/pull/30622/files#diff-59beb0189c8c6bc862edf7fdb84ff5a7R64 Fixes #32853
* Make sure that when serialing an just deserialized job arguments are thereRafael Mendonça França2018-05-011-4/+16
| | | | | | | | | | | | | When a job was just deserialized `arguments` is `nil` and the serialized arguments are in the `@serialized_arguments` variable. If we try to serialize this job again the arguments are going to be `nil` instead of what was serialized. The test we had was not checking this case because it was deserializing the job in the same object that had the arguments. To fix this, when the `@serialized_arguments` are present we return it instead of the result of the `arguments` serialized.
* Strip duplicated suffixes more strictlyRyuta Kamizono2018-04-221-1/+1
| | | | In the previous code incorrectly removes intermediate words.
* Fix duplicated suffix for JobGeneratorYoshiyuki Hirano2018-04-221-0/+4
|
* fix spelling in docs for ActiveJob::Serializers::ObjectSerializer#deserializeJared Rader2018-04-131-1/+1
|
* Remove support for Qu gem.Alberto Almagro2018-03-192-49/+0
| | | | | | Reasons are that the Qu gem wasn't compatible since Rails 5.1, gem development was stopped in 2014 and maintainers have confirmed its demise. See issue #32273
* Add documentation about not accepting PRs for new adapters (#32298)Jeremy Green2018-03-191-0/+1
|
* Remove passing extra arguments to ActiveJob Callbacksbogdanvlviv2018-02-233-4/+4
|
* Add support for timezones to Active JobAndrew White2018-02-223-1/+21
| | | | | | Record what was the current timezone in effect when the job was enqueued and then restore when the job is executed in same way that the current locale is recorded and restored.
* Merge pull request #32026 from bogdanvlviv/improve-30941Rafael França2018-02-203-24/+47
|\ | | | | Improve ActiveJob custom argument serializers #30941