diff --git a/.gitignore b/.gitignore index 34ac13d6..01257695 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ doc/ pkg nbproject Gemfile.lock +.rvmrc diff --git a/lib/resque/scheduler.rb b/lib/resque/scheduler.rb index 781a4154..3e201506 100644 --- a/lib/resque/scheduler.rb +++ b/lib/resque/scheduler.rb @@ -218,7 +218,7 @@ def enqueue_from_config(job_config) # one app that schedules for another if Class === klass ResqueScheduler::Plugin.run_before_delayed_enqueue_hooks(klass, *params) - Resque.enqueue(klass, *params) + Resque.enqueue_to(queue, klass, *params) else # This will not run the before_hooks in rescue, but will at least # queue the job. diff --git a/lib/resque_scheduler.rb b/lib/resque_scheduler.rb index 8901d86c..94bd3597 100644 --- a/lib/resque_scheduler.rb +++ b/lib/resque_scheduler.rb @@ -111,7 +111,7 @@ def remove_schedule(name) # sit in the schedule list. def enqueue_at(timestamp, klass, *args) validate_job!(klass) - enqueue_at_with_queue( queue_from_class(klass), timestamp, klass, *args) + enqueue_at_with_queue(queue_from_class(klass), timestamp, klass, *args) end # Identical to +enqueue_at+, except you can also specify diff --git a/resque-scheduler.gemspec b/resque-scheduler.gemspec index 0a832c6d..8ea5b605 100644 --- a/resque-scheduler.gemspec +++ b/resque-scheduler.gemspec @@ -22,6 +22,6 @@ Gem::Specification.new do |s| s.require_path = 'lib' s.add_runtime_dependency(%q, [">= 2.0.1"]) - s.add_runtime_dependency(%q, [">= 1.19.0"]) + s.add_runtime_dependency(%q, [">= 1.20.0"]) s.add_runtime_dependency(%q, [">= 0"]) end diff --git a/test/delayed_queue_test.rb b/test/delayed_queue_test.rb index 76aa8dba..cf938bf3 100644 --- a/test/delayed_queue_test.rb +++ b/test/delayed_queue_test.rb @@ -170,7 +170,7 @@ Resque.enqueue_at(t, SomeIvarJob) # 2 SomeIvarJob jobs should be created in the "ivar" queue - Resque::Job.expects(:create).twice.with(:ivar, SomeIvarJob, nil) + Resque::Job.expects(:create).twice.with('ivar', SomeIvarJob, nil) Resque::Scheduler.handle_delayed_items end @@ -180,7 +180,7 @@ Resque.enqueue_at(t, SomeIvarJob) # 2 SomeIvarJob jobs should be created in the "ivar" queue - Resque::Job.expects(:create).twice.with(:ivar, SomeIvarJob, nil) + Resque::Job.expects(:create).twice.with('ivar', SomeIvarJob, nil) Resque::Scheduler.handle_delayed_items(t) end @@ -191,7 +191,7 @@ Resque.enqueue_at(t, SomeIvarJob) # 2 SomeIvarJob jobs should be created in the "ivar" queue - Resque::Job.expects(:create).twice.with(:ivar, SomeIvarJob, nil) + Resque::Job.expects(:create).twice.with('ivar', SomeIvarJob, nil) Resque::Scheduler.enqueue_delayed_items_for_timestamp(t) diff --git a/test/scheduler_test.rb b/test/scheduler_test.rb index 15222d25..6c5ff66f 100644 --- a/test/scheduler_test.rb +++ b/test/scheduler_test.rb @@ -32,6 +32,14 @@ Resque::Scheduler.enqueue_from_config(config) end + test "enqueue_from_config respects queue params" do + config = {'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'queue' => 'high'} + + Resque.expects(:enqueue_to).with('high', SomeIvarJob) + + Resque::Scheduler.enqueue_from_config(config) + end + test "config makes it into the rufus_scheduler" do assert_equal(0, Resque::Scheduler.rufus_scheduler.all_jobs.size)