[rspec-users] Best way to test tasks

Michael Guterl mguterl at gmail.com
Tue Aug 2 17:51:43 EDT 2011


On Tue, Aug 2, 2011 at 4:41 PM, Piter Fcbk <piter.fcbk at gmail.com> wrote:
> I have a task that runs frequently in order to get/import data from another
> system.
> Because of this I wanted to know which is the best way to test tasks in
> order to create the tests needed.
>
> Thanks in advance.
>

Assuming you are asking about rake tasks...  I typically extract the
body of the task into a method and then test that method.  This
typically leaves the rake task very thin and I do not worry about
testing the task itself.

Best,
Michael Guterl


More information about the rspec-users mailing list