Add sample addresses in the instance's country

This ensures the address country and state are valid, meaning the state
belongs to the provided country. We use the instance's to do that.
This commit is contained in:
Pau Perez
2018-03-06 13:05:14 +01:00
parent b5a8df00dd
commit 12e225e7c0

View File

@@ -10,6 +10,7 @@ namespace :openfoodnetwork do
task_name = "openfoodnetwork:dev:load_sample_data"
spree_user = Spree::User.find_by_email('spree@example.com')
country = Spree::Country.find_by_iso(ENV.fetch('DEFAULT_COUNTRY_CODE'))
Spree::MailMethod.create!(
environment: Rails.env,
@@ -40,19 +41,19 @@ namespace :openfoodnetwork do
unless Spree::Address.find_by_zipcode "3160"
puts "[#{task_name}] Seeding addresses"
FactoryGirl.create(:address, address1: "25 Myrtle Street", zipcode: "3153", city: "Bayswater")
FactoryGirl.create(:address, address1: "6 Rollings Road", zipcode: "3156", city: "Upper Ferntree Gully")
FactoryGirl.create(:address, address1: "72 Lake Road", zipcode: "3130", city: "Blackburn")
FactoryGirl.create(:address, address1: "7 Verbena Street", zipcode: "3195", city: "Mordialloc")
FactoryGirl.create(:address, address1: "20 Galvin Street", zipcode: "3018", city: "Altona")
FactoryGirl.create(:address, address1: "59 Websters Road", zipcode: "3106", city: "Templestowe")
FactoryGirl.create(:address, address1: "17 Torresdale Drive", zipcode: "3155", city: "Boronia")
FactoryGirl.create(:address, address1: "21 Robina CRT", zipcode: "3764", city: "Kilmore")
FactoryGirl.create(:address, address1: "25 Kendall Street", zipcode: "3134", city: "Ringwood")
FactoryGirl.create(:address, address1: "2 Mines Road", zipcode: "3135", city: "Ringwood East")
FactoryGirl.create(:address, address1: "183 Millers Road", zipcode: "3025", city: "Altona North")
FactoryGirl.create(:address, address1: "310 Pascoe Vale Road", zipcode: "3040", city: "Essendon")
FactoryGirl.create(:address, address1: "6 Martin Street", zipcode: "3160", city: "Belgrave")
FactoryGirl.create(:address, address1: "25 Myrtle Street", zipcode: "3153", city: "Bayswater", country: country, state: country.states.first)
FactoryGirl.create(:address, address1: "6 Rollings Road", zipcode: "3156", city: "Upper Ferntree Gully", country: country, state: country.states.first)
FactoryGirl.create(:address, address1: "72 Lake Road", zipcode: "3130", city: "Blackburn", country: country, state: country.states.first)
FactoryGirl.create(:address, address1: "7 Verbena Street", zipcode: "3195", city: "Mordialloc", country: country, state: country.states.first)
FactoryGirl.create(:address, address1: "20 Galvin Street", zipcode: "3018", city: "Altona", country: country, state: country.states.first)
FactoryGirl.create(:address, address1: "59 Websters Road", zipcode: "3106", city: "Templestowe", country: country, state: country.states.first)
FactoryGirl.create(:address, address1: "17 Torresdale Drive", zipcode: "3155", city: "Boronia", country: country, state: country.states.first)
FactoryGirl.create(:address, address1: "21 Robina CRT", zipcode: "3764", city: "Kilmore", country: country, state: country.states.first)
FactoryGirl.create(:address, address1: "25 Kendall Street", zipcode: "3134", city: "Ringwood", country: country, state: country.states.first)
FactoryGirl.create(:address, address1: "2 Mines Road", zipcode: "3135", city: "Ringwood East", country: country, state: country.states.first)
FactoryGirl.create(:address, address1: "183 Millers Road", zipcode: "3025", city: "Altona North", country: country, state: country.states.first)
FactoryGirl.create(:address, address1: "310 Pascoe Vale Road", zipcode: "3040", city: "Essendon", country: country, state: country.states.first)
FactoryGirl.create(:address, address1: "6 Martin Street", zipcode: "3160", city: "Belgrave", country: country, state: country.states.first)
end
# -- Enterprises