application_job_spec.rb 410 B

123456789101112131415161718
  1. require 'rails_helper'
  2. class FailingTestJob < ApplicationJob
  3. retry_on(StandardError, attempts: 5)
  4. def perform
  5. Rails.logger.debug 'Failing'
  6. raise 'Some error...'
  7. end
  8. end
  9. RSpec.describe ApplicationJob do
  10. it 'syncs ActiveJob#executions to Delayed::Job#attempts' do
  11. FailingTestJob.perform_later
  12. expect { Delayed::Worker.new.work_off }.to change { Delayed::Job.last.attempts }
  13. end
  14. end