title: How to test rake tasks, cron jobs, and
body: <p>I know in Rails application, I can write tests for <em>controllers</em> and <em>models</em> by using Rspec.</p>
  
  <p>But:</p>
  
  <ol>
  <li>How about to test some rake task? What is the good way to test some rake task? </li>
  <li>How about to test a cron job which run certain rake task every day at a fixed time?</li>
  </ol>
  
  <p>Can Rspec also be used for above two scenarios in Rails app development or are there some other ways to implement those tests?</p>
  
  <p>In addition:</p>
  
  <p>I have a rake task which is used to update the database of the Rails app by fetching data from another database and insert to the app database (clean the app database first of course)</p>
  
  <p>I would like to test these, how to do it?</p>