Add flash error for shift creation without date, increase spec
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user