当我使用spork
运行我的规格时,我的性能提升非常显着
$ time rspec .
.....
Finished in 11.39 seconds
5 examples, 0 failures
real 0m11.780s
user 0m10.318s
sys 0m1.180s
和spork
$ time rspec . --drb
.....
Finished in 107.24 seconds
5 examples, 0 failures
real 0m1.968s
user 0m0.488s
sys 0m0.095s
真的很棒。但是一旦我把守卫放进去,似乎一切都运行得很慢,好像根本没有任何支柱。
$ guard
Guard is now watching at '/Users/darth/projects/scvrush'
Starting Spork for RSpec
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
Spork server for RSpec successfully started
Guard::RSpec is running, with RSpec 2!
Running all specs
.....
Finished in 10.77 seconds
5 examples, 0 failures
即使我不看Finished in 10.77 seconds
,每次尝试运行规范时,我都可以计算至少6-8秒,即使对于一个模型也是如此。
我做了一些minor edits to the Guardfile,例如:wait => 120
,但这只会影响guard
启动的时间。
答案 0 :(得分:2)
您必须在Guardfile中传递rspec的--drb选项,如下所示:
guard 'rspec', :version => 2, :cli => '--drb' do
...
end