| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
If the argument is invalid, I think that it is more intuitive to use
`ArgumentError` than its own error class.
|
|
|
|
|
|
|
|
|
| |
This fixes the following warnings:
```
rails/activejob/lib/active_job/test_helper.rb:119: warning: circular argument reference - except
rails/activejob/lib/active_job/test_helper.rb:166: warning: circular argument reference - except
```
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#26690)
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
|
|\
| |
| | |
Specify the queue to be used with assert_enqueued_jobs
|
| | |
|
|/
|
|
| |
[ci skip]
|
| |
|
|
|
|
|
|
|
|
|
| |
This removes the following warnings.
```
/home/travis/build/rails/rails/activejob/lib/active_job/test_helper.rb:241: warning: shadowing outer local variable - job
/home/travis/build/rails/rails/activejob/lib/active_job/test_helper.rb:265: warning: shadowing outer local variable - job
```
|
| |
|
| |
|
|
|
|
|
|
| |
`subclasses` get only child classes.
Therefore, if create a job common parent class as `ApplicationJob`,
inherited class does not get properly.
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
test.
This PR adds a method called `queue_adapter_for_test` to
`ActiveJob::TestHelper`. This method is expected to provide the queue
adapter to be used for jobs under test. It maintains the current
behaviour by defaulting to an instance of
`ActiveJob::QueueAdapter::TestAdapter`. Tests that include
`ActiveJob::TestHelper` or extend from `ActiveJob::TestCase` can provide
a custom queue adapter by overriding `queue_adapter_for_test` in their
class.
|
|
|
|
| |
method [ci skip]
|
|
|
|
| |
Instance methods can be defined in the module itself
|
| |
|
| |
|
|
|
|
| |
`assert_performed_with`
|
| |
|
|
|
|
| |
[CI skip]
|
|
|
|
| |
[Robin Dupret]
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
This allows different `queue_adapters` to be used in each `ActiveJob`
class heirarchy. Previously, all subclasses used a single global queue
adapter.
|
| |
|
|
|
|
|
|
|
| |
The filter was set on the pseudo-global TestAdapter but not restored to
its original value.
See e818f65770fe115ab1cc7fbacc0e7e94d92af6a4
|
|
|
|
|
|
|
|
|
| |
Since `ActiveJob::TestHelper` globally sets
`ActiveJob::Base.queue_adapter` on setup, there is no benefit in
instantiating a new `TestAdapter` per tests. The original rationale was
to allow parallel tests to run without interference, but since they'd
all mutate the global `ActiveJob::Base.queue_adapter`, that was never
realized.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
type.
This allows specific jobs to be tested, while preventing others from
being performed unnecessarily.
Example:
def test_hello_job
assert_performed_jobs 1, only: HelloJob do
HelloJob.perform_later('jeremy')
LoggingJob.perform_later
end
end
An array may also be specified, to support testing multiple jobs.
Example:
def test_hello_and_logging_jobs
assert_nothing_raised do
assert_performed_jobs 2, only: [HelloJob, LoggingJob] do
HelloJob.perform_later('jeremy')
LoggingJob.perform_later('stewie')
RescueJob.perform_later('david')
end
end
end
Fixes #18802.
Trim space and document :only option.
|
| |
|
| |
|
|
|
|
| |
With the option, assert_enqueued_jobs will check the number of times a specific kind of job is enqueued.
|
|
|
|
|
|
|
|
| |
1. The :test adapter wasn't going through a full cycle of
serialize/deserialize when performing jobs. Now it does
2. Regular AJ tests were not run for the :test adapter. Now they are
3. ActiveJob::TestHelper uses assert_valid_keys but doesn’t requires
the file that implements that method. Now it does
|
|
|
|
|
|
|
|
|
| |
It will set proper queue_adapter state required by assert_performed_jobs assertions.
Also the block version of assert_performed_jobs will make sure this
state is respected.
Fixes #17684
|
|
|
|
| |
[ci skip]
|
|
|
|
|
|
|
|
| |
accepts blocks for `assert_no_enqueued_jobs` and `assert_no_performed_jobs` test helpers.
- args => arguments when used in actual docs.
[ci skip]
|
| |
|
| |
|
| |
|
| |
|
|
|