records participation of user via web

answering a poll question creates a voter with the user data to record
participation in question’s poll
This commit is contained in:
Juanjo Bazán
2017-01-25 14:21:03 +01:00
parent 086f4a4170
commit b13a76963a
8 changed files with 73 additions and 25 deletions

View File

@@ -64,15 +64,14 @@ describe :poll do
describe "#document_has_voted?" do
it "returns true if Poll::Voter with document exists" do
booth_assignment = create(:poll_booth_assignment, poll: poll)
voter = create(:poll_voter, :valid_document, booth_assignment: booth_assignment)
voter = create(:poll_voter, :valid_document, poll: poll)
expect(poll.document_has_voted?(voter.document_number, voter.document_type)).to eq(true)
end
it "returns false if Poll::Voter with document does not exists" do
booth_assignment = create(:poll_booth_assignment)
voter = create(:poll_voter, :valid_document, booth_assignment: booth_assignment)
poll_2 = create(:poll)
voter = create(:poll_voter, :valid_document, poll: poll_2)
expect(poll.document_has_voted?(voter.document_number, voter.document_type)).to eq(false)
end