Trying and failing to set up Autotest

Instead of writing specs for the new event system, I've just wasted an evening trying to set up Autotest to work with Rubygame's specs. The challenge is that Rubygame is not laid out in a shallow lib directory like Autotest wants, so I'm trying to help it find out which spec goes which which file.

I've read about the dot-autotest file where you can define hooks and mappings to help Autotest out, but I can't for the life of me get a working mapping. Here's one I tried:

Autotest.add_hook :initialize do |at|

  at.add_mapping( %r%^lib/rubygame/([^/]*)\.rb$% ) {
    at.files_matching %r%^spec/#{$1}_spec\.rb$%


I'd expect this to match, for example, lib/rubygame/color.rb — the regexp matches that string, yet the hook is never even run, and I have no idea why. And even when I have a hook that runs (e.g. with the regexp /(.*)/), $1 and the other match variables aren't set, which vastly limits the usefulness of add_mapping.

Maybe if I spent several of my life digging through the ZenTest source, I could figure out what's going on. But frankly, I'm fed up with it. It'd be less of a PITA to just manually run the specs, than try to coax Autotest into doing what should be a simple task.


Have something interesting to say about this post? Email your thoughtful comments to