Merge pull request #9350 from adullact/adullact_fix_spec_instructeur_procedures_controller

fix spec (% 10000 and assert_performed_jobs)
This commit is contained in:
Paul Chavard 2023-07-25 11:07:30 +00:00 committed by GitHub
commit 9571981856
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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
log_in(instructeur.email, password)
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é')
perform_enqueued_jobs(only: ExportJob)
assert_performed_jobs 2
assert_performed_jobs 2 do
perform_enqueued_jobs(only: ExportJob)
end
page.driver.browser.navigate.refresh
click_on "Télécharger un dossier"