Skip to content

Instantly share code, notes, and snippets.

@beneggett
Created November 7, 2013 00:41
Show Gist options
  • Save beneggett/7346974 to your computer and use it in GitHub Desktop.
Save beneggett/7346974 to your computer and use it in GitHub Desktop.
15.times do
u = FactoryGirl.create(:user)
pic = Picture.create image: File.open(Dir["/Users/ben/Pictures/Stock\ Photos/people/*.jpg"].sample)
u.picture = pic
Random.rand(6).times do
u.tags.create FactoryGirl.attributes_for(:tag)
end
Random.rand(10).times do
p = u.projects.create FactoryGirl.attributes_for(:project)
(1 + Random.rand(6)).times do
p.pictures.create(image: File.open(Dir["/Users/ben/Pictures/Stock\ Photos/wallpapers/*.jpg"].sample))
end
Random.rand(5) do
p.tags.create name: Faker::HipsterIpsum.word
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment