From 5fb50c3f8f1c327e26bb5b979aed7ceaaccaa5f6 Mon Sep 17 00:00:00 2001 From: Melony Franchini Date: Sun, 22 Oct 2023 22:04:18 -0600 Subject: [PATCH] fix: Update seed & factories for database --- db/seeds.rb | 8 +++++--- spec/factories/users.rb | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 1c880fd..0732881 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -8,16 +8,18 @@ require 'faker' # Create users +zip_code_options = [12345, 54321, 10101, 55055] + 10.times do password = Faker::Alphanumeric.alphanumeric(number: 10, min_alpha: 3, min_numeric: 3) User.create( full_name: Faker::Name.name, - password:, + password: password, password_confirmation: password, email: Faker::Internet.email, - zip_code: Faker::Address.zip_code, - phone_number: Faker::PhoneNumber.phone_number + zip_code: zip_code_options.sample, + phone_number: "(#{Faker::Number.number(digits: 3)}) #{Faker::Number.number(digits: 3)}-#{Faker::Number.number(digits: 4)}" ) end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 4002999..6ea1faf 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -14,6 +14,7 @@ # We are using US examples for the MVP: this will need to change for international usage # We format all phone numbers before saving them in the database + # phone_number { Faker::Number.number(digits: 10) } phone_number { "(#{Faker::Number.number(digits: 3)}) #{Faker::Number.number(digits: 3)}-#{Faker::Number.number(digits: 4)}" } # Decided not to use this and go with an icon on the FE repo