2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2019-01-02 20:53:29 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
class FailingTestJob < ApplicationJob
|
|
|
|
retry_on(StandardError, attempts: 5)
|
|
|
|
|
|
|
|
def perform
|
|
|
|
Rails.logger.debug 'Failing'
|
|
|
|
raise 'Some error...'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-01-15 12:23:16 +00:00
|
|
|
RSpec.describe ApplicationJob do
|
2019-01-02 20:53:29 +00:00
|
|
|
|
|
|
|
it 'syncs ActiveJob#executions to Delayed::Job#attempts' do
|
|
|
|
FailingTestJob.perform_later
|
|
|
|
expect { Delayed::Worker.new.work_off }.to change { Delayed::Job.last.attempts }
|
|
|
|
end
|
|
|
|
end
|