From c8c87406f5ff52d72aa1c8749482a0e8cb3f3daa Mon Sep 17 00:00:00 2001 From: Javan Makhmali Date: Mon, 13 Jul 2009 15:43:08 -0400 Subject: [PATCH] Added aligned time tests for runners and rake tasks --- test/output_at_test.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/output_at_test.rb b/test/output_at_test.rb index 046aacb..2f160ce 100644 --- a/test/output_at_test.rb +++ b/test/output_at_test.rb @@ -79,6 +79,38 @@ class OutputAtTest < Test::Unit::TestCase end end + context "various days at a various aligned times using a runner" do + setup do + @output = Whenever.cron \ + <<-file + set :path, '/your/path' + every "mon,wed,fri", :at => '5:02am, 3:02pm' do + runner "blahblah" + end + file + end + + should "output the runner using one entry because the times are aligned" do + assert_match '2 5,15 * * 1,3,5 /your/path/script/runner -e production "blahblah"', @output + end + end + + context "various days at a various aligned times using a rake task" do + setup do + @output = Whenever.cron \ + <<-file + set :path, '/your/path' + every "mon,wed,fri", :at => '5:02am, 3:02pm' do + rake "blah:blah" + end + file + end + + should "output the rake task using one entry because the times are aligned" do + assert_match '2 5,15 * * 1,3,5 cd /your/path && RAILS_ENV=production /usr/bin/env rake blah:blah', @output + end + end + context "A command every 1.month at very diverse times" do setup do @output = Whenever.cron \