通过将 Rails 保存在内存中来加速开发过程中的 Rails 测试?
当使用“rake”或“rake spec”在我的 Rails 应用程序上运行 rspec 测试时,初始化 Rails 并开始运行测试需要很长时间。
有没有办法将 Rails 加载到内存中并对其运行测试?我希望有类似使用“grails Interactive”的东西 如何加快 grails 测试执行速度 但对于 Rails 来说。
When running rspec tests on my rails app using "rake" or "rake spec", it takes a long time to initialize Rails and start running tests.
Is there a way to keep Rails loaded in memory and run tests against it? I'm hoping there's something similar to using "grails interactive" like this How to speed up grails test execution but for Rails.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这几乎就是Spork的全部内容。
It's almost what Spork is all about.
查看最精彩的railscast“我如何测试”http://railscasts.com/episodes/275 -我如何测试
每次保存文件时,它都会使用guard 运行相关测试,因此您几乎可以立即知道您编写的代码是否导致通过或失败。另外,如果您在 Linux 上运行,那么您可以使用 libnotify 和 libnotify-rails gems,它们会为您弹出一个窗口(完全不显眼)指示通过或失败,这样您就不必继续检查控制台。
See the most awesome railscast "How I test" http://railscasts.com/episodes/275-how-i-test
This uses guard to run a relevant test every time you save a file so you know almost instantly if the code you have written has caused a pass or a fail. Also if you are running on linux then you can use the libnotify and libnotify-rails gems which pop up a window for you (totally unobtrusively) indicating a pass or failure so you don't have to keep checking the console.
有一个名为 Spork 的 Railscast 专门讨论了这个问题 http://railscasts.com/episodes/285-spork 并提供了一个优秀的解决方案和详细的演练。
There is a Railscast called Spork that specifically discusses this problem at http://railscasts.com/episodes/285-spork and offers an excellent solution with a detailed walkthrough.