Rails: Testing Cron Jobs in development environment

cron, ruby, ruby-on-rails, whenever

Solution

I would start off by reviewing how the gem itself (whenever gem) is conducting their tests. This is an extract from one of their functional test:

context "weekday at a (single) given time" do
    setup do
      @output = Whenever.cron \
      <<-file
        set :job_template, nil
        every "weekday", :at => '5:02am' do
          command "blahblah"
        end
      file
    end

    should "output the command using that time" do
      assert_match '2 5 * * 1-5 blahblah', @output
    end
  end

Problem

I have a custom environment called 'reports' that is setup to hit a slave database. I am trying to configure some cron jobs using the Whenever gem and want to test them in development before I deploy. Is there any way to test cron jobs in development? Is there anyway I could schedule them locally and then start my reports server and see if they run? Thank You!

Original source