Skip to content

Instantly share code, notes, and snippets.

@qrush
Created June 16, 2009 13:11
Show Gist options
  • Save qrush/130675 to your computer and use it in GitHub Desktop.
Save qrush/130675 to your computer and use it in GitHub Desktop.
# sudo gem install faker
require 'faker'
Factory.define :post do |post|
post.title { Faker::Lorem.sentence }
post.body { Faker::Lorem.paragraphs.join(' ') }
end
desc "Load db with test data"
task :populate => ['db:reset', :environment] do
require 'factory_girl'
load File.join(Rails.root, 'test', 'factories', 'post.rb')
10.times { Factory(:post) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment