views: refactor the attachment/edit view
Make it more reusable, by: - Renaming `attachment/update` to `attachment/edit` - Refactoring the CSS styles into their own stylesheet - Allow to specify the 'accept' option
This commit is contained in:
parent
5be83bd01e
commit
1c61f2de58
12 changed files with 66 additions and 57 deletions
|
@ -108,7 +108,7 @@ feature 'Inviting an expert:' do
|
|||
expect(page).to have_text('Cet avis est confidentiel')
|
||||
|
||||
fill_in 'avis_answer', with: 'Ma réponse d’expert : c’est un oui.'
|
||||
find('.piece-justificative input[type=file]').attach_file(Rails.root + 'spec/fixtures/files/RIB.pdf')
|
||||
find('.attachment input[type=file]').attach_file(Rails.root + 'spec/fixtures/files/RIB.pdf')
|
||||
click_on 'Envoyer votre avis'
|
||||
|
||||
expect(page).to have_content('Votre réponse est enregistrée')
|
||||
|
|
|
@ -169,25 +169,19 @@ feature 'The user' do
|
|||
# Mark file as scanned and clean
|
||||
attachment = ActiveStorage::Attachment.last
|
||||
attachment.blob.update(metadata: attachment.blob.metadata.merge(scanned_at: Time.zone.now, virus_scan_result: ActiveStorage::VirusScanner::SAFE))
|
||||
within '.piece-justificative' do
|
||||
click_on 'rafraichir'
|
||||
end
|
||||
within('.attachment') { click_on 'rafraichir' }
|
||||
expect(page).to have_link('file.pdf')
|
||||
expect(page).to have_no_content('analyse antivirus en cours')
|
||||
|
||||
# Replace the attachment
|
||||
within '.piece-justificative' do
|
||||
click_on 'Remplacer'
|
||||
end
|
||||
within('.attachment') { click_on 'Remplacer' }
|
||||
find('.editable-champ-piece_justificative input[type=file]').attach_file(Rails.root + 'spec/fixtures/files/RIB.pdf')
|
||||
click_on 'Enregistrer le brouillon'
|
||||
expect(page).to have_no_text('file.pdf')
|
||||
expect(page).to have_text('RIB.pdf')
|
||||
|
||||
# Remove the attachment
|
||||
within '.piece-justificative' do
|
||||
click_on 'Supprimer'
|
||||
end
|
||||
within('.attachment') { click_on 'Supprimer' }
|
||||
expect(page).to have_content('La pièce jointe a bien été supprimée')
|
||||
expect(page).to have_no_text('RIB.pdf')
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue