trabajo-afectivo/spec/jobs/application_job_spec.rb
2022-01-01 14:38:12 +01:00

20 lines
487 B
Ruby

# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
require 'rails_helper'
class FailingTestJob < ApplicationJob
retry_on(StandardError, attempts: 5)
def perform
Rails.logger.debug 'Failing'
raise 'Some error...'
end
end
RSpec.describe ApplicationJob do
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