specs: cleanup "Delete draft from dossiers list" spec

This commit is contained in:
Pierre de La Morinerie 2019-01-24 15:38:34 +00:00
parent 934368616c
commit f1f7f0ef9f
2 changed files with 7 additions and 7 deletions

View file

@ -52,7 +52,7 @@
= dossier.updated_at.strftime("%d/%m/%Y")
%td.action-col.delete-col
- if dossier.brouillon?
= link_to(ask_deletion_dossier_path(dossier), method: :post, class: 'button danger', data: { disable: true, confirm: "En continuant, vous allez supprimer ce dossier ainsi que les informations quil contient. Toute suppression entraine lannulation de la démarche en cours.\n\nConfirmer la suppression ?" }) do
= link_to(ask_deletion_dossier_path(dossier), method: :post, class: 'button danger', data: { disable: true, confirm: "En continuant, vous allez supprimer ce dossier ainsi que les informations quil contient. Toute suppression entraine lannulation de la démarche en cours.\n\nConfirmer la suppression ?" }) do
%span.icon.delete
Supprimer
= paginate(@dossiers)

View file

@ -49,13 +49,13 @@ describe 'user access to the list of his dossier' do
expect(page).not_to have_link(nil, href: ask_deletion_dossier_path(dossier1))
end
context 'when user clicks on delete brouillon list', js: true do
before do
find(:xpath, "//a[@href='#{ask_deletion_dossier_path(dossier_brouillon)}']").click
page.driver.browser.switch_to.alert.accept
end
context 'when user clicks on delete brouillon', js: true do
scenario 'dossier is deleted' do
expect(page).not_to have_link("Supprimer", href: dossier_brouillon.procedure.libelle)
page.accept_alert('Confirmer la suppression ?') do
find(:xpath, "//a[@href='#{ask_deletion_dossier_path(dossier_brouillon)}']").click
end
expect(page).to have_content('Votre dossier a bien été supprimé.')
end
end