2012-01-18 4 views
16

मैं लिबोटोटिफ़ द्वारा प्रदान की गई अधिसूचनाओं के साथ सफलतापूर्वक गार्ड चला रहा हूं।गार्ड डब्ल्यू/आरएसपीसी 2, रूबी 1.9.3, रेल 3.1.3

[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 

अगर मैं कल्पना फ़ाइल मैं परीक्षण के परिणाम के रूप में सतर्क कर दिया हूँ, संशोधित करने, दोनों टर्मिनल में और एक पॉपअप अधिसूचना के साथ। अगर मैं नियंत्रक फ़ाइल को संशोधित करता हूं, तो परीक्षण सामान्य रूप से चलते हैं। हालांकि, जब मैं मार्गों को संशोधित करता हूं। आरबी, पूरी चीजें उसके चेहरे पर पड़ती हैं और गार्ड सामान्य रूप से काम करना बंद कर देता है और एक त्रुटि फेंकता है। क्या किसी के भी पास कोई सुझाव है?

त्रुटि:

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 फ़ाइल को अपडेट चलेंगे।