How to write test cases for rake tasks


i don’t 've idea about how to write test cases for a rake task(rake

like i’ve a rake file named daily_summary.rake and i had written some
code like extracting from the database based on some criteria. and the
rake file is executed , its working fine.

    but i need to write test cases for this rake

so any body can help me how to write test cases for rake file.


Hi there,

Facade design pattern?
Try to keep your rake files as simple as possible.
The best would be to extract all the logic to the separate lib file
and just call the logic from rake task.

task :daily_summary => :environment do
#extract params
day = ENV[‘DAY’]

This way you can test your lib easily.

On 31 Pa¼, 10:08, Vamsi K. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs