Skip to content

Commit 9d04fcb

Browse files
committed
Fix test compatibility with Windows paths
1 parent 00067a2 commit 9d04fcb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/ruby_lsp_rails/rails_test_style_test.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,12 @@ class SpecialCharsTest < ActiveSupport::TestCase
134134
end
135135

136136
test "resolve test command entire files" do
137-
Dir.stubs(:glob).returns(["/other/test/fake_test.rb", "/other/test/fake_test2.rb"])
137+
base_dir = Gem.win_platform? ? "D:/other/test" : "/other/test"
138+
test_paths = [
139+
File.join(base_dir, "fake_test.rb"),
140+
File.join(base_dir, "fake_test2.rb"),
141+
]
142+
Dir.stubs(:glob).returns(test_paths)
138143

139144
with_server do |server|
140145
sleep(0.1) while RubyLsp::Addon.addons.first.instance_variable_get(:@rails_runner_client).is_a?(NullClient)
@@ -167,7 +172,7 @@ class SpecialCharsTest < ActiveSupport::TestCase
167172

168173
assert_equal(
169174
[
170-
"#{RailsTestStyle::BASE_COMMAND} /test/server_test.rb /other/test/fake_test.rb /other/test/fake_test2.rb",
175+
"#{RailsTestStyle::BASE_COMMAND} /test/server_test.rb #{test_paths.join(" ")}",
171176
],
172177
response[:commands],
173178
)

0 commit comments

Comments
 (0)