为什么 RSpec 在 Rails 下这么慢? [英] Why is RSpec so slow under Rails?
问题描述
每当我为我的 Rails 应用程序运行 rspec 测试时,它需要永远和一天的开销才能真正开始运行测试.为什么 rspec 这么慢?有没有办法加快 Rails 的初始加载速度或挑出我需要的 Rails 应用程序的一部分(例如仅 ActiveRecord 内容),这样它就不会完全加载所有内容来运行一些测试?
Whenever I run rspec tests for my Rails application it takes forever and a day of overhead before it actually starts running tests. Why is rspec so slow? Is there a way to speed up Rails' initial load or single out the part of my Rails app I need (e.g. ActiveRecord stuff only) so it doesn't load absolutely everything to run a few tests?
推荐答案
你应该能够通过运行 script/spec_server
来加速你的 script/spec
调用一个单独的终端窗口,然后将额外的 -X
参数添加到您的规范调用中.
You should be able to to speed up your script/spec
calls by running script/spec_server
in a separate terminal window, then adding the additional -X
parameter to your spec calls.
这篇关于为什么 RSpec 在 Rails 下这么慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!