GuiDoody GuiDoody - 8 days ago 7
Ruby Question

Can FactoryGirl generate factories after your models have been created?

When including the factory_girl_rails gem in your dev and test blocks in Gemfile, rails will generate factories automatically when your models are generated.

Is there a way to generate factories after your models have been generated?




Eduardo Santana's ANSWER SHOULD BE CORRECT

Answer

The --fixture-replacement option will let you tell rails what to generate for building test data. You can set this as a default in your config/application.rb file, like so:

config.generators do |g|
  g.fixture_replacement :factory_girl
end
Comments