test/scheduler_test.rb in resque-scheduler-1.9.5 vs test/scheduler_test.rb in resque-scheduler-1.9.6

- old
+ new

@@ -1,9 +1,13 @@ require File.dirname(__FILE__) + '/test_helper' class Resque::SchedulerTest < Test::Unit::TestCase + class FakeJob + def self.scheduled(queue, klass, *args); end + end + def setup Resque::Scheduler.clear_schedule! end def test_enqueue_from_config_puts_stuff_in_the_resque_queue_without_class_loaded @@ -12,9 +16,14 @@ end def test_enqueue_from_config_puts_stuff_in_the_resque_queue Resque::Job.stubs(:create).once.returns(true).with(:ivar, 'SomeIvarJob', '/tmp') Resque::Scheduler.enqueue_from_config('cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp") + end + + def test_enqueue_from_config_with_custom_class_job_in_the_resque_queue + FakeJob.stubs(:scheduled).once.returns(true).with(:ivar, 'SomeIvarJob', '/tmp') + Resque::Scheduler.enqueue_from_config('cron' => "* * * * *", 'class' => 'SomeIvarJob', 'custom_job_class' => 'Resque::SchedulerTest::FakeJob', 'args' => "/tmp") end def test_enqueue_from_config_puts_stuff_in_the_resque_queue_when_env_match # The job should be loaded : its rails_env config matches the RAILS_ENV variable: ENV['RAILS_ENV'] = 'production'