5

RailsCasts の「How I Test」スクリーンキャストに従いましたが、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の要点へのリンクは次のとおりです

4

2 に答える 2

10

You should change:

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

to:

guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' }, 
                cucumber: false, 
                test_unit: false 
于 2012-05-10T04:20:40.700 に答える
5

この問題は実際には、ロードする前に強制終了することによって引き起こされます。これは、低速の MacBook Pro のguard問題ですspork

解決策は、たとえば:wait => 120で待機時間を増やすことです。Guardfile

guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, 
               :rspec_env => { 'RAILS_ENV' => 'test' }, :wait => 120
    ....
于 2011-10-29T13:26:01.923 に答える