defunkt/resque — pull request #537 by panthomakos (2012-03-07 22:24:15+00:00)
Title: Enable registering of multiple Resque hooks

Calling `Resque.before_fork {}` would register a hook, but if any other gem,
plugin or file also tried to set a before fork hook, the original would be
replaced by the new hook. An example of this is the rpm_contrib gem which allows
New Relic instrumentation of Resque jobs. The gem defines a `before_first_fork`
hook and an `after_fork` hook. This results in conflicts if a user wants to
define their own hooks of the same type.

This fix allows multiple hooks to be registered and executes all of them
instead of simply executing the last registered hook. I've consolidated
the related tests into a single file and added some tests to ensure that the
hooks are called, called at the right time, and that multiple hooks can be
registered.