# this will prevent autotest from watching unneeded 
# directories and files for changes
Autotest.add_hook :initialize do |at|
  %w[.svn .git vendor log doc public tmp stories].each do |pattern|
    at.add_exception(pattern+'/')
  end
  
  # add rules for /other/ specs
  at.add_mapping(%r%^spec/other/.*rb$%) do |filename, _|
    filename
  end

  at.add_mapping(%r%^lib/(.*)\.rb$%) do |_, m|
    ["spec/other/#{m[1]}_spec.rb"]
  end

  at.add_mapping(%r%^(spec/(spec_helper|shared/.*)|config/(boot|environment(s/test)?))\.rb$%) do
    at.files_matching %r%^spec/other/.*_spec\.rb$%
  end
end
