From 0368b54c22086d516fa98ce69608ebad2d497969 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 09:33:31 +0000 Subject: [PATCH] Fix gem remedy test for paths that need quoting The test of a copy beside another Ruby's tree built the expected rm command from Path::display(), but the remedy quotes each path as one shell word. A Windows temp path holds a backslash and a tilde, so the nightly Windows leg failed on every run. The test also joined the gemspec path with a slash inside one part, which Windows keeps as a slash while the remedy joins part by part. Build the expected commands with shell_word and join the gemspec path part by part. The assertions are unchanged. Fixes #2399 Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_011f9aePyMvbD6rKimV9v2pL --- crates/socket-patch-cli/src/commands/gem_refresh.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/socket-patch-cli/src/commands/gem_refresh.rs b/crates/socket-patch-cli/src/commands/gem_refresh.rs index 5c3f61d95..226f4797f 100644 --- a/crates/socket-patch-cli/src/commands/gem_refresh.rs +++ b/crates/socket-patch-cli/src/commands/gem_refresh.rs @@ -2607,13 +2607,17 @@ mod tests { let home = tmp.path().join("vendor/bundle/ruby/3.2.0"); let gem = installed("json", &home, true); let (dir, _) = gem.installed.clone().unwrap(); - let spec = home.join("specifications/json-1.0.0.gemspec"); + // Joined part by part, as the remedy builds it: on Windows a `/` + // inside a joined part stays a `/`. + let spec = home.join("specifications").join("json-1.0.0.gemspec"); + // The commands quote a path as `shell_word` does (a Windows path + // holds `\`); the warning's detail below lists the paths as they are. let rm_rf = format!( "run `rm -rf {} {} && bundle install`", - dir.display(), - spec.display() + shell_word(&dir), + shell_word(&spec) ); - let rm_f = format!("run `rm -f {} ", spec.display()); + let rm_f = format!("run `rm -f {} ", shell_word(&spec)); let off = policy(tmp.path(), false, false, false); let on = policy(tmp.path(), true, false, false); let disabled = pass(std::slice::from_ref(&gem), &off).await;