Remove token column from poll_voters table

As it is no longer used as originally pretended [1][2].

[1] Check consul/consul pull request 1994
[2] Check consul/consul pull request 3539
This commit is contained in:
Senén Rodero Rodríguez
2022-09-15 18:45:28 +02:00
committed by taitus
parent dd04765af3
commit 64676be246
16 changed files with 24 additions and 53 deletions

View File

@@ -144,7 +144,6 @@ FactoryBot.define do
poll { budget&.poll || association(:poll, budget: budget) }
trait :from_web do
origin { "web" }
token { SecureRandom.hex(32) }
end
trait :from_booth do

View File

@@ -46,7 +46,7 @@ describe Poll::Answer do
answer = create(:poll_answer, question: question, author: author, answer: "Yes")
expect(answer.poll.voters).to be_blank
answer.save_and_record_voter_participation("token")
answer.save_and_record_voter_participation
expect(poll.reload.voters.size).to eq(1)
voter = poll.voters.first
@@ -57,12 +57,12 @@ describe Poll::Answer do
it "updates a poll_voter with user and poll data" do
answer = create(:poll_answer, question: question, author: author, answer: "Yes")
answer.save_and_record_voter_participation("token")
answer.save_and_record_voter_participation
expect(poll.reload.voters.size).to eq(1)
answer = create(:poll_answer, question: question, author: author, answer: "No")
answer.save_and_record_voter_participation("token")
answer.save_and_record_voter_participation
expect(poll.reload.voters.size).to eq(1)
@@ -76,7 +76,7 @@ describe Poll::Answer do
answer = build(:poll_answer)
expect do
answer.save_and_record_voter_participation("token")
answer.save_and_record_voter_participation
end.to raise_error(ActiveRecord::RecordInvalid)
expect(answer).not_to be_persisted

View File

@@ -196,21 +196,19 @@ describe Poll::Voter do
it "sets user info" do
user = create(:user, document_number: "1234A", document_type: "1")
voter = build(:poll_voter, user: user, token: "1234abcd")
voter = build(:poll_voter, user: user)
voter.save!
expect(voter.document_number).to eq("1234A")
expect(voter.document_type).to eq("1")
expect(voter.token).to eq("1234abcd")
end
it "sets user info with skip verification enabled" do
Setting["feature.user.skip_verification"] = true
user = create(:user)
voter = build(:poll_voter, user: user, token: "1234abcd")
voter.save!
voter = build(:poll_voter, user: user)
expect(voter.token).to eq("1234abcd")
expect { voter.save! }.not_to raise_exception
end
end
end

View File

@@ -38,8 +38,8 @@ describe "Voter" do
visit poll_path(poll)
within("#poll_question_#{question.id}_answers") do
expect(page).not_to have_link(answer_yes.title, href: "/questions/#{question.id}/answer?answer=#{answer_yes.title}&token=")
expect(page).not_to have_link(answer_no.title, href: "/questions/#{question.id}/answer?answer=#{answer_no.title}&token=")
expect(page).not_to have_link(answer_yes.title, href: "/questions/#{question.id}/answer?answer=#{answer_yes.title}")
expect(page).not_to have_link(answer_no.title, href: "/questions/#{question.id}/answer?answer=#{answer_no.title}")
end
expect(page).to have_content("You must verify your account in order to answer")