fixes specs
This commit is contained in:
@@ -26,9 +26,13 @@ class Officing::BaseController < ApplicationController
|
||||
end
|
||||
|
||||
def verify_booth
|
||||
if session[:booth_id].blank?
|
||||
if current_booth.blank?
|
||||
redirect_to new_officing_booth_path
|
||||
end
|
||||
end
|
||||
|
||||
def current_booth
|
||||
Poll::Booth.where(id: session[:booth_id]).first
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -38,8 +38,4 @@ class Officing::VotersController < Officing::BaseController
|
||||
.first
|
||||
end
|
||||
|
||||
def current_booth
|
||||
Poll::Booth.find(session[:booth_id])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -25,7 +25,7 @@ feature "Residence", :with_frozen_time do
|
||||
|
||||
background do
|
||||
create(:poll_officer_assignment, officer: officer)
|
||||
login_as(officer.user)
|
||||
login_through_form_as(officer.user)
|
||||
visit officing_root_path
|
||||
end
|
||||
|
||||
|
||||
@@ -59,6 +59,10 @@ feature "Voters" do
|
||||
user = create(:user, residence_verified_at: Time.current, document_type: "1", document_number: "12345678Z")
|
||||
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
|
||||
officing_verify_residence
|
||||
|
||||
@@ -97,7 +101,7 @@ feature "Voters" do
|
||||
end
|
||||
|
||||
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?")
|
||||
poll2 = create(:poll, name: "Pregunta de votación de prueba")
|
||||
|
||||
|
||||
@@ -22,14 +22,14 @@ module CommonActions
|
||||
end
|
||||
|
||||
def validate_officer
|
||||
allow_any_instance_of(Officing::ResidenceController).
|
||||
allow_any_instance_of(Officing::BaseController).
|
||||
to receive(:verify_officer_assignment).and_return(true)
|
||||
end
|
||||
|
||||
def set_officing_booth(booth=nil)
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user