Skip to content

Commit 542a763

Browse files
authored
Merge pull request #2730 from govuk-forms/ldeb-add-multiple-branch-form-to-db-seed
Add multiple branch form to database seed
2 parents a52e31a + 8466e39 commit 542a763

1 file changed

Lines changed: 110 additions & 0 deletions

File tree

db/seeds.rb

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,120 @@
462462

463463
welsh_form.make_live!
464464

465+
multiple_branch_form = Form.create!(
466+
name: "Multiple branch form",
467+
pages: [
468+
Page.create(
469+
question_text: "Do you currently live in the UK?",
470+
answer_type: "selection",
471+
answer_settings: {
472+
only_one_option: "true",
473+
selection_options: [
474+
{ "name": "Yes", value: "Yes" },
475+
{ "name": "No", value: "No" },
476+
],
477+
},
478+
is_optional: false,
479+
),
480+
Page.create(
481+
question_text: "Where do you currently live?",
482+
answer_type: "selection",
483+
answer_settings: {
484+
only_one_option: "true",
485+
selection_options: [
486+
{ "name": "England", value: "England" },
487+
{ "name": "Scotland", value: "Scotland" },
488+
{ "name": "Wales", value: "Wales" },
489+
{ "name": "Northern Ireland", value: "Northern Ireland" },
490+
],
491+
},
492+
is_optional: false,
493+
),
494+
Page.create(
495+
question_text: "How many years have you lived in England?",
496+
answer_type: "number",
497+
is_optional: false,
498+
),
499+
Page.create(
500+
question_text: "How many years have you lived in Scotland?",
501+
answer_type: "number",
502+
is_optional: false,
503+
),
504+
Page.create(
505+
question_text: "How many years have you lived in Wales?",
506+
answer_type: "number",
507+
is_optional: false,
508+
),
509+
Page.create(
510+
question_text: "How many years have you lived in Northern Ireland?",
511+
answer_type: "number",
512+
is_optional: false,
513+
),
514+
Page.create(
515+
question_text: "How many years have you lived in the United Kingdom?",
516+
answer_type: "number",
517+
is_optional: false,
518+
),
519+
],
520+
question_section_completed: true,
521+
declaration_markdown: "",
522+
declaration_section_completed: true,
523+
privacy_policy_url: "https://www.gov.uk/help/privacy-notice",
524+
submission_email:,
525+
support_email: "your.email+fakedata84701@gmail.com.gov.uk",
526+
support_phone: "08000800",
527+
what_happens_next_markdown: "Test",
528+
share_preview_completed: true,
529+
)
530+
Condition.create!(
531+
check_page: multiple_branch_form.pages[0],
532+
routing_page: multiple_branch_form.pages[0],
533+
skip_to_end: true,
534+
answer_value: "No",
535+
)
536+
Condition.create!(
537+
check_page: nil,
538+
routing_page: multiple_branch_form.pages[2],
539+
goto_page: multiple_branch_form.pages.last,
540+
answer_value: nil,
541+
)
542+
Condition.create!(
543+
check_page: multiple_branch_form.pages[1],
544+
routing_page: multiple_branch_form.pages[1],
545+
goto_page: multiple_branch_form.pages[3],
546+
answer_value: "Scotland",
547+
)
548+
Condition.create!(
549+
check_page: nil,
550+
routing_page: multiple_branch_form.pages[3],
551+
goto_page: multiple_branch_form.pages.last,
552+
answer_value: nil,
553+
)
554+
Condition.create!(
555+
check_page: multiple_branch_form.pages[1],
556+
routing_page: multiple_branch_form.pages[1],
557+
goto_page: multiple_branch_form.pages[4],
558+
answer_value: "Wales",
559+
)
560+
Condition.create!(
561+
check_page: nil,
562+
routing_page: multiple_branch_form.pages[4],
563+
goto_page: multiple_branch_form.pages.last,
564+
answer_value: nil,
565+
)
566+
Condition.create!(
567+
check_page: multiple_branch_form.pages[1],
568+
routing_page: multiple_branch_form.pages[1],
569+
goto_page: multiple_branch_form.pages[5],
570+
answer_value: "Northern Ireland",
571+
)
572+
multiple_branch_form.make_live!
573+
465574
# add forms to groups
466575
GroupForm.create! group: end_to_end_group, form_id: all_question_types_form.id # All question types form
467576
GroupForm.create! group: end_to_end_group, form_id: e2e_s3_forms.id # s3 submission test form
468577
GroupForm.create! group: test_group, form_id: branch_route_form.id # Branch routing form
469578
GroupForm.create! group: test_group, form_id: none_of_the_above_form.id # None of the above form
470579
GroupForm.create! group: test_group, form_id: welsh_form.id # Welsh form
580+
GroupForm.create! group: test_group, form_id: multiple_branch_form.id
471581
end

0 commit comments

Comments
 (0)