ZenTest gem includes an autotest command line autotest that monitors the test directory and runs tests when one of the files changes.
See how this tool works. Using inotify is useful, but not necessary.
The main idea for this is to write a loop with sleep inside it. Use the Ruby Find class to find files that are candidates for processing. The Search documentation has sample code to run this part.
source share