Reputation: 15002
In my code , the 100 stores are sharing the same attributes.
I thought it should create a different one every time.
(1..100).each do
store_attr = FG.attributes_for :store
store_attr[:account] = accounts.sample
stores << Store.create(store_attr)
end
FactoryGirl.define do
factory :store do
name Faker::Company.name
latitude 1.5
longitude 1.5
street Faker::Address.street_address
city Faker::Address.city
state Faker::Address.state
zip_code Faker::Address.zip_code
phone Faker::PhoneNumber.cell_phone
email Faker::Internet.email
website "https://#{Faker::Internet.domain_name}"
account nil
factory :complete_store do
name 'store_with_account'
account
end
end
end
Upvotes: 0
Views: 80