diff --git a/app/controllers/admin/poll/shifts_controller.rb b/app/controllers/admin/poll/shifts_controller.rb index 42093439d..577e8afad 100644 --- a/app/controllers/admin/poll/shifts_controller.rb +++ b/app/controllers/admin/poll/shifts_controller.rb @@ -14,10 +14,10 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController @officer = @shift.officer if @shift.save - notice = t("admin.poll_shifts.flash.create") - redirect_to new_admin_booth_shift_path(@shift.booth), notice: notice + redirect_to new_admin_booth_shift_path(@shift.booth), notice: t("admin.poll_shifts.flash.create") else load_shifts + flash[:error] = t("admin.poll_shifts.flash.date_missing") render :new end end diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 0b578feb0..14965431a 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -520,6 +520,7 @@ en: flash: create: "Shift added" destroy: "Shift removed" + date_missing: "A date must be selected" vote_collection: Collect Votes recount_scrutiny: Recount & Scrutiny poll_booth_assignments: diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index b2d0e658c..329c9ce69 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -520,6 +520,7 @@ es: flash: create: "AƱadido turno de presidente de mesa" destroy: "Eliminado turno de presidente de mesa" + date_missing: "Debe seleccionarse una fecha" vote_collection: Recoger Votos recount_scrutiny: Recuento & Escrutinio poll_booth_assignments: diff --git a/spec/features/admin/poll/shifts_spec.rb b/spec/features/admin/poll/shifts_spec.rb index 15fc552fa..bf6240577 100644 --- a/spec/features/admin/poll/shifts_spec.rb +++ b/spec/features/admin/poll/shifts_spec.rb @@ -88,7 +88,7 @@ feature 'Admin shifts' do end end - scenario "Erros on create", :js do + scenario "Error on create", :js do poll = create(:poll) booth = create(:poll_booth) officer = create(:poll_officer) @@ -104,7 +104,7 @@ feature 'Admin shifts' do click_link "Edit shifts" click_button "Add shift" - expect(page).to have_content "can't be blank" + expect(page).to have_content "A date must be selected" end scenario "Destroy" do