2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-10-03 16:31:17 +02:00
|
|
|
include ActiveJob::TestHelper
|
|
|
|
|
2018-07-25 19:35:27 +02:00
|
|
|
RSpec.describe ApplicationJob, type: :job do
|
2021-04-29 13:55:43 +02:00
|
|
|
it_behaves_like 'a job retrying transient errors'
|
|
|
|
|
2017-10-03 16:31:17 +02:00
|
|
|
describe 'perform' do
|
2018-07-25 19:35:27 +02:00
|
|
|
before do
|
|
|
|
allow(Rails.logger).to receive(:info)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'logs start time and end time' do
|
2017-10-03 16:31:17 +02:00
|
|
|
perform_enqueued_jobs { ChildJob.perform_later }
|
2018-07-25 19:35:27 +02:00
|
|
|
expect(Rails.logger).to have_received(:info).with(/started at/).once
|
|
|
|
expect(Rails.logger).to have_received(:info).with(/ended at/).once
|
2017-10-03 16:31:17 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class ChildJob < ApplicationJob
|
|
|
|
def perform; end
|
|
|
|
end
|
|
|
|
end
|