2012-01-18 8 views
16

Libnotifyが提供する通知でGuardを正常に実行しています。RSpec2、Ruby1.9.3、Rails 3.1.3のGuard

[email protected]:~/railsprojects/sample_app$ guard 
Guard uses Libnotify to send notifications. 
Guard is now watching at '/home/funkdified/railsprojects/sample_app' 
Guard::RSpec is running, with RSpec 2! 
Running all specs 
... 

Finished in 0.06053 seconds 
3 examples, 0 failures 

私がスペックファイルを変更した場合、私は端末とポップアップ通知の両方でテスト結果を警告します。コントローラファイルを変更すると、再度テストが正常に実行されます。しかし、routes.rbを変更すると、すべてのものが顔に落ち、Guardが正常に動作しなくなり、エラーがスローされます。誰でもアイデアはありますか?

エラー:

Running: spec/routing 
/home/funkdified/.rvm/gems/[email protected]/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load': cannot load such file -- /home/funkdified/railsprojects/sample_app/spec/routing (LoadError) 
    from /home/funkdified/.rvm/gems/[email protected]/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `block in load_spec_files' 
    from /home/funkdified/.rvm/gems/[email protected]/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map' 
    from /home/funkdified/.rvm/gems/[email protected]/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files' 
    from /home/funkdified/.rvm/gems/[email protected]/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run' 
    from /home/funkdified/.rvm/gems/[email protected]/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process' 
    from /home/funkdified/.rvm/gems/[email protected]/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run' 
    from /home/funkdified/.rvm/gems/[email protected]/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun 

は、言及するのを忘れてしまった私は、ガードと、再起動を殺すならば、ガードが再びテストが今失敗したことを示唆し、正常に実行する(routes.rbをの変更を行った後):

[email protected]:~/railsprojects/sample_app$ guard 
Guard uses Libnotify to send notifications. 
Guard is now watching at '/home/funkdified/railsprojects/sample_app' 
Guard::RSpec is running, with RSpec 2! 
Running all specs 
..F 

Failures: 

    1) PagesController GET 'about' returns http success 
    Failure/Error: get 'about' 
    ActionController::RoutingError: 
     No route matches {:controller=>"pages", :action=>"about"} 
    # ./spec/controllers/pages_controller_spec.rb:22:in `block (3 levels) in <top (required)>' 

Finished in 0.0576 seconds 
3 examples, 1 failure 

Failed examples: 

rspec ./spec/controllers/pages_controller_spec.rb:21 # PagesController GET 'about' returns http success 

答えて

30

specディレクトリを確認してください。ルーティング仕様のサブディレクトリはroutingです。そうでない場合は、空のものを作成します。明らかに、rails g rspec:installを実行すると、RSpecはspecの下にサブディレクトリを作成しませんが、ガードはそこに存在することを期待しています。

2

私はあなたのGuardfileに以下の行を持っているかもしれないと思う:

watch('config/routes.rb')       { "spec/routing" } 

あなたはspec/routingでスペックを持っていない場合は、あなたが必要としないそのフォルダはありません。行を変更します。

watch('config/routes.rb')       { "spec" } 

あなたroutes.rbファイルを更新するとき、すべてのスペックが実行されます。

関連する問題