Here’s a small script to automatically rerun minitests when files changes by reloading files and rerun tests. The script runs in just a few milliseconds so you get instant feedback, but it won’t work if your code rely on global variables, since it reloads the files instead of spawning a new ruby process.

I wrote this after I got tired of waiting for rspec, spork and guard to use between 2 and 4 seconds to rerun my tests.

Note that when using load() instead require(), you have to supply full path and .rb file extension.

The test source and the test:

Our small autorun script. It uses the filewatcher gem to detect file changes.