Skip to content

Commit

Permalink
Merge pull request #57 from WWC-Hackathon-2023/seed_fix
Browse files Browse the repository at this point in the history
BE | Fix `seed.rb`
  • Loading branch information
MelTravelz authored Oct 23, 2023
2 parents 092f933 + 5fb50c3 commit b0a9930
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions spec/factories/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b0a9930

Please sign in to comment.