rend plus robuste la création de l'archive

This commit is contained in:
Christophe Robillard 2021-04-21 16:54:15 +02:00
parent 59a08ad307
commit 8bee53fe77
6 changed files with 62 additions and 24 deletions

View file

@ -33,15 +33,16 @@ describe Instructeurs::ArchivesController, type: :controller do
describe '#create' do
let(:month) { '21-03' }
let(:date_month) { Date.strptime(month, "%Y-%m") }
let(:archive) { create(:archive) }
let(:subject) do
post :create, {
xhr: true,
params: { procedure_id: procedure1.id, type: 'monthly', month: month }
}
end
it "performs archive creation job" do
expect { subject }.to have_enqueued_job(ArchiveCreationJob).with(procedure1, instructeur, 'monthly', date_month)
allow_any_instance_of(ProcedureArchiveService).to receive(:create_pending_archive).and_return(archive)
expect { subject }.to have_enqueued_job(ArchiveCreationJob).with(procedure1, archive, instructeur)
expect(flash.notice).to include("Votre demande a été prise en compte")
end
end