Skip to content

Commit

Permalink
Merge pull request #361 from alphagov/ldeb-add-database-seed
Browse files Browse the repository at this point in the history
Add database seed with all question types form
  • Loading branch information
lfdebrux authored Nov 16, 2023
2 parents 04d2b95 + 59f15f8 commit 1093b47
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,83 @@
#
# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
# Character.create(name: "Luke", movie: movies.first)

submission_email = ENV["EMAIL"] || `git config --get user.email`.strip
organisation_id = 1 # Assumes you're using the default database seed for forms-admin

all_question_types_form = Form.create!(
name: "All question types form",
pages: [
Page.create(
question_text: "Single line of text",
answer_type: "text",
answer_settings: {
input_type: "single_line",
},
),
Page.create(
question_text: "Number",
answer_type: "number",
),
Page.create(
question_text: "Address",
answer_type: "address",
answer_settings: {
input_type: {
international_address: false,
uk_address: true,
},
},
),
Page.create(
question_text: "Email address",
answer_type: "email",
),
Page.create(
question_text: "Todays Date",
answer_type: "date",
answer_settings: {
input_type: "other_date",
},
),
Page.create(
question_text: "National Insurance number",
answer_type: "national_insurance_number",
),
Page.create(
question_text: "Phone number",
answer_type: "phone_number",
),
Page.create(
question_text: "Selection from a list of options",
answer_type: "selection",
answer_settings: {
"only_one_option": "0", # TODO: investigate why we set this to "0"
"selection_options": [
{ "name": "Option 1" },
{ "name": "Option 2" },
{ "name": "Option 3" },
],
},
is_optional: true, # Include an option for 'None of the above'
),
Page.create(
question_text: "Multiple lines of text",
answer_type: "text",
answer_settings: {
input_type: "long_text",
},
is_optional: true,
),
],
question_section_completed: true,
declaration_text: "",
declaration_section_completed: true,
organisation_id:,
privacy_policy_url: "https://www.gov.uk/help/privacy-notice",
submission_email:,
support_email: "your.email+fakedata84701@gmail.com.gov.uk",
support_phone: "08000800",
what_happens_next_text: "Test",
)
all_question_types_form.make_live!

0 comments on commit 1093b47

Please sign in to comment.