application_job_spec.rb 487 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. class FailingTestJob < ApplicationJob
  4. retry_on(StandardError, attempts: 5)
  5. def perform
  6. Rails.logger.debug 'Failing'
  7. raise 'Some error...'
  8. end
  9. end
  10. RSpec.describe ApplicationJob do
  11. it 'syncs ActiveJob#executions to Delayed::Job#attempts' do
  12. FailingTestJob.perform_later
  13. expect { Delayed::Worker.new.work_off }.to change { Delayed::Job.last.attempts }
  14. end
  15. end