validation is enableed only for 'new' procedures

This commit is contained in:
clemkeirua 2020-07-15 16:06:24 +02:00 committed by Keirua (Rebase PR Action)
parent 0d88674cea
commit 31d48c2879
3 changed files with 35 additions and 12 deletions

View file

@ -176,6 +176,13 @@ feature 'The user' do
create(:procedure, :published, :for_individual, types_de_champ: tdcs)
end
let(:old_procedure_with_disabled_pj_validation) do
tdcs = [
create(:type_de_champ_piece_justificative, mandatory: true, libelle: 'Pièce justificative 1', order_place: 1, skip_pj_validation: true)
]
create(:procedure, :published, :for_individual, types_de_champ: tdcs)
end
scenario 'add an attachment', js: true do
log_in(user, procedure_with_pjs)
fill_individual
@ -216,6 +223,16 @@ feature 'The user' do
expect(page).to have_text('piece_justificative_0.pdf')
end
scenario 'add an invalid attachment on an old procedure where pj validation is disabled', js: true do
log_in(user, old_procedure_with_disabled_pj_validation)
fill_individual
# Test invalid file type
attach_file('Pièce justificative 1', Rails.root + 'spec/fixtures/files/invalid_file_format.json')
expect(page).to have_no_text('La pièce justificative nest pas dun type accepté')
expect(page).to have_text('analyse antivirus en cours', count: 1)
end
scenario 'retry on transcient upload error', js: true do
log_in(user, procedure_with_pjs)
fill_individual