Skip to content

Commit b9514f1

Browse files
committed
Fix test directory path escaping test on Windows
1 parent 74b324d commit b9514f1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/ruby_lsp_rails/rails_test_style_test.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ class SpecialCharsTest < ActiveSupport::TestCase
293293
end
294294

295295
test "resolve test escapes file paths inside directories" do
296-
Dir.stubs(:glob).returns(["/test/example(v2)_test.rb"])
296+
base_dir = Gem.win_platform? ? "D:/test" : "/test"
297+
test_path = File.join(base_dir, "example(v2)_test.rb")
298+
Dir.stubs(:glob).returns([test_path])
297299

298300
with_server do |server|
299301
sleep(0.1) while RubyLsp::Addon.addons.first.instance_variable_get(:@rails_runner_client).is_a?(NullClient)
@@ -318,7 +320,7 @@ class SpecialCharsTest < ActiveSupport::TestCase
318320
response = result.response
319321

320322
assert_equal(
321-
["#{RailsTestStyle::BASE_COMMAND} /test/example\\(v2\\)_test.rb"],
323+
["#{RailsTestStyle::BASE_COMMAND} #{Shellwords.escape(test_path)}"],
322324
response[:commands],
323325
)
324326
end

0 commit comments

Comments
 (0)