From 7c19cf3c011a6569a1fdf2db8eecc56b77f78e41 Mon Sep 17 00:00:00 2001 From: Eoin Coffey Date: Thu, 7 Feb 2013 18:38:07 -0700 Subject: [PATCH] Add test to ensure that before_first_fork can take the worker object --- test/resque_hook_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/resque_hook_test.rb b/test/resque_hook_test.rb index 03beb20fe..9fea9b43c 100644 --- a/test/resque_hook_test.rb +++ b/test/resque_hook_test.rb @@ -40,6 +40,15 @@ def self.perform assert_equal(1, counter) end + it 'calls before_first_fork with worker' do + trapped_worker = nil + + Resque.before_first_fork { |worker| trapped_worker = worker } + + @worker.work(0) + assert_equal(@worker, trapped_worker) + end + it 'calls before_fork before each job' do counter = 0