Created
June 24, 2011 20:17
-
-
Save brenttheisen/1045588 to your computer and use it in GitHub Desktop.
Rake task that loads factories using factory_girl in to the current environment's database. Intended to be a replacement for Rail's rake db:fixtures:load.
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
# | |
# To install copy this file in to <RAILS_APP>/lib/tasks/factory_girl.rake. | |
# To use run: rake db:factory_girl_load | |
# | |
namespace :db do | |
namespace :factory_girl do | |
desc 'Load Factory Girl factories into the current environment\'s database.' | |
task :load => :environment do | |
FactoryGirl.registry.each do |(name, factory)| | |
FactoryGirl.build name | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment