Skip to content

Commit

Permalink
move config to a shared method
Browse files Browse the repository at this point in the history
  • Loading branch information
jweir authored and PatrickTulskie committed Dec 29, 2024
1 parent 94de443 commit b73f531
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions test/scheduler_hooks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand All @@ -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)

Expand Down

0 comments on commit b73f531

Please sign in to comment.