Best way to do testing / load seed data?

What is the preferred way to have testing data - fixtures, or something like factory_girl (https://github.com/thoughtbot/ factory_girl)?

I definitely need something that can handle relationships between things - for example, an article belongs to a section / a section has many articles.

Also, how do people generally load seed data? I know about rake db:seed...but do people generally load something (like fixtures) in the seeds.rb file instead of typing out all this stuff in there? There must be a clean way to handle all of this!

I think I'm going to try factory_girl if no one has major objections...

daze wrote in post #966672:

What is the preferred way to have testing data - fixtures, or something like factory_girl (thoughtbot, inc. ยท GitHub factory_girl)?

Factories. Never use fixtures, ever, for anything.

I definitely need something that can handle relationships between things - for example, an article belongs to a section / a section has many articles.

If you had checked the documentation for Factory Girl and Machinist, you would know that they can do this.

Also, how do people generally load seed data? I know about rake db:seed...but do people generally load something (like fixtures) in the seeds.rb file instead of typing out all this stuff in there? There must be a clean way to handle all of this!

There is. The seeds.rb file or the seed_fu plugin.

I think I'm going to try factory_girl if no one has major objections...

Yes, do try that or Machinist.

Best,

Hey thanks! Just like to say that factory_girl_rails (factory_girl for Rails 3) works excellently.