tags:

views:

234

answers:

2
+3  Q: 

Test Rake Tasks

I am developing a ROR app that relies on many custom Rake tasks.

What is the best way to test them?

+3  A: 

Rake tasks are pretty hard to test. The easiest solution would be to move the logic into a method in an appropriate model. You can then test that and just call the method from the rake task.

Olly
A: 

This is pretty well covered in another SO question

My recommendation, repeated here in summary, is not to try testing rake tasks: extract the code to be tested to a class, model or lib function and test it there. Then jsut use rake to call the functions and manage dependencies.

Mike Woodhouse