Simplify assigning officer to a poll in specs
While it could be argued we're hiding the real way we've defined associations in our models, the tests are so much easier to read when we don't have so many lines just creating data. Furthermore, developers who care about vertically aligning the code will be glad to see some variables disrupting this alignment are now gone.
This commit is contained in:
@@ -145,9 +145,15 @@ FactoryBot.define do
|
|||||||
|
|
||||||
factory :poll_officer_assignment, class: "Poll::OfficerAssignment" do
|
factory :poll_officer_assignment, class: "Poll::OfficerAssignment" do
|
||||||
association :officer, factory: :poll_officer
|
association :officer, factory: :poll_officer
|
||||||
association :booth_assignment, factory: :poll_booth_assignment
|
|
||||||
date { Date.current }
|
date { Date.current }
|
||||||
|
|
||||||
|
transient { poll { association(:poll) } }
|
||||||
|
transient { booth { association(:poll_booth) } }
|
||||||
|
|
||||||
|
booth_assignment do
|
||||||
|
association :poll_booth_assignment, poll: poll, booth: booth
|
||||||
|
end
|
||||||
|
|
||||||
trait :final do
|
trait :final do
|
||||||
final { true }
|
final { true }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -118,9 +118,8 @@ describe "Admin booths assignments" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Unassing booth whith associated shifts", :js do
|
scenario "Unassing booth whith associated shifts", :js do
|
||||||
assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
|
||||||
officer = create(:poll_officer)
|
officer = create(:poll_officer)
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: assignment)
|
create(:poll_officer_assignment, officer: officer, poll: poll, booth: booth)
|
||||||
create(:poll_shift, booth: booth, officer: officer)
|
create(:poll_shift, booth: booth, officer: officer)
|
||||||
|
|
||||||
visit manage_admin_poll_booth_assignments_path(poll)
|
visit manage_admin_poll_booth_assignments_path(poll)
|
||||||
@@ -157,12 +156,10 @@ describe "Admin booths assignments" do
|
|||||||
scenario "Lists all assigned poll officers" do
|
scenario "Lists all assigned poll officers" do
|
||||||
poll = create(:poll)
|
poll = create(:poll)
|
||||||
booth = create(:poll_booth)
|
booth = create(:poll_booth)
|
||||||
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
officer_assignment = create(:poll_officer_assignment, poll: poll, booth: booth)
|
||||||
officer_assignment = create(:poll_officer_assignment, booth_assignment: booth_assignment)
|
|
||||||
officer = officer_assignment.officer
|
officer = officer_assignment.officer
|
||||||
|
|
||||||
booth_assignment_2 = create(:poll_booth_assignment, poll: poll)
|
officer_assignment_2 = create(:poll_officer_assignment, poll: poll)
|
||||||
officer_assignment_2 = create(:poll_officer_assignment, booth_assignment: booth_assignment_2)
|
|
||||||
officer_2 = officer_assignment_2.officer
|
officer_2 = officer_assignment_2.officer
|
||||||
|
|
||||||
visit admin_poll_path(poll)
|
visit admin_poll_path(poll)
|
||||||
|
|||||||
@@ -9,17 +9,13 @@ describe "Officer Assignments" do
|
|||||||
|
|
||||||
scenario "Index" do
|
scenario "Index" do
|
||||||
poll = create(:poll)
|
poll = create(:poll)
|
||||||
booth = create(:poll_booth)
|
|
||||||
|
|
||||||
officer1 = create(:poll_officer)
|
officer1 = create(:poll_officer)
|
||||||
officer2 = create(:poll_officer)
|
officer2 = create(:poll_officer)
|
||||||
officer3 = create(:poll_officer)
|
officer3 = create(:poll_officer)
|
||||||
|
|
||||||
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
officer_assignment = create(:poll_officer_assignment, poll: poll, officer: officer1)
|
||||||
officer_assignment = create(:poll_officer_assignment, booth_assignment: booth_assignment, officer: officer1)
|
officer_assignment_2 = create(:poll_officer_assignment, poll: poll, officer: officer2)
|
||||||
|
|
||||||
booth_assignment_2 = create(:poll_booth_assignment, poll: poll)
|
|
||||||
officer_assignment_2 = create(:poll_officer_assignment, booth_assignment: booth_assignment_2, officer: officer2)
|
|
||||||
|
|
||||||
visit admin_poll_path(poll)
|
visit admin_poll_path(poll)
|
||||||
|
|
||||||
@@ -34,7 +30,6 @@ describe "Officer Assignments" do
|
|||||||
|
|
||||||
scenario "Search", :js do
|
scenario "Search", :js do
|
||||||
poll = create(:poll)
|
poll = create(:poll)
|
||||||
booth = create(:poll_booth)
|
|
||||||
|
|
||||||
user1 = create(:user, username: "John Snow")
|
user1 = create(:user, username: "John Snow")
|
||||||
user2 = create(:user, username: "John Silver")
|
user2 = create(:user, username: "John Silver")
|
||||||
@@ -44,11 +39,8 @@ describe "Officer Assignments" do
|
|||||||
officer2 = create(:poll_officer, user: user2)
|
officer2 = create(:poll_officer, user: user2)
|
||||||
officer3 = create(:poll_officer, user: user3)
|
officer3 = create(:poll_officer, user: user3)
|
||||||
|
|
||||||
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
officer_assignment = create(:poll_officer_assignment, poll: poll, officer: officer1)
|
||||||
officer_assignment = create(:poll_officer_assignment, booth_assignment: booth_assignment, officer: officer1)
|
officer_assignment_2 = create(:poll_officer_assignment, poll: poll, officer: officer2)
|
||||||
|
|
||||||
booth_assignment_2 = create(:poll_booth_assignment, poll: poll)
|
|
||||||
officer_assignment_2 = create(:poll_officer_assignment, booth_assignment: booth_assignment_2, officer: officer2)
|
|
||||||
|
|
||||||
visit admin_poll_path(poll)
|
visit admin_poll_path(poll)
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ describe "BudgetPolls", :with_frozen_time do
|
|||||||
|
|
||||||
before do
|
before do
|
||||||
create(:poll_shift, officer: officer, booth: booth, date: Date.current, task: :vote_collection)
|
create(:poll_shift, officer: officer, booth: booth, date: Date.current, task: :vote_collection)
|
||||||
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
create(:poll_officer_assignment, officer: officer, poll: poll, booth: booth, date: Date.current)
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment, date: Date.current)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "Offline" do
|
context "Offline" do
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ describe "Booth", :with_frozen_time do
|
|||||||
|
|
||||||
booth = create(:poll_booth)
|
booth = create(:poll_booth)
|
||||||
|
|
||||||
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
create(:poll_officer_assignment, officer: officer, poll: poll, booth: booth, date: Date.current)
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment, date: Date.current)
|
|
||||||
|
|
||||||
login_through_form_as_officer(officer.user)
|
login_through_form_as_officer(officer.user)
|
||||||
|
|
||||||
@@ -42,11 +41,8 @@ describe "Booth", :with_frozen_time do
|
|||||||
booth1 = create(:poll_booth)
|
booth1 = create(:poll_booth)
|
||||||
booth2 = create(:poll_booth)
|
booth2 = create(:poll_booth)
|
||||||
|
|
||||||
ba1 = create(:poll_booth_assignment, poll: poll, booth: booth1)
|
create(:poll_officer_assignment, officer: officer, poll: poll, booth: booth1, date: Date.current)
|
||||||
ba2 = create(:poll_booth_assignment, poll: poll, booth: booth2)
|
create(:poll_officer_assignment, officer: officer, poll: poll, booth: booth2, date: Date.current)
|
||||||
|
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: ba1, date: Date.current)
|
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: ba2, date: Date.current)
|
|
||||||
|
|
||||||
login_through_form_as_officer(officer.user)
|
login_through_form_as_officer(officer.user)
|
||||||
|
|
||||||
@@ -69,13 +65,9 @@ describe "Booth", :with_frozen_time do
|
|||||||
poll1 = create(:poll)
|
poll1 = create(:poll)
|
||||||
poll2 = create(:poll)
|
poll2 = create(:poll)
|
||||||
|
|
||||||
ba1 = create(:poll_booth_assignment, poll: poll1, booth: booth1)
|
create(:poll_officer_assignment, officer: officer, poll: poll1, booth: booth1, date: Date.current)
|
||||||
ba2 = create(:poll_booth_assignment, poll: poll2, booth: booth2)
|
create(:poll_officer_assignment, officer: officer, poll: poll2, booth: booth2, date: Date.current)
|
||||||
ba3 = create(:poll_booth_assignment, poll: poll2, booth: booth2)
|
create(:poll_officer_assignment, officer: officer, poll: poll2, booth: booth2, date: Date.current)
|
||||||
|
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: ba1, date: Date.current)
|
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: ba2, date: Date.current)
|
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: ba3, date: Date.current)
|
|
||||||
|
|
||||||
login_through_form_as_officer(officer.user)
|
login_through_form_as_officer(officer.user)
|
||||||
|
|
||||||
|
|||||||
@@ -97,8 +97,7 @@ describe "Residence", :with_frozen_time do
|
|||||||
booth = create(:poll_booth)
|
booth = create(:poll_booth)
|
||||||
poll = create(:poll)
|
poll = create(:poll)
|
||||||
|
|
||||||
ba = create(:poll_booth_assignment, poll: poll, booth: booth)
|
create(:poll_officer_assignment, officer: officer, poll: poll, booth: booth)
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: ba)
|
|
||||||
create(:poll_shift, officer: officer, booth: booth, date: Date.current)
|
create(:poll_shift, officer: officer, booth: booth, date: Date.current)
|
||||||
|
|
||||||
login_as(officer.user)
|
login_as(officer.user)
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ describe "Voters" do
|
|||||||
login_as(officer.user)
|
login_as(officer.user)
|
||||||
create(:geozone, :in_census)
|
create(:geozone, :in_census)
|
||||||
create(:poll_shift, officer: officer, booth: booth, date: Date.current, task: :vote_collection)
|
create(:poll_shift, officer: officer, booth: booth, date: Date.current, task: :vote_collection)
|
||||||
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
create(:poll_officer_assignment, officer: officer, poll: poll, booth: booth)
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment)
|
|
||||||
set_officing_booth(booth)
|
set_officing_booth(booth)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -38,8 +37,7 @@ describe "Voters" do
|
|||||||
|
|
||||||
scenario "Cannot vote" do
|
scenario "Cannot vote" do
|
||||||
unvotable_poll = create(:poll, :current, geozone_restricted: true, geozones: [create(:geozone, census_code: "02")])
|
unvotable_poll = create(:poll, :current, geozone_restricted: true, geozones: [create(:geozone, census_code: "02")])
|
||||||
booth_assignment = create(:poll_booth_assignment, poll: unvotable_poll, booth: booth)
|
officer_assignment = create(:poll_officer_assignment, officer: officer, poll: unvotable_poll, booth: booth)
|
||||||
officer_assignment = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment)
|
|
||||||
|
|
||||||
set_officing_booth(booth)
|
set_officing_booth(booth)
|
||||||
visit new_officing_residence_path
|
visit new_officing_residence_path
|
||||||
@@ -53,8 +51,7 @@ describe "Voters" do
|
|||||||
|
|
||||||
scenario "Already voted" do
|
scenario "Already voted" do
|
||||||
poll2 = create(:poll, :current)
|
poll2 = create(:poll, :current)
|
||||||
booth_assignment = create(:poll_booth_assignment, poll: poll2, booth: booth)
|
create(:poll_officer_assignment, officer: officer, poll: poll2, booth: booth)
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment)
|
|
||||||
|
|
||||||
user = create(:user, :level_two)
|
user = create(:user, :level_two)
|
||||||
voter = create(:poll_voter, poll: poll, user: user)
|
voter = create(:poll_voter, poll: poll, user: user)
|
||||||
@@ -90,8 +87,7 @@ describe "Voters" do
|
|||||||
|
|
||||||
scenario "Display current polls assigned to a booth" do
|
scenario "Display current polls assigned to a booth" do
|
||||||
poll = create(:poll, :current)
|
poll = create(:poll, :current)
|
||||||
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
officer_assignment = create(:poll_officer_assignment, officer: officer, poll: poll, booth: booth)
|
||||||
officer_assignment = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment)
|
|
||||||
|
|
||||||
set_officing_booth(booth)
|
set_officing_booth(booth)
|
||||||
visit new_officing_residence_path
|
visit new_officing_residence_path
|
||||||
@@ -103,8 +99,7 @@ describe "Voters" do
|
|||||||
|
|
||||||
scenario "Display polls that the user can vote" do
|
scenario "Display polls that the user can vote" do
|
||||||
votable_poll = create(:poll, :current, geozone_restricted: true, geozones: [Geozone.first])
|
votable_poll = create(:poll, :current, geozone_restricted: true, geozones: [Geozone.first])
|
||||||
booth_assignment = create(:poll_booth_assignment, poll: votable_poll, booth: booth)
|
officer_assignment = create(:poll_officer_assignment, officer: officer, poll: votable_poll, booth: booth)
|
||||||
officer_assignment = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment)
|
|
||||||
|
|
||||||
set_officing_booth(booth)
|
set_officing_booth(booth)
|
||||||
visit new_officing_residence_path
|
visit new_officing_residence_path
|
||||||
@@ -116,8 +111,7 @@ describe "Voters" do
|
|||||||
|
|
||||||
scenario "Display polls that the user cannot vote" do
|
scenario "Display polls that the user cannot vote" do
|
||||||
unvotable_poll = create(:poll, :current, geozone_restricted: true, geozones: [create(:geozone, census_code: "02")])
|
unvotable_poll = create(:poll, :current, geozone_restricted: true, geozones: [create(:geozone, census_code: "02")])
|
||||||
booth_assignment = create(:poll_booth_assignment, poll: unvotable_poll, booth: booth)
|
officer_assignment = create(:poll_officer_assignment, officer: officer, poll: unvotable_poll, booth: booth)
|
||||||
officer_assignment = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment)
|
|
||||||
|
|
||||||
set_officing_booth(booth)
|
set_officing_booth(booth)
|
||||||
visit new_officing_residence_path
|
visit new_officing_residence_path
|
||||||
@@ -129,8 +123,7 @@ describe "Voters" do
|
|||||||
|
|
||||||
scenario "Do not display expired polls" do
|
scenario "Do not display expired polls" do
|
||||||
expired_poll = create(:poll, :expired)
|
expired_poll = create(:poll, :expired)
|
||||||
booth_assignment = create(:poll_booth_assignment, poll: expired_poll, booth: booth)
|
officer_assignment = create(:poll_officer_assignment, officer: officer, poll: expired_poll, booth: booth)
|
||||||
officer_assignment = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment)
|
|
||||||
|
|
||||||
set_officing_booth(booth)
|
set_officing_booth(booth)
|
||||||
visit new_officing_residence_path
|
visit new_officing_residence_path
|
||||||
@@ -147,11 +140,8 @@ describe "Voters" do
|
|||||||
booth1 = create(:poll_booth)
|
booth1 = create(:poll_booth)
|
||||||
booth2 = create(:poll_booth)
|
booth2 = create(:poll_booth)
|
||||||
|
|
||||||
booth_assignment1 = create(:poll_booth_assignment, poll: poll1, booth: booth1)
|
officer_assignment1 = create(:poll_officer_assignment, officer: officer, poll: poll1, booth: booth1)
|
||||||
booth_assignment2 = create(:poll_booth_assignment, poll: poll2, booth: booth2)
|
officer_assignment2 = create(:poll_officer_assignment, officer: officer, poll: poll2, booth: booth2)
|
||||||
|
|
||||||
officer_assignment1 = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment1)
|
|
||||||
officer_assignment2 = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment2)
|
|
||||||
|
|
||||||
set_officing_booth(booth1)
|
set_officing_booth(booth1)
|
||||||
visit new_officing_residence_path
|
visit new_officing_residence_path
|
||||||
|
|||||||
@@ -375,10 +375,8 @@ describe "Polls" do
|
|||||||
let(:officer) { create(:poll_officer) }
|
let(:officer) { create(:poll_officer) }
|
||||||
|
|
||||||
scenario "Already voted on booth cannot vote on website", :js do
|
scenario "Already voted on booth cannot vote on website", :js do
|
||||||
|
|
||||||
create(:poll_shift, officer: officer, booth: booth, date: Date.current, task: :vote_collection)
|
create(:poll_shift, officer: officer, booth: booth, date: Date.current, task: :vote_collection)
|
||||||
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
create(:poll_officer_assignment, officer: officer, poll: poll, booth: booth, date: Date.current)
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment, date: Date.current)
|
|
||||||
question = create(:poll_question, :yes_no, poll: poll)
|
question = create(:poll_question, :yes_no, poll: poll)
|
||||||
user = create(:user, :level_two, :in_census)
|
user = create(:user, :level_two, :in_census)
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ describe "Voter" do
|
|||||||
before do
|
before do
|
||||||
create(:geozone, :in_census)
|
create(:geozone, :in_census)
|
||||||
create(:poll_shift, officer: officer, booth: booth, date: Date.current, task: :vote_collection)
|
create(:poll_shift, officer: officer, booth: booth, date: Date.current, task: :vote_collection)
|
||||||
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
create(:poll_officer_assignment, officer: officer, poll: poll, booth: booth)
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Voting via web - Standard", :js do
|
scenario "Voting via web - Standard", :js do
|
||||||
|
|||||||
@@ -38,13 +38,9 @@ describe Poll::Officer do
|
|||||||
poll_2 = create(:poll)
|
poll_2 = create(:poll)
|
||||||
poll_3 = create(:poll)
|
poll_3 = create(:poll)
|
||||||
|
|
||||||
booth_assignment_1a = create(:poll_booth_assignment, poll: poll_1)
|
create(:poll_officer_assignment, poll: poll_1, officer: officer, date: poll_1.starts_at)
|
||||||
booth_assignment_1b = create(:poll_booth_assignment, poll: poll_1)
|
create(:poll_officer_assignment, poll: poll_1, officer: officer, date: poll_1.ends_at)
|
||||||
booth_assignment_2 = create(:poll_booth_assignment, poll: poll_2)
|
create(:poll_officer_assignment, poll: poll_2, officer: officer)
|
||||||
|
|
||||||
create(:poll_officer_assignment, booth_assignment: booth_assignment_1a, officer: officer, date: poll_1.starts_at)
|
|
||||||
create(:poll_officer_assignment, booth_assignment: booth_assignment_1b, officer: officer, date: poll_1.ends_at)
|
|
||||||
create(:poll_officer_assignment, booth_assignment: booth_assignment_2, officer: officer)
|
|
||||||
|
|
||||||
assigned_polls = officer.voting_days_assigned_polls
|
assigned_polls = officer.voting_days_assigned_polls
|
||||||
|
|
||||||
@@ -57,11 +53,8 @@ describe Poll::Officer do
|
|||||||
poll_1 = create(:poll)
|
poll_1 = create(:poll)
|
||||||
poll_2 = create(:poll)
|
poll_2 = create(:poll)
|
||||||
|
|
||||||
booth_assignment_1 = create(:poll_booth_assignment, poll: poll_1)
|
create(:poll_officer_assignment, poll: poll_1, officer: officer, date: poll_1.starts_at)
|
||||||
booth_assignment_2 = create(:poll_booth_assignment, poll: poll_2)
|
create(:poll_officer_assignment, poll: poll_2, officer: officer, final: true)
|
||||||
|
|
||||||
create(:poll_officer_assignment, booth_assignment: booth_assignment_1, officer: officer, date: poll_1.starts_at)
|
|
||||||
create(:poll_officer_assignment, booth_assignment: booth_assignment_2, officer: officer, final: true)
|
|
||||||
|
|
||||||
assigned_polls = officer.voting_days_assigned_polls
|
assigned_polls = officer.voting_days_assigned_polls
|
||||||
|
|
||||||
@@ -75,8 +68,8 @@ describe Poll::Officer do
|
|||||||
poll_2 = create(:poll, ends_at: 10.days.from_now)
|
poll_2 = create(:poll, ends_at: 10.days.from_now)
|
||||||
poll_3 = create(:poll, ends_at: 10.days.ago)
|
poll_3 = create(:poll, ends_at: 10.days.ago)
|
||||||
|
|
||||||
[poll_1, poll_2, poll_3].each do |p|
|
[poll_1, poll_2, poll_3].each do |poll|
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: create(:poll_booth_assignment, poll: p))
|
create(:poll_officer_assignment, officer: officer, poll: poll)
|
||||||
end
|
end
|
||||||
|
|
||||||
assigned_polls = officer.voting_days_assigned_polls
|
assigned_polls = officer.voting_days_assigned_polls
|
||||||
@@ -95,13 +88,9 @@ describe Poll::Officer do
|
|||||||
poll_2 = create(:poll)
|
poll_2 = create(:poll)
|
||||||
poll_3 = create(:poll)
|
poll_3 = create(:poll)
|
||||||
|
|
||||||
booth_assignment_1a = create(:poll_booth_assignment, poll: poll_1)
|
create(:poll_officer_assignment, poll: poll_1, officer: officer, date: poll_1.starts_at, final: true)
|
||||||
booth_assignment_1b = create(:poll_booth_assignment, poll: poll_1)
|
create(:poll_officer_assignment, poll: poll_1, officer: officer, date: poll_1.ends_at, final: true)
|
||||||
booth_assignment_2 = create(:poll_booth_assignment, poll: poll_2)
|
create(:poll_officer_assignment, poll: poll_2, officer: officer, final: true)
|
||||||
|
|
||||||
create(:poll_officer_assignment, booth_assignment: booth_assignment_1a, officer: officer, date: poll_1.starts_at, final: true)
|
|
||||||
create(:poll_officer_assignment, booth_assignment: booth_assignment_1b, officer: officer, date: poll_1.ends_at, final: true)
|
|
||||||
create(:poll_officer_assignment, booth_assignment: booth_assignment_2, officer: officer, final: true)
|
|
||||||
|
|
||||||
assigned_polls = officer.final_days_assigned_polls
|
assigned_polls = officer.final_days_assigned_polls
|
||||||
|
|
||||||
@@ -114,11 +103,8 @@ describe Poll::Officer do
|
|||||||
poll_1 = create(:poll)
|
poll_1 = create(:poll)
|
||||||
poll_2 = create(:poll)
|
poll_2 = create(:poll)
|
||||||
|
|
||||||
booth_assignment_1 = create(:poll_booth_assignment, poll: poll_1)
|
create(:poll_officer_assignment, poll: poll_1, officer: officer, date: poll_1.starts_at)
|
||||||
booth_assignment_2 = create(:poll_booth_assignment, poll: poll_2)
|
create(:poll_officer_assignment, poll: poll_2, officer: officer, final: true)
|
||||||
|
|
||||||
create(:poll_officer_assignment, booth_assignment: booth_assignment_1, officer: officer, date: poll_1.starts_at)
|
|
||||||
create(:poll_officer_assignment, booth_assignment: booth_assignment_2, officer: officer, final: true)
|
|
||||||
|
|
||||||
assigned_polls = officer.final_days_assigned_polls
|
assigned_polls = officer.final_days_assigned_polls
|
||||||
|
|
||||||
@@ -132,8 +118,8 @@ describe Poll::Officer do
|
|||||||
poll_2 = create(:poll, ends_at: 10.days.from_now)
|
poll_2 = create(:poll, ends_at: 10.days.from_now)
|
||||||
poll_3 = create(:poll, ends_at: 10.days.ago)
|
poll_3 = create(:poll, ends_at: 10.days.ago)
|
||||||
|
|
||||||
[poll_1, poll_2, poll_3].each do |p|
|
[poll_1, poll_2, poll_3].each do |poll|
|
||||||
create(:poll_officer_assignment, officer: officer, booth_assignment: create(:poll_booth_assignment, poll: p), final: true)
|
create(:poll_officer_assignment, officer: officer, poll: poll, final: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
assigned_polls = officer.final_days_assigned_polls
|
assigned_polls = officer.final_days_assigned_polls
|
||||||
|
|||||||
Reference in New Issue
Block a user