bug(instructeurs/archives#create): month should not be nil

This commit is contained in:
Martin 2022-08-23 14:30:15 +02:00 committed by mfo
parent 9c27128c8b
commit e35da17ce8
3 changed files with 15 additions and 0 deletions

View file

@ -32,6 +32,7 @@ describe 'Creating a new procedure', js: true do
page.first(".archive-table .button").click
}.to have_enqueued_job(ArchiveCreationJob).with(procedure, an_instance_of(Archive), administrateur)
expect(page).to have_content("Votre demande a été prise en compte. Selon le nombre de dossiers, cela peut prendre de quelques minutes a plusieurs heures. Vous recevrez un courriel lorsque le fichier sera disponible.")
expect(Archive.first.month).not_to be_nil
# check exports
click_on "Télécharger tous les dossiers"

View file

@ -180,6 +180,20 @@ describe 'Instructing a dossier:', js: true do
expect(page).to have_text("Dossier envoyé")
end
context 'A instructeur can ask for an Archive' do
let(:procedure) { create(:procedure, :published, :with_piece_justificative, instructeurs: [instructeur]) }
let(:dossier) { create(:dossier, :accepte, procedure: procedure) }
before do
log_in(instructeur.email, password)
visit instructeur_archives_path(procedure)
end
scenario 'download' do
expect {
page.first(".archive-table .button").click
}.to have_enqueued_job(ArchiveCreationJob).with(procedure, an_instance_of(Archive), instructeur)
expect(Archive.first.month).not_to be_nil
end
end
context 'with dossiers having attached files', js: true do
let(:procedure) { create(:procedure, :published, :with_piece_justificative, instructeurs: [instructeur]) }
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }