test/scheduler_3_test.rb in rufus-scheduler-1.0.5 vs test/scheduler_3_test.rb in rufus-scheduler-1.0.6
- old
+ new
@@ -11,59 +11,59 @@
require 'openwfe/util/scheduler'
class Scheduler3Test < Test::Unit::TestCase
- #def setup
- #end
+ #def setup
+ #end
- #def teardown
- #end
+ #def teardown
+ #end
- #
- # Testing tags
- #
- def test_0
+ #
+ # Testing tags
+ #
+ def test_0
- scheduler = OpenWFE::Scheduler.new
- scheduler.start
+ scheduler = OpenWFE::Scheduler.new
+ scheduler.start
- value = nil
+ value = nil
- scheduler.schedule_in "3s", :tags => "fish" do
- value = "fish"
- end
+ scheduler.schedule_in "3s", :tags => "fish" do
+ value = "fish"
+ end
- sleep 0.300 # let the job get really scheduled
+ sleep 0.300 # let the job get really scheduled
- assert_equal [], scheduler.find_jobs('deer')
- assert_equal 1, scheduler.find_jobs('fish').size
+ assert_equal [], scheduler.find_jobs('deer')
+ assert_equal 1, scheduler.find_jobs('fish').size
- scheduler.schedule "* * * * *", :tags => "fish" do
- value = "cron-fish"
- end
- scheduler.schedule "* * * * *", :tags => "vegetable" do
- value = "daikon"
- end
+ scheduler.schedule "* * * * *", :tags => "fish" do
+ value = "cron-fish"
+ end
+ scheduler.schedule "* * * * *", :tags => "vegetable" do
+ value = "daikon"
+ end
- sleep 0.300 # let the jobs get really scheduled
+ sleep 0.300 # let the jobs get really scheduled
- assert_equal 2, scheduler.find_jobs('fish').size
- #puts scheduler.find_jobs('fish')
+ assert_equal 2, scheduler.find_jobs('fish').size
+ #puts scheduler.find_jobs('fish')
- scheduler.find_jobs('fish').each do |job|
- scheduler.unschedule(job.job_id)
- end
+ scheduler.find_jobs('fish').each do |job|
+ scheduler.unschedule(job.job_id)
+ end
- sleep 0.300 # give it some time to unschedule
+ sleep 0.300 # give it some time to unschedule
- assert_equal [], scheduler.find_jobs('fish')
- assert_equal 1, scheduler.find_jobs('vegetable').size
+ assert_equal [], scheduler.find_jobs('fish')
+ assert_equal 1, scheduler.find_jobs('vegetable').size
- scheduler.find_jobs('vegetable')[0].unschedule
+ scheduler.find_jobs('vegetable')[0].unschedule
- sleep 0.300 # give it some time to unschedule
+ sleep 0.300 # give it some time to unschedule
- assert_equal 0, scheduler.find_jobs('vegetable').size
- end
+ assert_equal 0, scheduler.find_jobs('vegetable').size
+ end
end