aboutsummaryrefslogtreecommitdiffstats
path: root/spec/bundler/support
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-05-06 18:06:21 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-08-03 09:29:55 +0900
commitc3ddd47ce7b546530e2241b0ea6a96817977886a (patch)
tree46515c479773d7add25773b536009e096ee9fa78 /spec/bundler/support
parentd8d5e16305ee071f7cf16980788cabcc44799c2e (diff)
downloadruby-c3ddd47ce7b546530e2241b0ea6a96817977886a.tar.gz
[bundler/bundler] Normalize file:// handling in specs
https://github.com/bundler/bundler/commit/5946d62ad0
Diffstat (limited to 'spec/bundler/support')
-rw-r--r--spec/bundler/support/builders.rb2
-rw-r--r--spec/bundler/support/helpers.rb11
-rw-r--r--spec/bundler/support/matchers.rb2
-rw-r--r--spec/bundler/support/path.rb8
4 files changed, 11 insertions, 12 deletions
diff --git a/spec/bundler/support/builders.rb b/spec/bundler/support/builders.rb
index 33a81f6f65..70125ce52a 100644
--- a/spec/bundler/support/builders.rb
+++ b/spec/bundler/support/builders.rb
@@ -689,7 +689,7 @@ module Spec
elsif tag = options[:tag]
`git tag #{Shellwords.shellescape(tag)}`
elsif options[:remote]
- silently("git remote add origin file://#{options[:remote]}")
+ silently("git remote add origin #{options[:remote]}")
elsif options[:push]
silently("git push origin #{options[:push]}")
end
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index cf76a84b7c..922555ff60 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -279,7 +279,7 @@ module Spec
if contents.nil?
File.open("Gemfile.lock", "r", &:read)
else
- create_file("Gemfile.lock", normalize_uri_file(contents), *args)
+ create_file("Gemfile.lock", contents, *args)
end
end
@@ -289,15 +289,6 @@ module Spec
str.gsub(/^#{spaces}/, "")
end
- def normalize_uri_file(str)
- # URI::File of Ruby 2.6 normalize localhost variable with file protocol.
- if defined?(URI::File)
- str.gsub(%r{file:\/\/localhost}, "file://")
- else
- str
- end
- end
-
def install_gemfile(*args)
gemfile(*args)
opts = args.last.is_a?(Hash) ? args.last : {}
diff --git a/spec/bundler/support/matchers.rb b/spec/bundler/support/matchers.rb
index 5d1a6a7919..b0493801e8 100644
--- a/spec/bundler/support/matchers.rb
+++ b/spec/bundler/support/matchers.rb
@@ -194,7 +194,7 @@ module Spec
RSpec::Matchers.alias_matcher :include_gem, :include_gems
def have_lockfile(expected)
- read_as(normalize_uri_file(strip_whitespace(expected)))
+ read_as(strip_whitespace(expected))
end
def plugin_should_be_installed(*names)
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index dc4b3bb6eb..28682a1f25 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -62,6 +62,14 @@ module Spec
tmp.join("gems/base")
end
+ def file_uri_for(path)
+ protocol = "file://"
+
+ return protocol + "localhost" + path.to_s if RUBY_VERSION < "2.5"
+
+ protocol + path.to_s
+ end
+
def gem_repo1(*args)
tmp("gems/remote1", *args)
end