rails/activejob/test/jobs/raising_job.rb
Edouard CHIN 13cb5b78a8 Fix AJ TestAdapter#performed_jobs not properly counting job:
- ### Problem

  If we use `perform_enqueued_jobs` without a block,
  a job that raises an error wouldn't be appended to
  the list of `performed_jobs`.

  ### Solution

  Push the job in the array before it is actually performed.
2020-03-09 19:46:11 -04:00

12 lines
221 B
Ruby

# frozen_string_literal: true
class RaisingJob < ActiveJob::Base
MyError = Class.new(StandardError)
retry_on(MyError, attempts: 2)
def perform(error = "RaisingJob::MyError")
raise error.constantize
end
end