fixes specs
This commit is contained in:
@@ -26,9 +26,13 @@ class Officing::BaseController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def verify_booth
|
def verify_booth
|
||||||
if session[:booth_id].blank?
|
if current_booth.blank?
|
||||||
redirect_to new_officing_booth_path
|
redirect_to new_officing_booth_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def current_booth
|
||||||
|
Poll::Booth.where(id: session[:booth_id]).first
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -38,8 +38,4 @@ class Officing::VotersController < Officing::BaseController
|
|||||||
.first
|
.first
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_booth
|
|
||||||
Poll::Booth.find(session[:booth_id])
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ feature "Residence", :with_frozen_time do
|
|||||||
|
|
||||||
background do
|
background do
|
||||||
create(:poll_officer_assignment, officer: officer)
|
create(:poll_officer_assignment, officer: officer)
|
||||||
login_as(officer.user)
|
login_through_form_as(officer.user)
|
||||||
visit officing_root_path
|
visit officing_root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ feature "Voters" do
|
|||||||
user = create(:user, residence_verified_at: Time.current, document_type: "1", document_number: "12345678Z")
|
user = create(:user, residence_verified_at: Time.current, document_type: "1", document_number: "12345678Z")
|
||||||
expect(user).not_to be_level_two_verified
|
expect(user).not_to be_level_two_verified
|
||||||
|
|
||||||
|
visit root_path
|
||||||
|
click_link "Sign out"
|
||||||
|
login_through_form_as(officer.user)
|
||||||
|
|
||||||
visit new_officing_residence_path
|
visit new_officing_residence_path
|
||||||
officing_verify_residence
|
officing_verify_residence
|
||||||
|
|
||||||
@@ -97,7 +101,7 @@ feature "Voters" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Store officer and booth information", :js do
|
scenario "Store officer and booth information", :js do
|
||||||
create(:user, :in_census, id: rand(9999))
|
create(:user, :in_census, id: rand(9999999))
|
||||||
poll1 = create(:poll, name: "¿Quieres que XYZ sea aprobado?")
|
poll1 = create(:poll, name: "¿Quieres que XYZ sea aprobado?")
|
||||||
poll2 = create(:poll, name: "Pregunta de votación de prueba")
|
poll2 = create(:poll, name: "Pregunta de votación de prueba")
|
||||||
|
|
||||||
|
|||||||
@@ -22,14 +22,14 @@ module CommonActions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def validate_officer
|
def validate_officer
|
||||||
allow_any_instance_of(Officing::ResidenceController).
|
allow_any_instance_of(Officing::BaseController).
|
||||||
to receive(:verify_officer_assignment).and_return(true)
|
to receive(:verify_officer_assignment).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_officing_booth(booth=nil)
|
def set_officing_booth(booth=nil)
|
||||||
booth = create(:poll_booth) if booth.blank?
|
booth = create(:poll_booth) if booth.blank?
|
||||||
|
|
||||||
allow_any_instance_of(Officing::VotersController).
|
allow_any_instance_of(Officing::BaseController).
|
||||||
to receive(:current_booth).and_return(booth)
|
to receive(:current_booth).and_return(booth)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user