Skip to content

Commit

Permalink
Add test to ensure that before_first_fork can take the worker object
Browse files Browse the repository at this point in the history
  • Loading branch information
ecoffey committed Feb 8, 2013
1 parent 39bb75f commit 7c19cf3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/resque_hook_test.rb
Expand Up @@ -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

Expand Down

0 comments on commit 7c19cf3

Please sign in to comment.