mirror of
https://github.com/discourse/discourse.git
synced 2024-12-23 01:03:47 +08:00
bae492efee
using Instant Run-off Voting algorithm to Poll Plugin (Part 2 add Ranked Choice) --------- Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com> Co-authored-by: Jarek Radosz <jradosz@gmail.com>
25 lines
500 B
Ruby
25 lines
500 B
Ruby
# frozen_string_literal: true
|
|
|
|
Fabricator(:poll) do
|
|
post
|
|
name { sequence(:name) { |i| "Poll #{i}" } }
|
|
end
|
|
|
|
Fabricator(:poll_regular, from: :poll) { type "regular" }
|
|
|
|
Fabricator(:poll_multiple, from: :poll) { type "multiple" }
|
|
|
|
Fabricator(:poll_ranked_choice, from: :poll) { type "ranked_choice" }
|
|
|
|
Fabricator(:poll_option) do
|
|
poll
|
|
html { sequence(:html) { |i| "Poll Option #{i}" } }
|
|
digest { sequence(:digest) { |i| "#{i}" } }
|
|
end
|
|
|
|
Fabricator(:poll_vote) do
|
|
poll
|
|
poll_option
|
|
user
|
|
end
|