Skip to content

Commit de07509

Browse files
authored
test(bundler): Make tests path-separator agnostic (#237)
Make tests path-separator agnostic. Make tests green on Windows.
1 parent 6cdac68 commit de07509

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/bundler.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ mod tests {
7878
use super::*;
7979
use crate::command_executor::CommandExecutor;
8080
use std::cell::RefCell;
81+
use std::path::Path;
8182
use zed_extension_api::process::Output;
8283

8384
struct MockExecutorConfig {
@@ -158,7 +159,10 @@ mod tests {
158159
gem: &str,
159160
) -> MockCommandExecutor {
160161
let mock = MockCommandExecutor::new();
161-
let gemfile_path = format!("{dir}/Gemfile");
162+
let gemfile_path = Path::new(dir)
163+
.join("Gemfile")
164+
.to_string_lossy()
165+
.into_owned();
162166
mock.expect(
163167
"bundle",
164168
&["info", "--version", gem],
@@ -187,12 +191,15 @@ mod tests {
187191
let mock_executor = MockCommandExecutor::new();
188192
let gem_name = "unknown_gem";
189193
let error_output = "Could not find gem 'unknown_gem'.";
190-
let gemfile_path = "test_dir/Gemfile";
194+
let gemfile_path = Path::new("test_dir")
195+
.join("Gemfile")
196+
.to_string_lossy()
197+
.into_owned();
191198

192199
mock_executor.expect(
193200
"bundle",
194201
&["info", "--version", gem_name],
195-
&[("BUNDLE_GEMFILE", gemfile_path)],
202+
&[("BUNDLE_GEMFILE", &gemfile_path)],
196203
Ok(Output {
197204
status: Some(1),
198205
stdout: Vec::new(),
@@ -223,12 +230,15 @@ mod tests {
223230
let mock_executor = MockCommandExecutor::new();
224231
let gem_name = "critical_gem";
225232
let specific_error_msg = "Mocked execution failure";
226-
let gemfile_path = "test_dir/Gemfile";
233+
let gemfile_path = Path::new("test_dir")
234+
.join("Gemfile")
235+
.to_string_lossy()
236+
.into_owned();
227237

228238
mock_executor.expect(
229239
"bundle",
230240
&["info", "--version", gem_name],
231-
&[("BUNDLE_GEMFILE", gemfile_path)],
241+
&[("BUNDLE_GEMFILE", &gemfile_path)],
232242
Err(specific_error_msg.to_string()),
233243
);
234244

0 commit comments

Comments
 (0)