Skip to content

Instantly share code, notes, and snippets.

@miyamae
Forked from brenttheisen/factory_girl.rake
Last active December 20, 2015 01:49
Show Gist options
  • Select an option

  • Save miyamae/6052148 to your computer and use it in GitHub Desktop.

Select an option

Save miyamae/6052148 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.
#
# 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.factories.map(&:name).each do |name|
FactoryGirl.create name
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment