title: Why does Guard run ALL my RSpec specs on every change?
body: <p>This testing stack is behaving unreliably. Sometimes when I run guard, it performs adequately with the guard-rspec gem and will only run the file that has been changed. At least, if the test fails it will stop with that single modified file.</p>
  
  <p>But if that test passes, all bets are off. It will continue to run <strong><em>ALL</em></strong> tests when a single file is changed. On a good-sized application, this is extremely impractical and frustrating to see all tests run every time a file is saved.</p>
  
  <p>My Guardfile is as follows. Notice that I had to change where it was pointing to RSpec specs. By default it thinks you are going to have a <code>specs</code> directory, and that all of your specs will be all jumbled into that one directory. I don't know anybody that tests like that, so it's a funny default to include. It should be looking for subdirectories under <code>specs</code>.</p>
  
  <pre><code># A sample Guardfile
  # More info at https://github.com/guard/guard#readme
  
  guard 'spork', :cucumber =&gt; false, :rspec_env =&gt; { 'RAILS_ENV' =&gt; 'test' } do
    watch('config/application.rb')
    watch('config/environment.rb')
    watch('config/environments/test.rb')
    watch(%r{^config/initializers/.+\.rb$})
    watch('Gemfile')
    watch('Gemfile.lock')
    watch('spec/spec_helper.rb') { :rspec }
  end
  
  guard 'rspec', :version =&gt; 2, :cli =&gt; "--drb" do
    watch(%r{^spec/(.*)/(.+)_spec\.rb$})
    watch(%r{^lib/(.+)\.rb$})     { |m| "spec/lib/#{m[1]}_spec.rb" }
    watch('spec/spec_helper.rb')  { "spec" }
  
    # Rails examples
    watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
    watch(%r{^app/(.*)(\.erb|\.haml)$})                 { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
    watch(%r{^app/controllers/(.+)_(controller)\.rb$})  { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
    watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
    watch('config/routes.rb')                           { "spec/routing" }
    watch('app/controllers/application_controller.rb')  { "spec/controllers" }
  
    # Capybara features specs
    watch(%r{^app/views/(.+)/.*\.(erb|haml)$})          { |m| "spec/features/#{m[1]}_spec.rb" }
    watch(%r{^app/views/(.+)/.*\.(erb|haml)$})          { |m| "spec/requests/#{m[1]}_spec.rb" }
  
    # Turnip features and steps
    watch(%r{^spec/acceptance/(.+)\.feature$})
    watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$})   { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
  end
  </code></pre>