Ruby 使用Guard Spork时Guard Crash Spork

Ruby 使用Guard Spork时Guard Crash Spork,ruby,rspec,spork,guard,Ruby,Rspec,Spork,Guard,我遵循了,但是我遇到了与spork的问题 $ guard Guard is now watching at '/Users/darth/projects/auth-before' Starting Spork for Test::Unit & RSpec Couldn't find a supported test framework that begins with 'testunit' Supported test frameworks: ( ) Cucumber (*) RSp

我遵循了,但是我遇到了与spork的问题

$ guard
Guard is now watching at '/Users/darth/projects/auth-before'
Starting Spork for Test::Unit & RSpec 
Couldn't find a supported test framework that begins with 'testunit'

Supported test frameworks:
( ) Cucumber
(*) RSpec

Legend: ( ) - not detected in project   (*) - detected
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
ERROR: Could not start Spork server for Test::Unit & RSpec. Make sure you can use it manually first.

# here I get growl notification "Test::Unit & RSpec NOT started

Guard::RSpec is running, with RSpec 2!
Running all specs
Running tests with args ["--color", "--format", "progress", "--format", "Guard::RSpec::Formatter::NotificationRSpec", "--out", "/dev/null", "--require", "/Users/darth/.rvm/gems/ruby-1.9.2-p290/gems/guard-rspec-0.5.0/lib/guard/rspec/formatters/notification_rspec.rb", "spec"]...
.

Finished in 14.47 seconds
1 example, 0 failures
Done.
当我试图在一个单独的终端窗口中运行
spork
时,它没有任何帮助,因为一旦我运行
guard

$ spork
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
Killed: 9

如果我只是运行
spork
,然后尝试
rspec--drb
,工作正常对于我的Gemfile、Guardfile和spec_helper.rb

这个问题实际上是由
guard
在加载之前杀死
spork
引起的,这在我速度较慢的MacBook pro上是个问题

解决方案是在
担保文件中增加等待时间
:wait=>120
,例如

guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, 
               :rspec_env => { 'RAILS_ENV' => 'test' }, :wait => 120
    ....
您应该更改:

guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, 
               :rspec_env => { 'RAILS_ENV' => 'test' }, 
               :wait => 120
致:


taivn07和Kevin Bedell的解决方案比Jakub的更适合我。增加等待时间并不能解决问题。禁用Cucumber和TestUnit解决了此问题。若要在不使用rspec的情况下使用minitest,请将
:rspec_env
位更改为
:rspec=>false
,并添加
:minitest_env=>{'RAILS_env'=>test'}
guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' }, 
                cucumber: false, 
                test_unit: false