diff --git a/config/locales/officing.en.yml b/config/locales/officing.en.yml index 2d8d77e13..54ac52edf 100644 --- a/config/locales/officing.en.yml +++ b/config/locales/officing.en.yml @@ -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. diff --git a/config/locales/officing.es.yml b/config/locales/officing.es.yml index 827aea9d5..0aa1b419c 100644 --- a/config/locales/officing.es.yml +++ b/config/locales/officing.es.yml @@ -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. diff --git a/spec/factories.rb b/spec/factories.rb index c8e504b65..dc3b4ff58 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -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 diff --git a/spec/features/moderation/comments_spec.rb b/spec/features/moderation/comments_spec.rb index dc3604c3a..65d2481ba 100644 --- a/spec/features/moderation/comments_spec.rb +++ b/spec/features/moderation/comments_spec.rb @@ -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 diff --git a/spec/features/moderation/debates_spec.rb b/spec/features/moderation/debates_spec.rb index 78aca9b7e..8a729efe7 100644 --- a/spec/features/moderation/debates_spec.rb +++ b/spec/features/moderation/debates_spec.rb @@ -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 diff --git a/spec/features/moderation/proposals_spec.rb b/spec/features/moderation/proposals_spec.rb index ab8da4764..6acff7c71 100644 --- a/spec/features/moderation/proposals_spec.rb +++ b/spec/features/moderation/proposals_spec.rb @@ -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 diff --git a/spec/features/valuation/budget_investments_spec.rb b/spec/features/valuation/budget_investments_spec.rb index bac7d1fe2..a3f5a1705 100644 --- a/spec/features/valuation/budget_investments_spec.rb +++ b/spec/features/valuation/budget_investments_spec.rb @@ -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) diff --git a/spec/features/valuation/spending_proposals_spec.rb b/spec/features/valuation/spending_proposals_spec.rb index 25c5dfa61..035ed59fd 100644 --- a/spec/features/valuation/spending_proposals_spec.rb +++ b/spec/features/valuation/spending_proposals_spec.rb @@ -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") diff --git a/spec/models/poll/poll_spec.rb b/spec/models/poll/poll_spec.rb index b2ec29e5c..b0bf923c0 100644 --- a/spec/models/poll/poll_spec.rb +++ b/spec/models/poll/poll_spec.rb @@ -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) diff --git a/spec/models/poll/voter_spec.rb b/spec/models/poll/voter_spec.rb index ab66d3b76..0770c5654 100644 --- a/spec/models/poll/voter_spec.rb +++ b/spec/models/poll/voter_spec.rb @@ -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