Prevent balloting online after casting a ballot offline
This commit is contained in:
@@ -2,7 +2,10 @@ require "rails_helper"
|
||||
|
||||
feature "BudgetPolls", :with_frozen_time do
|
||||
let(:budget) { create(:budget, :balloting) }
|
||||
let(:poll) { create(:poll, :current) }
|
||||
let(:group) { create(:budget_group, budget: budget) }
|
||||
let(:heading) { create(:budget_heading, group: group) }
|
||||
let(:investment) { create(:budget_investment, :selected, heading: heading) }
|
||||
let(:poll) { create(:poll, :current, budget: budget) }
|
||||
let(:booth) { create(:poll_booth) }
|
||||
let(:officer) { create(:poll_officer) }
|
||||
let(:admin) { create(:administrator) }
|
||||
@@ -67,10 +70,29 @@ feature "BudgetPolls", :with_frozen_time do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "A citizen cannot vote online after voting offline" do
|
||||
# create scenario for an user that voted offline
|
||||
scenario "A citizen cannot vote online after voting offline", :js do
|
||||
user = create(:user, :in_census)
|
||||
|
||||
# Check the citizen cannot vote online
|
||||
login_through_form_as_officer(officer.user)
|
||||
|
||||
visit new_officing_residence_path
|
||||
officing_verify_residence
|
||||
|
||||
within("#poll_#{poll.id}") do
|
||||
click_button("Confirm vote")
|
||||
end
|
||||
|
||||
expect(page).to have_content "Vote introduced!"
|
||||
|
||||
login_as(user)
|
||||
|
||||
visit budget_investment_path(budget, investment)
|
||||
find("div.ballot").hover
|
||||
|
||||
within("#budget_investment_#{investment.id}") do
|
||||
expect(page).to have_content "You have already participated offline"
|
||||
expect(page).to have_css(".add a", visible: false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user