You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
466 B
17 lines
466 B
2 years ago
|
FactoryBot.define do
|
||
|
factory :section, class: "Form::Section" do
|
||
|
id { "section_id" }
|
||
|
initialize_with { new(id, nil, nil) }
|
||
|
trait :with_questions do
|
||
|
transient do
|
||
|
question_ids { nil }
|
||
|
questions { nil }
|
||
|
end
|
||
|
|
||
|
after :build do |section, evaluator|
|
||
|
section.subsections = [build(:subsection, :with_questions, question_ids: evaluator.question_ids, questions: evaluator.questions, section:)]
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|