module ActiveJob::TestHelper
def assert_no_performed_jobs(only: nil, except: nil, &block)
Note: This assertion is simply a shortcut for:
end
end
HelloJob.perform_later('jeremy')
assert_no_performed_jobs except: HelloJob do
def test_no_logging
then the job(s) except specific class will not be performed.
Also if the :except option is specified,
end
end
HelloJob.perform_later('jeremy')
assert_no_performed_jobs only: LoggingJob do
def test_no_logging
then only the listed job(s) will not be performed.
The block form supports filtering. If the :only option is specified,
end
end
# No job should be performed from this block
assert_no_performed_jobs do
def test_jobs_again
If a block is passed, that block should not cause any job to be performed.
end
end
assert_performed_jobs 1
HelloJob.perform_later('matthew')
perform_enqueued_jobs do
assert_no_performed_jobs
def test_jobs
Asserts that no jobs have been performed.
def assert_no_performed_jobs(only: nil, except: nil, &block) assert_performed_jobs 0, only: only, except: except, &block end