我想加快我的模型测试。看到这个之后 http://iain.nl/testing-activerecord-in-isolation,我认为可以 如果我只需要active_record而不是 加载spec_helper.rb,它为整个Rails堆栈加载 每个测试文件。 我正在使用rs_-rails和factory_girl。 但到目前为止它不适合我。每次我运行单个文件 整个迁移正在运行,这是不可接受的。之前 整个迁移运行我遇到了一些错误。 有人有更好的主意吗?
答案 0 :(得分:1)
我最近做了类似的事。
看看这是否有帮助:http://technorattle.wordpress.com/2013/01/10/activerecord-outside-rails/
答案 1 :(得分:1)
如果您希望每次都不必重新加载Rails环境来加速测试,那么您应该考虑使用Spork,Guard和Guard :: Spork。 Spork允许您运行单独的“干净”测试服务器,而Guard使您可以通过观察文件的变化使其在后台运行。
Spork:https://github.com/sporkrb/spork
Guard :: Spork:https://github.com/guard/guard-spork
无用的Railscast:http://railscasts.com/episodes/285-spork