Skip to content

Commit 4cf080c

Browse files
hsbtclaude
andcommitted
Keep skipped jobserver examples from clobbering global state
The before hook skips before it saves the previous connection pool client and UI, but the after hook restored those unconditionally, leaving Gem::Request::ConnectionPools.client as nil for every later example. Only restore what was captured, matching the guard Artifice.deactivate uses. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent eaf49e1 commit 4cf080c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

spec/bundler/installer/parallel_installer_spec.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,12 @@
132132
Bundler.ui = Bundler::UI::Silent.new
133133
end
134134

135+
# The `before` hook can `skip` before it saves anything, so only restore
136+
# what was actually captured. Otherwise every skipped example clobbers the
137+
# globals with nil.
135138
after do
136-
Bundler.ui = @old_ui
137-
Gem::Request::ConnectionPools.client = @previous_client
139+
Bundler.ui = @old_ui if @old_ui
140+
Gem::Request::ConnectionPools.client = @previous_client if @previous_client
138141
Artifice.deactivate
139142
end
140143

0 commit comments

Comments
 (0)