summaryrefslogtreecommitdiff
path: root/spec/support/path.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-05-05 19:00:47 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-06-11 12:36:19 +0200
commit1b7e274cbc9e51892e4efc115a97c728e026d966 (patch)
treef10ba90eb7865fa2876129cc17439b7382a55696 /spec/support/path.rb
parent5946d62ad03c57271ccb037680382b1db9fc2e65 (diff)
downloadbundler-1b7e274cbc9e51892e4efc115a97c728e026d966.tar.gz
Fix file:// handling under Windows
Windows paths do not start with a slash, so we add an extra slash to separate the host from the path in file:// urls. Otherwise "D:" is parsed as the host segment in the URI. The path for those URLs now starts with "/", so we ignore that leading character when using the URI's path. This reduces Windows CI spec failures from 429 to 355.
Diffstat (limited to 'spec/support/path.rb')
-rw-r--r--spec/support/path.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/spec/support/path.rb b/spec/support/path.rb
index 28682a1f25..ca05ef5e3b 100644
--- a/spec/support/path.rb
+++ b/spec/support/path.rb
@@ -64,10 +64,11 @@ module Spec
def file_uri_for(path)
protocol = "file://"
+ root = Gem.win_platform? ? "/" : ""
- return protocol + "localhost" + path.to_s if RUBY_VERSION < "2.5"
+ return protocol + "localhost" + root + path.to_s if RUBY_VERSION < "2.5"
- protocol + path.to_s
+ protocol + root + path.to_s
end
def gem_repo1(*args)