Skip to content

Commit 0d98b0e

Browse files
committed
Fix Delayed Job hook spec order dependency
The "adds the plugin" example relied on `start_agent` installing the process-global Delayed Job hook, which installs once and is never reset. Once another spec installed it first (e.g. the integration spec under a different run order), the example saw an empty stubbed worker and failed. It only passed because `hooks/` sorts before `integrations/`. Install the hook directly in the example, like the Shoryuken hook spec, so it no longer depends on global state or run order.
1 parent c1f6849 commit 0d98b0e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

spec/lib/appsignal/hooks/delayed_job_spec.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ def self.plugins
1010
@plugins ||= []
1111
end
1212
end)
13-
start_agent
13+
# Install the hook directly rather than through `start_agent`. Hooks
14+
# install once per process and are never reset, so relying on
15+
# `start_agent` made "adds the plugin" pass only when this spec was the
16+
# first to install the Delayed Job hook -- it saw an empty stubbed worker
17+
# (and failed) once any other spec had installed it first. Mirrors the
18+
# Shoryuken hook spec.
19+
described_class.new.install
1420
end
1521

1622
describe "#dependencies_present?" do

0 commit comments

Comments
 (0)