diff options
author | Michael Ryan <perceptec@gmail.com> | 2015-02-06 13:05:28 -0500 |
---|---|---|
committer | Michael Ryan <perceptec@gmail.com> | 2015-02-06 14:11:42 -0500 |
commit | e818f65770fe115ab1cc7fbacc0e7e94d92af6a4 (patch) | |
tree | de3f0747cbe4d47896fa6bb8f5af170cc899fbb4 /activejob/test/integration | |
parent | ec6c98f7d11e53811fbaa13ed521386f53011630 (diff) | |
download | rails-e818f65770fe115ab1cc7fbacc0e7e94d92af6a4.tar.gz rails-e818f65770fe115ab1cc7fbacc0e7e94d92af6a4.tar.bz2 rails-e818f65770fe115ab1cc7fbacc0e7e94d92af6a4.zip |
Add an `:only` option to `perform_enqueued_jobs` to filter jobs based on
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.
Diffstat (limited to 'activejob/test/integration')
0 files changed, 0 insertions, 0 deletions