Add notice after destroying a banner

We were missing a notice in this case. Not only this caused
inconsistencies in the user experience, but it also made it hard to add
an expectation in the test checking the request had finished before
making a new one. Simultaneous requests sometimes cause failures in our
test suite.
This commit is contained in:
Javi Martín
2022-06-02 18:55:16 +02:00
parent 5c317927c0
commit d4c62e2fc6
4 changed files with 7 additions and 1 deletions

View File

@@ -32,7 +32,7 @@ class Admin::BannersController < Admin::BaseController
def destroy def destroy
@banner.destroy! @banner.destroy!
redirect_to admin_banners_path redirect_to admin_banners_path, notice: t("admin.banners.destroy.notice")
end end
private private

View File

@@ -38,6 +38,8 @@ en:
sdg: SDG sdg: SDG
create: create:
notice: "Banner created successfully" notice: "Banner created successfully"
destroy:
notice: "Banner deleted successfully"
edit: edit:
editing: Edit banner editing: Edit banner
form: form:

View File

@@ -38,6 +38,8 @@ es:
sdg: ODS sdg: ODS
create: create:
notice: "Banner creado correctamente" notice: "Banner creado correctamente"
destroy:
notice: "Banner eliminado correctamente"
edit: edit:
editing: Editar el banner editing: Editar el banner
form: form:

View File

@@ -177,6 +177,8 @@ describe "Admin banners magement", :admin do
click_button "Delete" click_button "Delete"
end end
expect(page).to have_content "Banner deleted successfully"
visit admin_root_path visit admin_root_path
expect(page).not_to have_content "Ugly banner" expect(page).not_to have_content "Ugly banner"
end end