Add specs for Rake tasks

Here's an attempt to add specs for the Rake tasks. I broke it into two layers -- I refactored the task internals into a new module which is tested independently, and I added thin specs for the Rake task definitions.

`rake_tasks_spec.rb` is a little clunky so I'd appreciate any suggestions for DRYing it up. (Of course, that might be better addressed by refactoring the code under test.)

Any and all feedback welcome.