demarches-normaliennes/spec/jobs/application_job_spec.rb

21 lines
514 B
Ruby
Raw Normal View History

require 'rails_helper'
include ActiveJob::TestHelper
2018-07-25 19:35:27 +02:00
RSpec.describe ApplicationJob, type: :job do
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
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
end
end
class ChildJob < ApplicationJob
def perform; end
end
end