From dfd3f9ecb78974c4fe90a24c0e779bef87c38e09 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 18 Dec 2017 13:36:29 +0100 Subject: Referentials#validate: Update flash message * Luc specified a new flash message string to use here. Update the old one with the new version. * Move the translation key to `notice.referentials.validate` because we have multiple "operation_in_progress" messages (this one for validation, and another for referential cloning/duplication). * Add a test to confirm that the flash message is set. Refs #5317 --- app/controllers/referentials_controller.rb | 2 +- config/locales/referentials.en.yml | 2 +- config/locales/referentials.fr.yml | 2 +- spec/controllers/referentials_controller_spec.rb | 12 ++++++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb index ee1236912..f97e2c211 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -60,7 +60,7 @@ class ReferentialsController < ChouetteController def validate ComplianceControlSetCopyWorker.perform_async(params[:compliance_control_set], params[:id]) - flash[:notice] = I18n.t("referentials.operation_in_progress") + flash[:notice] = I18n.t('notice.referentials.validate') redirect_to(referential_path) end diff --git a/config/locales/referentials.en.yml b/config/locales/referentials.en.yml index 8420e9539..f3a9cdfd1 100644 --- a/config/locales/referentials.en.yml +++ b/config/locales/referentials.en.yml @@ -5,7 +5,6 @@ en: name: 'Search by name' line: 'Seach by associated lines' search_no_results: 'No data space matching your query' - operation_in_progress: The validation process is in progress error_period_filter: "The period filter must have valid bounding dates" index: title: 'Data spaces' @@ -126,6 +125,7 @@ en: notice: referentials: deleted: "Datasets has been successfully destroyed" + validate: "The validation is in progress. Please wait and refresh the page in a few moments." referential: archived: "The data space has been successfully archived" unarchived: "The data space has been successfully unarchived" diff --git a/config/locales/referentials.fr.yml b/config/locales/referentials.fr.yml index ec7ed776d..7f986ed93 100644 --- a/config/locales/referentials.fr.yml +++ b/config/locales/referentials.fr.yml @@ -5,7 +5,6 @@ fr: name: 'Indiquez un nom de jeu de données...' line: 'Indiquez une ligne...' search_no_results: 'Aucun jeu de données ne correspond à votre recherche' - operation_in_progress: L'opération de validation est en cours error_period_filter: "Le filtre par période doit contenir une date de début et de fin valides" index: title: 'Jeux de données' @@ -124,6 +123,7 @@ fr: notice: referentials: deleted: "Les jeux de données on été supprimés" + validate: "La validation est en cours, veuillez patienter. Actualiser votre page si vous voulez voir l'avancement de votre traitement." referential: archived: "Le jeu de données a été correctement conservé" unarchived: "Le jeu de données a été correctement déconservé" diff --git a/spec/controllers/referentials_controller_spec.rb b/spec/controllers/referentials_controller_spec.rb index fba063085..dad2b3c8f 100644 --- a/spec/controllers/referentials_controller_spec.rb +++ b/spec/controllers/referentials_controller_spec.rb @@ -30,4 +30,16 @@ describe ReferentialsController, :type => :controller do expect(assigns[:compliance_control_sets]).to eq([compliance_control_set]) end end + + describe "POST #validate" do + it "displays a flash message" do + post :validate, id: referential.id, params: { + compliance_control_set: create(:compliance_control_set).id + } + + expect(controller).to set_flash[:notice].to( + I18n.t('notice.referentials.validate') + ) + end + end end -- cgit v1.2.3