From b73f5316ab607e780333b5aab32f14647d901460 Mon Sep 17 00:00:00 2001 From: John Weir Date: Mon, 8 Jul 2019 13:51:50 -0700 Subject: [PATCH] move config to a shared method --- test/scheduler_hooks_test.rb | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/test/scheduler_hooks_test.rb b/test/scheduler_hooks_test.rb index 1128384e..9f1a318f 100644 --- a/test/scheduler_hooks_test.rb +++ b/test/scheduler_hooks_test.rb @@ -4,6 +4,14 @@ context 'scheduling jobs with hooks' do setup { Resque.data_store.redis.flushall } + def config + { + 'cron' => '* * * * *', + 'class' => 'SomeRealClass', + 'args' => '/tmp' + } + end + test 'before_schedule hook that does not return false should be enqueued' do enqueue_time = Time.now + 1 SomeRealClass.expects(:before_schedule_example).with(:foo) @@ -23,12 +31,6 @@ end test 'default failure hooks are called when enqueueing a job fails' do - config = { - 'cron' => '* * * * *', - 'class' => 'SomeRealClass', - 'args' => '/tmp' - } - e = RuntimeError.new('custom error') Resque::Scheduler.expects(:enqueue_from_config).raises(e) @@ -38,12 +40,6 @@ test 'failure hooks are called when enqueueing a job fails' do with_failure_handler(ExceptionHandlerClass) do - config = { - 'cron' => '* * * * *', - 'class' => 'SomeRealClass', - 'args' => '/tmp' - } - e = RuntimeError.new('custom error') Resque::Scheduler.expects(:enqueue_from_config).raises(e)