File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -450,6 +450,19 @@ def self.perform
450
450
assert $BEFORE_FORK_CALLED == workerA . will_fork?
451
451
end
452
452
453
+ it "Will not call a before_fork hook when the worker can't fork" do
454
+ Resque . redis . flushall
455
+ $BEFORE_FORK_CALLED = false
456
+ Resque . before_fork = Proc . new { $BEFORE_FORK_CALLED = true }
457
+ workerA = Resque ::Worker . new ( :jobs )
458
+ workerA . cant_fork = true
459
+
460
+ assert !$BEFORE_FORK_CALLED, "before_fork should not have been called before job runs"
461
+ Resque ::Job . create ( :jobs , SomeJob , 20 , '/tmp' )
462
+ workerA . work ( 0 )
463
+ assert !$BEFORE_FORK_CALLED, "before_fork should not have been called after job runs"
464
+ end
465
+
453
466
it "Will not call a before_fork hook when the worker can't fork" do
454
467
Resque . redis . flushall
455
468
$BEFORE_FORK_CALLED = false
You can’t perform that action at this time.
0 commit comments