Files
openfoodnetwork/lib/tasks/sample_data/customer_factory.rb
Luis Ramos e52937c113 Use rubocop auto correct to add frozen string literal to all files
This is an unsafe auto corection, we will need to trust our build here
2021-06-17 23:07:26 +01:00

24 lines
538 B
Ruby

# frozen_string_literal: true
require "tasks/sample_data/logging"
module SampleData
class CustomerFactory
include Logging
def create_samples(users)
log "Creating customers"
jane = users["Jane Customer"]
maryse_shop = Enterprise.find_by(name: "Maryse's Private Shop")
return if Customer.where(user_id: jane, enterprise_id: maryse_shop).exists?
log "- #{jane.email}"
Customer.create!(
email: jane.email,
user: jane,
enterprise: maryse_shop
)
end
end
end