From d0837c58f525380105e4675f17b57cdabab66ec4 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Wed, 21 Aug 2024 17:35:46 +0200 Subject: [PATCH] fix(admin): publish modifications button must be PUT --- ...npublished_changes_sticky_header.html.haml | 2 +- .../administrateurs/types_de_champ_spec.rb | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/app/views/administrateurs/procedures/_unpublished_changes_sticky_header.html.haml b/app/views/administrateurs/procedures/_unpublished_changes_sticky_header.html.haml index 97158037e..12c0cce0a 100644 --- a/app/views/administrateurs/procedures/_unpublished_changes_sticky_header.html.haml +++ b/app/views/administrateurs/procedures/_unpublished_changes_sticky_header.html.haml @@ -6,4 +6,4 @@ = t('.intro_html').html_safe %span.no-wrap = link_to t('.see_changes'), admin_procedure_path(procedure), class: 'fr-btn fr-btn--secondary fr-mr-2w' - = link_to t('.publish_changes'), admin_procedure_publish_revision_path(procedure), class: 'fr-btn', method: :post, data: { disable_with: "Publication...", confirm: 'Êtes-vous sûr de vouloir publier les modifications ?' } + = link_to t('.publish_changes'), admin_procedure_publish_revision_path(procedure), class: 'fr-btn', method: :put, data: { disable_with: "Publication...", confirm: 'Êtes-vous sûr de vouloir publier les modifications ?' } diff --git a/spec/system/administrateurs/types_de_champ_spec.rb b/spec/system/administrateurs/types_de_champ_spec.rb index b25e64087..91d09dbd5 100644 --- a/spec/system/administrateurs/types_de_champ_spec.rb +++ b/spec/system/administrateurs/types_de_champ_spec.rb @@ -368,6 +368,7 @@ describe 'As an administrateur I can edit types de champ', js: true do fill_in 'Libellé du champ', with: 'Premier champ' expect(page).to have_selector('.sticky-header.sticky-header-warning') expect(page).to have_content("Les modifications effectuées ne seront visibles qu'à la prochaine publication") + expect(page).to have_link('Publier les modifications') expect(page).to have_field('Libellé du champ', with: 'Premier champ') @@ -386,19 +387,15 @@ describe 'As an administrateur I can edit types de champ', js: true do expect(page).to have_selector('.sticky-header.sticky-header-warning') expect(page).to have_content("Les modifications effectuées ne seront visibles qu'à la prochaine publication") - # Supprimer les champs + # Supprime dernier champ + all('.fr-btn--tertiary-no-outline[title="Supprimer le champ"]').last.click + page.driver.browser.switch_to.alert.accept rescue nil - 2.times do - initial_count = page.all('.type-de-champ').count + expect(page).to have_selector('.type-de-champ', count: 1, wait: 5) + click_on "Publier les modifications" - first('.fr-btn--tertiary-no-outline[title="Supprimer le champ"]').click - - page.driver.browser.switch_to.alert.accept rescue nil - - expect(page).to have_selector('.type-de-champ', count: initial_count - 1, wait: 5) - end - - expect(page).not_to have_selector('.sticky-header.sticky-header-warning') + page.driver.browser.switch_to.alert.accept + expect(page).to have_content("démarche publiée") unpublished_procedure = create(:procedure) visit champs_admin_procedure_path(unpublished_procedure)