Update poll factories

This commit is contained in:
decabeza
2022-09-01 18:20:26 +02:00
committed by Senén Rodero Rodríguez
parent 4eb4851aba
commit a25629951c

View File

@@ -58,6 +58,28 @@ FactoryBot.define do
create(:poll_question_answer, question: question, title: "No") create(:poll_question_answer, question: question, title: "No")
end end
end end
trait :abc do
after(:create) do |question, evaluator|
%w[A B C].each do |letter|
create(:poll_question_answer, question: question, title: "Answer #{letter}")
end
end
end
factory :poll_question_unique do
after(:create) do |question|
create(:votation_type_unique, questionable: question)
end
end
factory :poll_question_multiple do
transient { max_votes { 3 } }
after(:create) do |question, evaluator|
create(:votation_type_multiple, questionable: question, max_votes: evaluator.max_votes)
end
end
end end
factory :poll_question_answer, class: "Poll::Question::Answer" do factory :poll_question_answer, class: "Poll::Question::Answer" do