This adds support for those that put rspec-rails in their test group instead of development group or forget it all together.
This is a clever way to do it. But I'm a bit concerned that since we're depending on exact wording of debug output, this might break in a future version of rake. What do you think about asking rake to list all available tasks, and then checking for the "spec" task in that list, like this?
if `rake --tasks` =~ /^rake spec\b/
# spec task exists
# spec task does not exist
We're still depending somewhat on output format, but it seems like more stable output. The purpose of the condition may be a bit more clear too.
I'd prefer it if it didn't use rake at all and instead just used rspec This way it works with any project that includes rspec as the testing framework; without having to create a rake task.