add specs

This commit is contained in:
Lisa Durand 2024-05-07 16:27:08 +02:00 committed by Eric Leroy-Terquem
parent b4a7b4bfbd
commit 93c3761107
No known key found for this signature in database
GPG key ID: ECE60B4C1FA2ABB3
7 changed files with 129 additions and 30 deletions

View file

@ -1429,13 +1429,13 @@ describe Instructeurs::DossiersController, type: :controller do
describe '#pieces_jointes' do
let(:procedure) { create(:procedure, :published, types_de_champ_public: [{ type: :piece_justificative }], instructeurs:) }
let(:dossier) { create(:dossier, :en_construction, :with_populated_champs, procedure: procedure) }
let(:path) { 'spec/fixtures/files/logo_test_procedure.png' }
before do
dossier.champs.first.piece_justificative_file.attach(
io: StringIO.new("image file"),
filename: "image.jpeg",
content_type: "image/jpeg",
# we don't want to run virus scanner on this file
io: File.open(path),
filename: "logo_test_procedure.png",
content_type: "image/png",
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE }
)
get :pieces_jointes, params: {
@ -1446,7 +1446,7 @@ describe Instructeurs::DossiersController, type: :controller do
it do
expect(response.body).to include('Télécharger le fichier toto.txt')
expect(response.body).to include('Télécharger le fichier image.jpeg')
expect(response.body).to include('Télécharger le fichier logo_test_procedure.png')
expect(response.body).to include('Visualiser')
end
end