Remove Poll Recount model and all usages
This commit is contained in:
@@ -478,13 +478,6 @@ FactoryGirl.define do
|
||||
end
|
||||
end
|
||||
|
||||
factory :poll_recount, class: 'Poll::Recount' do
|
||||
association :officer_assignment, factory: :poll_officer_assignment
|
||||
association :booth_assignment, factory: :poll_booth_assignment
|
||||
count (1..100).to_a.sample
|
||||
date (1.month.ago.to_datetime..1.month.from_now.to_datetime).to_a.sample
|
||||
end
|
||||
|
||||
factory :poll_final_recount, class: 'Poll::FinalRecount' do
|
||||
association :officer_assignment, factory: [:poll_officer_assignment, :final]
|
||||
association :booth_assignment, factory: :poll_booth_assignment
|
||||
|
||||
@@ -97,16 +97,6 @@ feature 'Admin booths assignments' do
|
||||
officer_assignment_2 = create(:poll_officer_assignment, booth_assignment: booth_assignment, date: poll.ends_at)
|
||||
final_officer_assignment = create(:poll_officer_assignment, :final, booth_assignment: booth_assignment, date: poll.ends_at)
|
||||
|
||||
recount_1 = create(:poll_recount,
|
||||
booth_assignment: booth_assignment,
|
||||
officer_assignment: officer_assignment_1,
|
||||
date: officer_assignment_1.date,
|
||||
count: 33)
|
||||
recount_2 = create(:poll_recount,
|
||||
booth_assignment: booth_assignment,
|
||||
officer_assignment: officer_assignment_2,
|
||||
date: officer_assignment_2.date,
|
||||
count: 78)
|
||||
final_recount = create(:poll_final_recount,
|
||||
booth_assignment: booth_assignment,
|
||||
officer_assignment: final_officer_assignment,
|
||||
@@ -114,7 +104,6 @@ feature 'Admin booths assignments' do
|
||||
count: 5678)
|
||||
|
||||
booth_assignment_2 = create(:poll_booth_assignment, poll: poll)
|
||||
other_recount = create(:poll_recount, booth_assignment: booth_assignment_2, count: 100)
|
||||
|
||||
visit admin_poll_path(poll)
|
||||
click_link 'Booths (2)'
|
||||
@@ -123,57 +112,9 @@ feature 'Admin booths assignments' do
|
||||
|
||||
click_link 'Recounts'
|
||||
within('#recounts_list') do
|
||||
expect(page).to_not have_content other_recount.count
|
||||
|
||||
within("#recounting_#{recount_1.date.strftime('%Y%m%d')}") do
|
||||
expect(page).to have_content recount_1.count
|
||||
end
|
||||
|
||||
within("#recounting_#{recount_2.date.strftime('%Y%m%d')}") do
|
||||
expect(page).to have_content recount_2.count
|
||||
end
|
||||
|
||||
within("#recounting_#{final_recount.date.strftime('%Y%m%d')}") do
|
||||
expect(page).to have_content final_recount.count
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Marks recount values with count-errors' do
|
||||
poll = create(:poll)
|
||||
booth = create(:poll_booth)
|
||||
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
||||
today = Date.current
|
||||
officer_assignment = create(:poll_officer_assignment, booth_assignment: booth_assignment, date: today)
|
||||
|
||||
recount = create(:poll_recount,
|
||||
booth_assignment: booth_assignment,
|
||||
officer_assignment: officer_assignment,
|
||||
date: officer_assignment.date,
|
||||
count: 1)
|
||||
|
||||
visit admin_poll_booth_assignment_path(poll, booth_assignment)
|
||||
click_link 'Recounts'
|
||||
|
||||
within('#recounts_list') do
|
||||
expect(page).to have_css("#recounting_#{recount.date.strftime('%Y%m%d')} td.count-error")
|
||||
within("#recounting_#{recount.date.strftime('%Y%m%d')}") do
|
||||
expect(page).to have_content recount.count
|
||||
expect(page).to have_content 0
|
||||
end
|
||||
end
|
||||
|
||||
create(:poll_voter, :valid_document, poll: poll, booth_assignment: booth_assignment)
|
||||
|
||||
visit admin_poll_booth_assignment_path(poll, booth_assignment)
|
||||
click_link 'Recounts'
|
||||
|
||||
within('#recounts_list') do
|
||||
expect(page).to_not have_css('.count-error')
|
||||
within("#recounting_#{recount.date.strftime('%Y%m%d')}") do
|
||||
expect(page).to have_content(recount.count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -70,28 +70,22 @@ feature 'Admin officer assignments in poll' do
|
||||
booth_assignment = create(:poll_booth_assignment)
|
||||
poll = booth_assignment.poll
|
||||
officer = create(:poll_officer)
|
||||
officer_assignment = create(:poll_officer_assignment,
|
||||
booth_assignment: booth_assignment,
|
||||
officer: officer,
|
||||
date: poll.starts_at)
|
||||
create(:poll_officer_assignment,
|
||||
booth_assignment: booth_assignment,
|
||||
officer: officer,
|
||||
date: poll.starts_at)
|
||||
final_officer_assignment = create(:poll_officer_assignment, :final,
|
||||
booth_assignment: booth_assignment,
|
||||
officer: officer,
|
||||
date: poll.ends_at + 1.day)
|
||||
recount = create(:poll_recount,
|
||||
booth_assignment: booth_assignment,
|
||||
officer_assignment: officer_assignment,
|
||||
date: officer_assignment.date,
|
||||
count: 77)
|
||||
final_recount = create(:poll_final_recount,
|
||||
booth_assignment: booth_assignment,
|
||||
officer_assignment: final_officer_assignment,
|
||||
date: poll.ends_at,
|
||||
count: 9876)
|
||||
create(:poll_final_recount,
|
||||
booth_assignment: booth_assignment,
|
||||
officer_assignment: final_officer_assignment,
|
||||
date: poll.ends_at,
|
||||
count: 9876)
|
||||
|
||||
visit by_officer_admin_poll_officer_assignments_path(poll, officer_id: officer.id)
|
||||
|
||||
within('#recount_list') { expect(page).to have_content('77') }
|
||||
within('#final_recount_list') { expect(page).to have_content('9876') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe :recount do
|
||||
|
||||
it "should update count_log if count changes" do
|
||||
recount = create(:poll_recount, count: 33)
|
||||
|
||||
expect(recount.count_log).to eq("")
|
||||
|
||||
recount.count = 33
|
||||
recount.save
|
||||
recount.count = 32
|
||||
recount.save
|
||||
recount.count = 34
|
||||
recount.save
|
||||
|
||||
expect(recount.count_log).to eq(":33:32")
|
||||
end
|
||||
|
||||
it "should update officer_assignment_id_log if count changes" do
|
||||
recount = create(:poll_recount, count: 33)
|
||||
|
||||
expect(recount.count_log).to eq("")
|
||||
|
||||
recount.count = 33
|
||||
poll_officer_assignment_1 = create(:poll_officer_assignment)
|
||||
recount.officer_assignment = poll_officer_assignment_1
|
||||
recount.save
|
||||
|
||||
recount.count = 32
|
||||
poll_officer_assignment_2 = create(:poll_officer_assignment)
|
||||
recount.officer_assignment = poll_officer_assignment_2
|
||||
recount.save
|
||||
|
||||
recount.count = 34
|
||||
poll_officer_assignment_3 = create(:poll_officer_assignment)
|
||||
recount.officer_assignment = poll_officer_assignment_3
|
||||
recount.save
|
||||
|
||||
expect(recount.officer_assignment_id_log).to eq(":#{poll_officer_assignment_1.id}:#{poll_officer_assignment_2.id}")
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user