oma
oma

Reputation: 40770

writing spec for seeds.rb

In a project, the seeds.rb is getting complicated. We have a seeds/ directory with yml files containing data to be loaded. It should work on re-runs and it should not duplicate records (this is allowed in model). Well, the seeds.rb should be tested, it is used to update production. I'm not getting my head around this one though, wondering wether or not to move the logic to lib/ and write specs as normal. What would you do?

rails 3 with rspec.

Upvotes: 2

Views: 410

Answers (1)

amit_saxena
amit_saxena

Reputation: 7614

I think you should try out the seed-fu gem:
https://github.com/mbleigh/seed-fu

It doesn't generate duplicate records and can help maintain the consistency of the data.

Upvotes: 2

Related Questions