Created
June 16, 2009 13:11
-
-
Save qrush/130675 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sudo gem install faker | |
require 'faker' | |
Factory.define :post do |post| | |
post.title { Faker::Lorem.sentence } | |
post.body { Faker::Lorem.paragraphs.join(' ') } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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