Autotest.add_hook :initialize do |at| # Requires bundler before minitest since the minitest bundled with Ruby does # not support runners. at.testlib = 'bundler/setup minitest/unit' # Mappings from http://opensoul.org/blog/archives/2008/08/22/autotest-mapping-for-rails-test-conventions/. at.clear_mappings at.add_mapping %r%/^lib/(.*)\.rb$% do |_, m| possible = File.basename(m[1]) files_matching %r%^test/.*(#{possible}_test|test_#{possible})\.rb$% end at.add_mapping(%r%^test/.*\.rb$%) { |filename, _| filename } end