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
|
@officer = @shift.officer
|
||||||
|
|
||||||
if @shift.save
|
if @shift.save
|
||||||
notice = t("admin.poll_shifts.flash.create")
|
redirect_to new_admin_booth_shift_path(@shift.booth), notice: t("admin.poll_shifts.flash.create")
|
||||||
redirect_to new_admin_booth_shift_path(@shift.booth), notice: notice
|
|
||||||
else
|
else
|
||||||
load_shifts
|
load_shifts
|
||||||
|
flash[:error] = t("admin.poll_shifts.flash.date_missing")
|
||||||
render :new
|
render :new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -520,6 +520,7 @@ en:
|
|||||||
flash:
|
flash:
|
||||||
create: "Shift added"
|
create: "Shift added"
|
||||||
destroy: "Shift removed"
|
destroy: "Shift removed"
|
||||||
|
date_missing: "A date must be selected"
|
||||||
vote_collection: Collect Votes
|
vote_collection: Collect Votes
|
||||||
recount_scrutiny: Recount & Scrutiny
|
recount_scrutiny: Recount & Scrutiny
|
||||||
poll_booth_assignments:
|
poll_booth_assignments:
|
||||||
|
|||||||
@@ -520,6 +520,7 @@ es:
|
|||||||
flash:
|
flash:
|
||||||
create: "Añadido turno de presidente de mesa"
|
create: "Añadido turno de presidente de mesa"
|
||||||
destroy: "Eliminado turno de presidente de mesa"
|
destroy: "Eliminado turno de presidente de mesa"
|
||||||
|
date_missing: "Debe seleccionarse una fecha"
|
||||||
vote_collection: Recoger Votos
|
vote_collection: Recoger Votos
|
||||||
recount_scrutiny: Recuento & Escrutinio
|
recount_scrutiny: Recuento & Escrutinio
|
||||||
poll_booth_assignments:
|
poll_booth_assignments:
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ feature 'Admin shifts' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Erros on create", :js do
|
scenario "Error on create", :js do
|
||||||
poll = create(:poll)
|
poll = create(:poll)
|
||||||
booth = create(:poll_booth)
|
booth = create(:poll_booth)
|
||||||
officer = create(:poll_officer)
|
officer = create(:poll_officer)
|
||||||
@@ -104,7 +104,7 @@ feature 'Admin shifts' do
|
|||||||
click_link "Edit shifts"
|
click_link "Edit shifts"
|
||||||
click_button "Add shift"
|
click_button "Add shift"
|
||||||
|
|
||||||
expect(page).to have_content "can't be blank"
|
expect(page).to have_content "A date must be selected"
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Destroy" do
|
scenario "Destroy" do
|
||||||
|
|||||||
Reference in New Issue
Block a user