I’ve been playing with autotest for my latest Rails project, and it’s great.
However, if you’re doing a “Ruby without Rails” project and your directory structure is different from the established conventions, you’re out to reverse engineer autotest itself and find outdated recommendations on Google.
It doesn’t have to be this way, here’s my .autotest:
require ‘autotest/redgreen’
require ‘autotest/timestamp’
# quit on first CTRL-c
Autotest.add_hook(:interrupt) do |at|
at.wants_to_quit = true
end
# run all tests for ANY file
Autotest.add_hook(:initialize) do |at|
at.clear_mappings
at.add_mapping(/.*/) do |filename, _|
Dir.glob(‘**/test_*.rb’)
end
end
Enjoy!