开发者

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开发者_如何学JAVA logic to lib/ and write specs as normal. What would you do?

rails 3 with rspec.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜