Michael Durrant
Michael Durrant

Reputation: 96454

Where should I put seed data for RSpec tests?

Where should I put test data that is for RSpec testing purposes only?

Upvotes: 0

Views: 3087

Answers (2)

Todd A. Jacobs
Todd A. Jacobs

Reputation: 84343

Like many things in life, it depends.

  1. If you're using fixtures, they live in test/fixtures.
  2. If you're using factory_girl with RSpec, it can read from a number of places but spec/factories/*.rb seems the most sensible place to put them.
  3. If you're using something else, check the documentation for your other fixture or factory gem.

Upvotes: 2

Kleber S.
Kleber S.

Reputation: 8240

You can use fixtures (1) if the data is simple or go to factory_girl_rails gem (2) if you need something more sophisticated.

Also you can create a rake task for populating your database.

Please consider look for similar questions like this

Upvotes: 0

Related Questions