fix spec (% 10000 and assert_performed_jobs)

This commit is contained in:
seb-by-ouidou 2023-06-27 15:40:08 +02:00 committed by Fabrice Gangler
parent 1dfb3817e6
commit dcdf33e4fd
2 changed files with 11 additions and 9 deletions

View file

@ -36,7 +36,7 @@ describe ProcedureArchiveService do
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/pieces_justificatives/",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/pieces_justificatives/attestation-dossier--05-03-2021-00-00-#{dossier.attestation.pdf.id % 10000}.pdf",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/export-#{dossier.id}-05-03-2021-00-00-#{dossier.id}.pdf"
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/export-#{dossier.id}-05-03-2021-00-00-#{dossier.id % 10000}.pdf"
]
expect(files.map(&:filename)).to match_array(structure)
end
@ -56,7 +56,7 @@ describe ProcedureArchiveService do
"#{service.send(:zip_root_folder, archive)}/-LISTE-DES-FICHIERS-EN-ERREURS.txt",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/pieces_justificatives/",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/export-#{dossier.id}-05-03-2021-00-00-#{dossier.id}.pdf"
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/export-#{dossier.id}-05-03-2021-00-00-#{dossier.id % 10000}.pdf"
]
expect(files.map(&:filename)).to match_array(structure)
end
@ -104,7 +104,7 @@ describe ProcedureArchiveService do
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/export-dossier-05-03-2020-00-00-1.pdf",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/pieces_justificatives/",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/export-#{dossier.id}-05-03-2021-00-00-#{dossier.id}.pdf"
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/export-#{dossier.id}-05-03-2021-00-00-#{dossier.id % 10000}.pdf"
]
expect(zip_entries.map(&:filename)).to match_array(structure)
zip_entries.map do |entry|
@ -137,9 +137,9 @@ describe ProcedureArchiveService do
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/pieces_justificatives/",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/pieces_justificatives/attestation-dossier--05-03-2020-00-00-#{dossier.attestation.pdf.id % 10000}.pdf",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/export-#{dossier.id}-05-03-2020-00-00-#{dossier.id}.pdf",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier.id}/export-#{dossier.id}-05-03-2020-00-00-#{dossier.id % 10000}.pdf",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier_2020.id}/",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier_2020.id}/export-#{dossier_2020.id}-05-03-2020-00-00-#{dossier_2020.id}.pdf",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier_2020.id}/export-#{dossier_2020.id}-05-03-2020-00-00-#{dossier_2020.id % 10000}.pdf",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier_2020.id}/pieces_justificatives/",
"#{service.send(:zip_root_folder, archive)}/dossier-#{dossier_2020.id}/pieces_justificatives/attestation-dossier--05-03-2020-00-00-#{dossier_2020.attestation.pdf.id % 10000}.pdf"
]

View file

@ -107,11 +107,12 @@ describe 'Instructing a dossier:', js: true do
end
scenario 'A instructeur can request an export' do
assert_performed_jobs 1 do
log_in(instructeur.email, password)
end
click_on procedure.libelle
test_statut_bar(a_suivre: 1, tous_les_dossiers: 1)
assert_performed_jobs 1
click_on "Télécharger un dossier"
within(:css, '.dossiers-export') do
@ -121,8 +122,9 @@ describe 'Instructing a dossier:', js: true do
expect(page).to have_text('Nous générons cet export.')
click_on "Télécharger un dossier"
expect(page).to have_text('Un export au format .csv est en train dêtre généré')
assert_performed_jobs 2 do
perform_enqueued_jobs(only: ExportJob)
assert_performed_jobs 2
end
page.driver.browser.navigate.refresh
click_on "Télécharger un dossier"