Test rake tasks with RSpec
Most of the times rake tasks perform important and critical operations. And as with any critical operation in an application, it should be tested!
This is a simple guide of how I test them. Imagine we have the following rake task, that sends contracts for each client: