fixes specs
This commit is contained in:
@@ -35,21 +35,14 @@ en:
|
||||
new:
|
||||
title: Validate document
|
||||
document_number: Document number
|
||||
document_type:
|
||||
passport: Passport
|
||||
residence_card: Residence card
|
||||
spanish_id: DNI
|
||||
document_type_label: Document type
|
||||
submit: Validate document
|
||||
error_verifying_census: "The Census was unable to verify this document."
|
||||
error_not_allowed_age: You don't have the required age to participate
|
||||
error_verifying_census_offices: Citizen Support Office
|
||||
form_errors: prevented the verification of this document
|
||||
voters:
|
||||
new:
|
||||
title: Polls
|
||||
show:
|
||||
title: Validate document
|
||||
error_already_voted: Has already participated in this poll
|
||||
submit: Validate vote
|
||||
success: Vote validated successfully.
|
||||
|
||||
@@ -35,21 +35,14 @@ es:
|
||||
new:
|
||||
title: Validar documento
|
||||
document_number: Número de documento
|
||||
document_type:
|
||||
passport: Pasaporte
|
||||
residence_card: Tarjeta de residencia
|
||||
spanish_id: DNI
|
||||
document_type_label: Tipo de documento
|
||||
submit: Validar documento
|
||||
error_not_allowed_age: No tienes la edad mínima para participar
|
||||
error_verifying_census: El Padrón no pudo verificar este documento.
|
||||
form_errors: evitaron verificar este documento
|
||||
voters:
|
||||
new:
|
||||
title: Votaciones
|
||||
show:
|
||||
title: Validar documento
|
||||
error_already_voted: "Ya ha participado en la votación."
|
||||
can_participate: "La persona asociada al documento puede participar en la votación."
|
||||
submit: Validar voto
|
||||
success: Voto validado correctamente.
|
||||
|
||||
@@ -445,7 +445,7 @@ FactoryGirl.define do
|
||||
|
||||
factory :poll_answer, class: 'Poll::Answer' do
|
||||
association :question, factory: :poll_question
|
||||
association :author, factory: [:user, :level_three]
|
||||
association :author, factory: [:user, :level_two]
|
||||
answer { question.valid_answers.sample }
|
||||
end
|
||||
|
||||
|
||||
@@ -84,6 +84,8 @@ feature 'Moderate comments' do
|
||||
end
|
||||
|
||||
scenario "select all/none", :js do
|
||||
Capybara.current_driver = :poltergeist_no_js_errors
|
||||
|
||||
create_list(:comment, 2)
|
||||
|
||||
visit moderation_comments_path
|
||||
|
||||
@@ -91,6 +91,8 @@ feature 'Moderate debates' do
|
||||
end
|
||||
|
||||
scenario "select all/none", :js do
|
||||
Capybara.current_driver = :poltergeist_no_js_errors
|
||||
|
||||
create_list(:debate, 2)
|
||||
|
||||
visit moderation_debates_path
|
||||
|
||||
@@ -83,6 +83,8 @@ feature 'Moderate proposals' do
|
||||
end
|
||||
|
||||
scenario "select all/none", :js do
|
||||
Capybara.current_driver = :poltergeist_no_js_errors
|
||||
|
||||
create_list(:proposal, 2)
|
||||
|
||||
visit moderation_proposals_path
|
||||
|
||||
@@ -55,6 +55,8 @@ feature 'Valuation budget investments' do
|
||||
end
|
||||
|
||||
scenario "Index filtering by heading", :js do
|
||||
Capybara.current_driver = :poltergeist_no_js_errors
|
||||
|
||||
group = create(:budget_group, budget: @budget)
|
||||
heading1 = create(:budget_heading, name: "District 9", group: group)
|
||||
heading2 = create(:budget_heading, name: "Down to the river", group: group)
|
||||
|
||||
@@ -83,6 +83,8 @@ feature 'Valuation spending proposals' do
|
||||
end
|
||||
|
||||
scenario "Index filtering by geozone", :js do
|
||||
Capybara.current_driver = :poltergeist_no_js_errors
|
||||
|
||||
geozone = create(:geozone, name: "District 9")
|
||||
spending_proposal1 = create(:spending_proposal, title: "Realocate visitors", geozone: geozone)
|
||||
spending_proposal2 = create(:spending_proposal, title: "Destroy the city")
|
||||
|
||||
@@ -64,6 +64,7 @@ describe :poll do
|
||||
|
||||
describe "#document_has_voted?" do
|
||||
it "returns true if Poll::Voter with document exists" do
|
||||
poll = create(:poll)
|
||||
voter = create(:poll_voter, :valid_document, poll: poll)
|
||||
|
||||
expect(poll.document_has_voted?(voter.document_number, voter.document_type)).to eq(true)
|
||||
|
||||
@@ -35,16 +35,20 @@ describe :voter do
|
||||
end
|
||||
|
||||
it "should not be valid if the user has already voted in the same poll or booth_assignment" do
|
||||
voter1 = create(:poll_voter, :valid_document, poll: poll)
|
||||
voter2 = build(:poll_voter, :valid_document, poll: poll)
|
||||
user = create(:user, :level_two)
|
||||
|
||||
voter1 = create(:poll_voter, user: user, poll: poll)
|
||||
voter2 = build(:poll_voter, user: user, poll: poll)
|
||||
|
||||
expect(voter2).to_not be_valid
|
||||
expect(voter2.errors.messages[:document_number]).to eq(["User has already voted"])
|
||||
end
|
||||
|
||||
it "should not be valid if the user has already voted in the same poll/booth" do
|
||||
voter1 = create(:poll_voter, :valid_document, poll: poll, booth_assignment: booth_assignment)
|
||||
voter2 = build(:poll_voter, :valid_document, poll: poll, booth_assignment: booth_assignment)
|
||||
user = create(:user, :level_two)
|
||||
|
||||
voter1 = create(:poll_voter, user: user, poll: poll, booth_assignment: booth_assignment)
|
||||
voter2 = build(:poll_voter, user: user, poll: poll, booth_assignment: booth_assignment)
|
||||
|
||||
expect(voter2).to_not be_valid
|
||||
expect(voter2.errors.messages[:document_number]).to eq(["User has already voted"])
|
||||
@@ -54,8 +58,10 @@ describe :voter do
|
||||
booth_assignment1 = create(:poll_booth_assignment, poll: poll)
|
||||
booth_assignment2 = create(:poll_booth_assignment, poll: poll)
|
||||
|
||||
voter1 = create(:poll_voter, :valid_document, poll: poll, booth_assignment: booth_assignment1)
|
||||
voter2 = build(:poll_voter, :valid_document, poll: poll, booth_assignment: booth_assignment2)
|
||||
user = create(:user, :level_two)
|
||||
|
||||
voter1 = create(:poll_voter, user: user, poll: poll, booth_assignment: booth_assignment1)
|
||||
voter2 = build(:poll_voter, user: user, poll: poll, booth_assignment: booth_assignment2)
|
||||
|
||||
expect(voter2).to_not be_valid
|
||||
expect(voter2.errors.messages[:document_number]).to eq(["User has already voted"])
|
||||
@@ -65,8 +71,10 @@ describe :voter do
|
||||
booth_assignment1 = create(:poll_booth_assignment, booth: booth)
|
||||
booth_assignment2 = create(:poll_booth_assignment, booth: booth, poll: poll)
|
||||
|
||||
voter1 = create(:poll_voter, :valid_document, booth_assignment: booth_assignment1)
|
||||
voter2 = build(:poll_voter, :valid_document, booth_assignment: booth_assignment2)
|
||||
user = create(:user, :level_two)
|
||||
|
||||
voter1 = create(:poll_voter, user: user, booth_assignment: booth_assignment1)
|
||||
voter2 = build(:poll_voter, user: user, booth_assignment: booth_assignment2)
|
||||
|
||||
expect(voter2).to be_valid
|
||||
end
|
||||
@@ -75,7 +83,7 @@ describe :voter do
|
||||
answer = create(:poll_answer)
|
||||
answer.record_voter_participation
|
||||
|
||||
voter = build(:poll_voter, poll: answer.question.poll, document_number: answer.author.document_number, document_type: "1")
|
||||
voter = build(:poll_voter, poll: answer.question.poll, user: answer.author)
|
||||
expect(voter).to_not be_valid
|
||||
expect(voter.errors.messages[:document_number]).to eq(["User has already voted"])
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user