Question

I have a number of CSV formatted files I would like to use as Fixtures or Factory Girl data. I found this..

Rails won't find CSV fixtures

which states that CSV file support is deprecated. What other solutions do I have to use CSV files as sample data with rspec?

Was it helpful?

Solution

Fixtures are very hard to maintain and almost everybody is migrating to Factories. I encourage you to consider creating some factories instead of relying on fixtures, also considering your fixtures are in a format no longer supported.

It may take a little bit more at the beginning, but the maintenance will definitely be more effective.

You can create a script to parse the CSV and feed the database with your fixtures, but again, I do not encourage you to do that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top