summaryrefslogtreecommitdiff
path: root/spec/bundler/bundler
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2019-12-14 19:49:16 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2019-12-15 16:41:10 +0900
commit38002a8adbd98266426940d829429a30af0622a4 (patch)
treedb01bcc2653ba0230a07345c4a3c877246dfe473 /spec/bundler/bundler
parente2b192f7d5b4f0e2133bb6cf03cfc609258826be (diff)
Prepare to release bundler-2.1.0
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2753
Diffstat (limited to 'spec/bundler/bundler')
-rw-r--r--spec/bundler/bundler/definition_spec.rb10
-rw-r--r--spec/bundler/bundler/env_spec.rb4
-rw-r--r--spec/bundler/bundler/fetcher/base_spec.rb6
-rw-r--r--spec/bundler/bundler/fetcher/compact_index_spec.rb2
-rw-r--r--spec/bundler/bundler/fetcher/dependency_spec.rb4
-rw-r--r--spec/bundler/bundler/fetcher/downloader_spec.rb26
-rw-r--r--spec/bundler/bundler/fetcher/index_spec.rb2
-rw-r--r--spec/bundler/bundler/fetcher_spec.rb8
-rw-r--r--spec/bundler/bundler/friendly_errors_spec.rb2
-rw-r--r--spec/bundler/bundler/mirror_spec.rb16
-rw-r--r--spec/bundler/bundler/rubygems_integration_spec.rb6
-rw-r--r--spec/bundler/bundler/settings_spec.rb10
-rw-r--r--spec/bundler/bundler/source/rubygems/remote_spec.rb20
-rw-r--r--spec/bundler/bundler/source_list_spec.rb4
-rw-r--r--spec/bundler/bundler/uri_credentials_filter_spec.rb10
-rw-r--r--spec/bundler/bundler/vendored_persistent_spec.rb4
16 files changed, 67 insertions, 67 deletions
diff --git a/spec/bundler/bundler/definition_spec.rb b/spec/bundler/bundler/definition_spec.rb
index 92f836299d..1f4c1a0807 100644
--- a/spec/bundler/bundler/definition_spec.rb
+++ b/spec/bundler/bundler/definition_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe Bundler::Definition do
s.add_dependency "rack", "1.0"
end
- bundle :install, :env => { "DEBUG" => 1 }
+ bundle :install, :env => { "DEBUG" => "1" }
expect(out).to match(/re-resolving dependencies/)
lockfile_should_be <<-G
@@ -84,7 +84,7 @@ RSpec.describe Bundler::Definition do
s.add_dependency "rack", "1.0"
end
- bundle :install, :env => { "DEBUG" => 1 }
+ bundle :install, :env => { "DEBUG" => "1" }
expect(out).to match(/re-resolving dependencies/)
lockfile_should_be <<-G
@@ -121,7 +121,7 @@ RSpec.describe Bundler::Definition do
gem "foo", :path => "#{lib_path("foo")}"
G
- bundle :check, :env => { "DEBUG" => 1 }
+ bundle :check, :env => { "DEBUG" => "1" }
expect(out).to match(/using resolution from the lockfile/)
lockfile_should_be <<-G
@@ -154,7 +154,7 @@ RSpec.describe Bundler::Definition do
G
bundle "lock --add-platform java"
- bundle :check, :env => { "DEBUG" => 1 }
+ bundle :check, :env => { "DEBUG" => "1" }
expect(out).to match(/using resolution from the lockfile/)
lockfile_should_be <<-G
@@ -181,7 +181,7 @@ RSpec.describe Bundler::Definition do
gem "foo"
G
- bundle :check, :env => { "DEBUG" => 1 }
+ bundle :check, :env => { "DEBUG" => "1" }
expect(out).to match(/using resolution from the lockfile/)
lockfile_should_be <<-G
diff --git a/spec/bundler/bundler/env_spec.rb b/spec/bundler/bundler/env_spec.rb
index f0ab5d5f35..7686fe386a 100644
--- a/spec/bundler/bundler/env_spec.rb
+++ b/spec/bundler/bundler/env_spec.rb
@@ -27,9 +27,9 @@ RSpec.describe Bundler::Env do
end
it "prints gem path" do
- with_clear_paths("GEM_PATH", "/a/b/c:/d/e/f") do
+ with_clear_paths("GEM_PATH", "/a/b/c#{File::PATH_SEPARATOR}d/e/f") do
out = described_class.report
- expect(out).to include("Gem Path /a/b/c:/d/e/f")
+ expect(out).to include("Gem Path /a/b/c#{File::PATH_SEPARATOR}d/e/f")
end
end
diff --git a/spec/bundler/bundler/fetcher/base_spec.rb b/spec/bundler/bundler/fetcher/base_spec.rb
index df1245d44d..02506591f3 100644
--- a/spec/bundler/bundler/fetcher/base_spec.rb
+++ b/spec/bundler/bundler/fetcher/base_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe Bundler::Fetcher::Base do
end
describe "#fetch_uri" do
- let(:remote_uri_obj) { URI("http://rubygems.org") }
+ let(:remote_uri_obj) { Bundler::URI("http://rubygems.org") }
before { allow(subject).to receive(:remote_uri).and_return(remote_uri_obj) }
@@ -49,10 +49,10 @@ RSpec.describe Bundler::Fetcher::Base do
end
context "when the remote uri's host is not rubygems.org" do
- let(:remote_uri_obj) { URI("http://otherhost.org") }
+ let(:remote_uri_obj) { Bundler::URI("http://otherhost.org") }
it "should return the remote uri" do
- expect(subject.fetch_uri).to eq(URI("http://otherhost.org"))
+ expect(subject.fetch_uri).to eq(Bundler::URI("http://otherhost.org"))
end
end
diff --git a/spec/bundler/bundler/fetcher/compact_index_spec.rb b/spec/bundler/bundler/fetcher/compact_index_spec.rb
index f5ae6f4d77..c9419d3eb1 100644
--- a/spec/bundler/bundler/fetcher/compact_index_spec.rb
+++ b/spec/bundler/bundler/fetcher/compact_index_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe Bundler::Fetcher::CompactIndex do
let(:downloader) { double(:downloader) }
- let(:display_uri) { URI("http://sampleuri.com") }
+ let(:display_uri) { Bundler::URI("http://sampleuri.com") }
let(:remote) { double(:remote, :cache_slug => "lsjdf", :uri => display_uri) }
let(:compact_index) { described_class.new(downloader, remote, display_uri) }
diff --git a/spec/bundler/bundler/fetcher/dependency_spec.rb b/spec/bundler/bundler/fetcher/dependency_spec.rb
index 081fdff34d..53249116cd 100644
--- a/spec/bundler/bundler/fetcher/dependency_spec.rb
+++ b/spec/bundler/bundler/fetcher/dependency_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe Bundler::Fetcher::Dependency do
let(:downloader) { double(:downloader) }
- let(:remote) { double(:remote, :uri => URI("http://localhost:5000")) }
+ let(:remote) { double(:remote, :uri => Bundler::URI("http://localhost:5000")) }
let(:display_uri) { "http://sample_uri.com" }
subject { described_class.new(downloader, remote, display_uri) }
@@ -258,7 +258,7 @@ RSpec.describe Bundler::Fetcher::Dependency do
end
describe "#dependency_api_uri" do
- let(:uri) { URI("http://gem-api.com") }
+ let(:uri) { Bundler::URI("http://gem-api.com") }
context "with gem names" do
let(:gem_names) { %w[foo bar bundler rubocop] }
diff --git a/spec/bundler/bundler/fetcher/downloader_spec.rb b/spec/bundler/bundler/fetcher/downloader_spec.rb
index f985b88982..ba8451d9fa 100644
--- a/spec/bundler/bundler/fetcher/downloader_spec.rb
+++ b/spec/bundler/bundler/fetcher/downloader_spec.rb
@@ -3,7 +3,7 @@
RSpec.describe Bundler::Fetcher::Downloader do
let(:connection) { double(:connection) }
let(:redirect_limit) { 5 }
- let(:uri) { URI("http://www.uri-to-fetch.com/api/v2/endpoint") }
+ let(:uri) { Bundler::URI("http://www.uri-to-fetch.com/api/v2/endpoint") }
let(:options) { double(:options) }
subject { described_class.new(connection, redirect_limit) }
@@ -41,19 +41,19 @@ RSpec.describe Bundler::Fetcher::Downloader do
before { http_response["location"] = "http://www.redirect-uri.com/api/v2/endpoint" }
it "should try to fetch the redirect uri and iterate the # requests counter" do
- expect(subject).to receive(:fetch).with(URI("http://www.uri-to-fetch.com/api/v2/endpoint"), options, 0).and_call_original
- expect(subject).to receive(:fetch).with(URI("http://www.redirect-uri.com/api/v2/endpoint"), options, 1)
+ expect(subject).to receive(:fetch).with(Bundler::URI("http://www.uri-to-fetch.com/api/v2/endpoint"), options, 0).and_call_original
+ expect(subject).to receive(:fetch).with(Bundler::URI("http://www.redirect-uri.com/api/v2/endpoint"), options, 1)
subject.fetch(uri, options, counter)
end
context "when the redirect uri and original uri are the same" do
- let(:uri) { URI("ssh://username:password@www.uri-to-fetch.com/api/v2/endpoint") }
+ let(:uri) { Bundler::URI("ssh://username:password@www.uri-to-fetch.com/api/v2/endpoint") }
before { http_response["location"] = "ssh://www.uri-to-fetch.com/api/v1/endpoint" }
it "should set the same user and password for the redirect uri" do
- expect(subject).to receive(:fetch).with(URI("ssh://username:password@www.uri-to-fetch.com/api/v2/endpoint"), options, 0).and_call_original
- expect(subject).to receive(:fetch).with(URI("ssh://username:password@www.uri-to-fetch.com/api/v1/endpoint"), options, 1)
+ expect(subject).to receive(:fetch).with(Bundler::URI("ssh://username:password@www.uri-to-fetch.com/api/v2/endpoint"), options, 0).and_call_original
+ expect(subject).to receive(:fetch).with(Bundler::URI("ssh://username:password@www.uri-to-fetch.com/api/v1/endpoint"), options, 1)
subject.fetch(uri, options, counter)
end
end
@@ -84,7 +84,7 @@ RSpec.describe Bundler::Fetcher::Downloader do
end
context "when the there are credentials provided in the request" do
- let(:uri) { URI("http://user:password@www.uri-to-fetch.com") }
+ let(:uri) { Bundler::URI("http://user:password@www.uri-to-fetch.com") }
it "should raise a Bundler::Fetcher::BadAuthenticationError that doesn't contain the password" do
expect { subject.fetch(uri, options, counter) }.
@@ -102,7 +102,7 @@ RSpec.describe Bundler::Fetcher::Downloader do
end
context "when the there are credentials provided in the request" do
- let(:uri) { URI("http://username:password@www.uri-to-fetch.com/api/v2/endpoint") }
+ let(:uri) { Bundler::URI("http://username:password@www.uri-to-fetch.com/api/v2/endpoint") }
it "should raise a Bundler::Fetcher::FallbackError that doesn't contain the password" do
expect { subject.fetch(uri, options, counter) }.
@@ -137,7 +137,7 @@ RSpec.describe Bundler::Fetcher::Downloader do
context "when there is a user provided in the request" do
context "and there is also a password provided" do
context "that contains cgi escaped characters" do
- let(:uri) { URI("http://username:password%24@www.uri-to-fetch.com/api/v2/endpoint") }
+ let(:uri) { Bundler::URI("http://username:password%24@www.uri-to-fetch.com/api/v2/endpoint") }
it "should request basic authentication with the username and password" do
expect(net_http_get).to receive(:basic_auth).with("username", "password$")
@@ -146,7 +146,7 @@ RSpec.describe Bundler::Fetcher::Downloader do
end
context "that is all unescaped characters" do
- let(:uri) { URI("http://username:password@www.uri-to-fetch.com/api/v2/endpoint") }
+ let(:uri) { Bundler::URI("http://username:password@www.uri-to-fetch.com/api/v2/endpoint") }
it "should request basic authentication with the username and proper cgi compliant password" do
expect(net_http_get).to receive(:basic_auth).with("username", "password")
subject.request(uri, options)
@@ -155,7 +155,7 @@ RSpec.describe Bundler::Fetcher::Downloader do
end
context "and there is no password provided" do
- let(:uri) { URI("http://username@www.uri-to-fetch.com/api/v2/endpoint") }
+ let(:uri) { Bundler::URI("http://username@www.uri-to-fetch.com/api/v2/endpoint") }
it "should request basic authentication with just the user" do
expect(net_http_get).to receive(:basic_auth).with("username", nil)
@@ -164,7 +164,7 @@ RSpec.describe Bundler::Fetcher::Downloader do
end
context "that contains cgi escaped characters" do
- let(:uri) { URI("http://username%24@www.uri-to-fetch.com/api/v2/endpoint") }
+ let(:uri) { Bundler::URI("http://username%24@www.uri-to-fetch.com/api/v2/endpoint") }
it "should request basic authentication with the proper cgi compliant password user" do
expect(net_http_get).to receive(:basic_auth).with("username$", nil)
@@ -244,7 +244,7 @@ RSpec.describe Bundler::Fetcher::Downloader do
end
context "when the there are credentials provided in the request" do
- let(:uri) { URI("http://username:password@www.uri-to-fetch.com/api/v2/endpoint") }
+ let(:uri) { Bundler::URI("http://username:password@www.uri-to-fetch.com/api/v2/endpoint") }
before do
allow(net_http_get).to receive(:basic_auth).with("username", "password")
end
diff --git a/spec/bundler/bundler/fetcher/index_spec.rb b/spec/bundler/bundler/fetcher/index_spec.rb
index d5ededae3e..5ecd7d9e05 100644
--- a/spec/bundler/bundler/fetcher/index_spec.rb
+++ b/spec/bundler/bundler/fetcher/index_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe Bundler::Fetcher::Index do
context "error handling" do
shared_examples_for "the error is properly handled" do
- let(:remote_uri) { URI("http://remote-uri.org") }
+ let(:remote_uri) { Bundler::URI("http://remote-uri.org") }
before do
allow(subject).to receive(:remote_uri).and_return(remote_uri)
end
diff --git a/spec/bundler/bundler/fetcher_spec.rb b/spec/bundler/bundler/fetcher_spec.rb
index 184b9efa64..539179db43 100644
--- a/spec/bundler/bundler/fetcher_spec.rb
+++ b/spec/bundler/bundler/fetcher_spec.rb
@@ -3,7 +3,7 @@
require "bundler/fetcher"
RSpec.describe Bundler::Fetcher do
- let(:uri) { URI("https://example.com") }
+ let(:uri) { Bundler::URI("https://example.com") }
let(:remote) { double("remote", :uri => uri, :original_uri => nil) }
subject(:fetcher) { Bundler::Fetcher.new(remote) }
@@ -45,7 +45,7 @@ RSpec.describe Bundler::Fetcher do
end
context "when a rubygems source mirror is set" do
- let(:orig_uri) { URI("http://zombo.com") }
+ let(:orig_uri) { Bundler::URI("http://zombo.com") }
let(:remote_with_mirror) do
double("remote", :uri => uri, :original_uri => orig_uri, :anonymized_uri => uri)
end
@@ -144,14 +144,14 @@ RSpec.describe Bundler::Fetcher do
describe "include CI information" do
it "from one CI" do
with_env_vars("JENKINS_URL" => "foo") do
- ci_part = fetcher.user_agent.split(" ").find {|x| x.match(%r{\Aci/}) }
+ ci_part = fetcher.user_agent.split(" ").find {|x| x.start_with?("ci/") }
expect(ci_part).to match("jenkins")
end
end
it "from many CI" do
with_env_vars("TRAVIS" => "foo", "CI_NAME" => "my_ci") do
- ci_part = fetcher.user_agent.split(" ").find {|x| x.match(%r{\Aci/}) }
+ ci_part = fetcher.user_agent.split(" ").find {|x| x.start_with?("ci/") }
expect(ci_part).to match("travis")
expect(ci_part).to match("my_ci")
end
diff --git a/spec/bundler/bundler/friendly_errors_spec.rb b/spec/bundler/bundler/friendly_errors_spec.rb
index 47e7a5d3cd..e9189b0514 100644
--- a/spec/bundler/bundler/friendly_errors_spec.rb
+++ b/spec/bundler/bundler/friendly_errors_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe Bundler, "friendly errors" do
gem "rack"
G
- bundle :install, :env => { "DEBUG" => true }
+ bundle :install, :env => { "DEBUG" => "true" }
expect(err).to include("Failed to load #{home(".gemrc")}")
expect(exitstatus).to eq(0) if exitstatus
diff --git a/spec/bundler/bundler/mirror_spec.rb b/spec/bundler/bundler/mirror_spec.rb
index 76b697c4d2..4a8a0c7c48 100644
--- a/spec/bundler/bundler/mirror_spec.rb
+++ b/spec/bundler/bundler/mirror_spec.rb
@@ -36,12 +36,12 @@ RSpec.describe Bundler::Settings::Mirror do
it "takes a string for the uri but returns an uri object" do
mirror.uri = "http://localhost:9292"
- expect(mirror.uri).to eq(URI("http://localhost:9292"))
+ expect(mirror.uri).to eq(Bundler::URI("http://localhost:9292"))
end
it "takes an uri object for the uri" do
- mirror.uri = URI("http://localhost:9293")
- expect(mirror.uri).to eq(URI("http://localhost:9293"))
+ mirror.uri = Bundler::URI("http://localhost:9293")
+ expect(mirror.uri).to eq(Bundler::URI("http://localhost:9293"))
end
context "without a uri" do
@@ -145,7 +145,7 @@ RSpec.describe Bundler::Settings::Mirror do
end
RSpec.describe Bundler::Settings::Mirrors do
- let(:localhost_uri) { URI("http://localhost:9292") }
+ let(:localhost_uri) { Bundler::URI("http://localhost:9292") }
context "with a just created mirror" do
let(:mirrors) do
@@ -260,7 +260,7 @@ RSpec.describe Bundler::Settings::Mirrors do
before { mirrors.parse("mirror.all.fallback_timeout", "true") }
it "returns the source uri, not localhost" do
- expect(mirrors.for("http://whatever.com").uri).to eq(URI("http://whatever.com/"))
+ expect(mirrors.for("http://whatever.com").uri).to eq(Bundler::URI("http://whatever.com/"))
end
end
end
@@ -270,7 +270,7 @@ RSpec.describe Bundler::Settings::Mirrors do
context "without a fallback timeout" do
it "returns the uri that is not mirrored" do
- expect(mirrors.for("http://whatever.com").uri).to eq(URI("http://whatever.com/"))
+ expect(mirrors.for("http://whatever.com").uri).to eq(Bundler::URI("http://whatever.com/"))
end
it "returns localhost for rubygems.org" do
@@ -282,11 +282,11 @@ RSpec.describe Bundler::Settings::Mirrors do
before { mirrors.parse("mirror.http://rubygems.org/.fallback_timeout", "true") }
it "returns the uri that is not mirrored" do
- expect(mirrors.for("http://whatever.com").uri).to eq(URI("http://whatever.com/"))
+ expect(mirrors.for("http://whatever.com").uri).to eq(Bundler::URI("http://whatever.com/"))
end
it "returns rubygems.org for rubygems.org" do
- expect(mirrors.for("http://rubygems.org/").uri).to eq(URI("http://rubygems.org/"))
+ expect(mirrors.for("http://rubygems.org/").uri).to eq(Bundler::URI("http://rubygems.org/"))
end
end
end
diff --git a/spec/bundler/bundler/rubygems_integration_spec.rb b/spec/bundler/bundler/rubygems_integration_spec.rb
index 26cbaa630b..11fa2f4e0d 100644
--- a/spec/bundler/bundler/rubygems_integration_spec.rb
+++ b/spec/bundler/bundler/rubygems_integration_spec.rb
@@ -44,7 +44,7 @@ RSpec.describe Bundler::RubygemsIntegration do
describe "#download_gem" do
let(:bundler_retry) { double(Bundler::Retry) }
let(:retry) { double("Bundler::Retry") }
- let(:uri) { URI.parse("https://foo.bar") }
+ let(:uri) { Bundler::URI.parse("https://foo.bar") }
let(:path) { Gem.path.first }
let(:spec) do
spec = Bundler::RemoteSpecification.new("Foo", Gem::Version.new("2.5.2"),
@@ -67,13 +67,13 @@ RSpec.describe Bundler::RubygemsIntegration do
end
describe "#fetch_all_remote_specs" do
- let(:uri) { URI("https://example.com") }
+ let(:uri) { "https://example.com" }
let(:fetcher) { double("gem_remote_fetcher") }
let(:specs_response) { Marshal.dump(["specs"]) }
let(:prerelease_specs_response) { Marshal.dump(["prerelease_specs"]) }
context "when a rubygems source mirror is set" do
- let(:orig_uri) { URI("http://zombo.com") }
+ let(:orig_uri) { Bundler::URI("http://zombo.com") }
let(:remote_with_mirror) { double("remote", :uri => uri, :original_uri => orig_uri) }
it "sets the 'X-Gemfile-Source' header containing the original source" do
diff --git a/spec/bundler/bundler/settings_spec.rb b/spec/bundler/bundler/settings_spec.rb
index 2a285fdcf3..b83d768477 100644
--- a/spec/bundler/bundler/settings_spec.rb
+++ b/spec/bundler/bundler/settings_spec.rb
@@ -180,7 +180,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow
end
describe "#mirror_for" do
- let(:uri) { URI("https://rubygems.org/") }
+ let(:uri) { Bundler::URI("https://rubygems.org/") }
context "with no configured mirror" do
it "returns the original URI" do
@@ -193,7 +193,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow
end
context "with a configured mirror" do
- let(:mirror_uri) { URI("https://rubygems-mirror.org/") }
+ let(:mirror_uri) { Bundler::URI("https://rubygems-mirror.org/") }
before { settings.set_local "mirror.https://rubygems.org/", mirror_uri.to_s }
@@ -214,7 +214,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow
end
context "with a file URI" do
- let(:mirror_uri) { URI("file:/foo/BAR/baz/qUx/") }
+ let(:mirror_uri) { Bundler::URI("file:/foo/BAR/baz/qUx/") }
it "returns the mirror URI" do
expect(settings.mirror_for(uri)).to eq(mirror_uri)
@@ -232,7 +232,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow
end
describe "#credentials_for" do
- let(:uri) { URI("https://gemserver.example.org/") }
+ let(:uri) { Bundler::URI("https://gemserver.example.org/") }
let(:credentials) { "username:password" }
context "with no configured credentials" do
@@ -292,7 +292,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow
it "reads older keys without trailing slashes" do
settings.set_local "mirror.https://rubygems.org", "http://rubygems-mirror.org"
expect(settings.mirror_for("https://rubygems.org/")).to eq(
- URI("http://rubygems-mirror.org/")
+ Bundler::URI("http://rubygems-mirror.org/")
)
end
diff --git a/spec/bundler/bundler/source/rubygems/remote_spec.rb b/spec/bundler/bundler/source/rubygems/remote_spec.rb
index 52fb4e7f1c..07ce4f968e 100644
--- a/spec/bundler/bundler/source/rubygems/remote_spec.rb
+++ b/spec/bundler/bundler/source/rubygems/remote_spec.rb
@@ -11,8 +11,8 @@ RSpec.describe Bundler::Source::Rubygems::Remote do
allow(Digest(:MD5)).to receive(:hexdigest).with(duck_type(:to_s)) {|string| "MD5HEX(#{string})" }
end
- let(:uri_no_auth) { URI("https://gems.example.com") }
- let(:uri_with_auth) { URI("https://#{credentials}@gems.example.com") }
+ let(:uri_no_auth) { Bundler::URI("https://gems.example.com") }
+ let(:uri_with_auth) { Bundler::URI("https://#{credentials}@gems.example.com") }
let(:credentials) { "username:password" }
context "when the original URI has no credentials" do
@@ -89,11 +89,11 @@ RSpec.describe Bundler::Source::Rubygems::Remote do
end
context "when the original URI has only a username" do
- let(:uri) { URI("https://SeCrEt-ToKeN@gem.fury.io/me/") }
+ let(:uri) { Bundler::URI("https://SeCrEt-ToKeN@gem.fury.io/me/") }
describe "#anonymized_uri" do
it "returns the URI without username and password" do
- expect(remote(uri).anonymized_uri).to eq(URI("https://gem.fury.io/me/"))
+ expect(remote(uri).anonymized_uri).to eq(Bundler::URI("https://gem.fury.io/me/"))
end
end
@@ -105,9 +105,9 @@ RSpec.describe Bundler::Source::Rubygems::Remote do
end
context "when a mirror with inline credentials is configured for the URI" do
- let(:uri) { URI("https://rubygems.org/") }
- let(:mirror_uri_with_auth) { URI("https://username:password@rubygems-mirror.org/") }
- let(:mirror_uri_no_auth) { URI("https://rubygems-mirror.org/") }
+ let(:uri) { Bundler::URI("https://rubygems.org/") }
+ let(:mirror_uri_with_auth) { Bundler::URI("https://username:password@rubygems-mirror.org/") }
+ let(:mirror_uri_no_auth) { Bundler::URI("https://rubygems-mirror.org/") }
before { Bundler.settings.temporary("mirror.https://rubygems.org/" => mirror_uri_with_auth.to_s) }
@@ -131,9 +131,9 @@ RSpec.describe Bundler::Source::Rubygems::Remote do
end
context "when a mirror with configured credentials is configured for the URI" do
- let(:uri) { URI("https://rubygems.org/") }
- let(:mirror_uri_with_auth) { URI("https://#{credentials}@rubygems-mirror.org/") }
- let(:mirror_uri_no_auth) { URI("https://rubygems-mirror.org/") }
+ let(:uri) { Bundler::URI("https://rubygems.org/") }
+ let(:mirror_uri_with_auth) { Bundler::URI("https://#{credentials}@rubygems-mirror.org/") }
+ let(:mirror_uri_no_auth) { Bundler::URI("https://rubygems-mirror.org/") }
before do
Bundler.settings.temporary("mirror.https://rubygems.org/" => mirror_uri_no_auth.to_s)
diff --git a/spec/bundler/bundler/source_list_spec.rb b/spec/bundler/bundler/source_list_spec.rb
index a78b80ec3b..93159998c6 100644
--- a/spec/bundler/bundler/source_list_spec.rb
+++ b/spec/bundler/bundler/source_list_spec.rb
@@ -125,8 +125,8 @@ RSpec.describe Bundler::SourceList do
it "adds the provided remote to the beginning of the aggregate source" do
source_list.add_rubygems_remote("https://othersource.org")
expect(returned_source.remotes).to eq [
- URI("https://othersource.org/"),
- URI("https://rubygems.org/"),
+ Bundler::URI("https://othersource.org/"),
+ Bundler::URI("https://rubygems.org/"),
]
end
end
diff --git a/spec/bundler/bundler/uri_credentials_filter_spec.rb b/spec/bundler/bundler/uri_credentials_filter_spec.rb
index fe52d16306..466c1b8594 100644
--- a/spec/bundler/bundler/uri_credentials_filter_spec.rb
+++ b/spec/bundler/bundler/uri_credentials_filter_spec.rb
@@ -16,7 +16,7 @@ RSpec.describe Bundler::URICredentialsFilter do
let(:credentials) { "oauth_token:x-oauth-basic@" }
it "returns the uri without the oauth token" do
- expect(subject.credential_filtered_uri(uri).to_s).to eq(URI("https://x-oauth-basic@github.com/company/private-repo").to_s)
+ expect(subject.credential_filtered_uri(uri).to_s).to eq(Bundler::URI("https://x-oauth-basic@github.com/company/private-repo").to_s)
end
it_behaves_like "original type of uri is maintained"
@@ -26,7 +26,7 @@ RSpec.describe Bundler::URICredentialsFilter do
let(:credentials) { "oauth_token:x@" }
it "returns the uri without the oauth token" do
- expect(subject.credential_filtered_uri(uri).to_s).to eq(URI("https://x@github.com/company/private-repo").to_s)
+ expect(subject.credential_filtered_uri(uri).to_s).to eq(Bundler::URI("https://x@github.com/company/private-repo").to_s)
end
it_behaves_like "original type of uri is maintained"
@@ -37,7 +37,7 @@ RSpec.describe Bundler::URICredentialsFilter do
let(:credentials) { "username1:hunter3@" }
it "returns the uri without the password" do
- expect(subject.credential_filtered_uri(uri).to_s).to eq(URI("https://username1@github.com/company/private-repo").to_s)
+ expect(subject.credential_filtered_uri(uri).to_s).to eq(Bundler::URI("https://username1@github.com/company/private-repo").to_s)
end
it_behaves_like "original type of uri is maintained"
@@ -55,7 +55,7 @@ RSpec.describe Bundler::URICredentialsFilter do
end
context "uri is a uri object" do
- let(:uri) { URI("https://#{credentials}github.com/company/private-repo") }
+ let(:uri) { Bundler::URI("https://#{credentials}github.com/company/private-repo") }
it_behaves_like "sensitive credentials in uri are filtered out"
end
@@ -90,7 +90,7 @@ RSpec.describe Bundler::URICredentialsFilter do
describe "#credential_filtered_string" do
let(:str_to_filter) { "This is a git message containing a uri #{uri}!" }
let(:credentials) { "" }
- let(:uri) { URI("https://#{credentials}github.com/company/private-repo") }
+ let(:uri) { Bundler::URI("https://#{credentials}github.com/company/private-repo") }
context "with a uri that contains credentials" do
let(:credentials) { "oauth_token:x-oauth-basic@" }
diff --git a/spec/bundler/bundler/vendored_persistent_spec.rb b/spec/bundler/bundler/vendored_persistent_spec.rb
index b4d68c2ea0..3ed899dbcf 100644
--- a/spec/bundler/bundler/vendored_persistent_spec.rb
+++ b/spec/bundler/bundler/vendored_persistent_spec.rb
@@ -23,14 +23,14 @@ RSpec.describe Bundler::PersistentHTTP do
shared_examples_for "does not warn" do
it "does not warn" do
allow(Bundler.ui).to receive(:warn).never
- subject.warn_old_tls_version_rubygems_connection(URI(uri), connection)
+ subject.warn_old_tls_version_rubygems_connection(Bundler::URI(uri), connection)
end
end
shared_examples_for "does warn" do |*expected|
it "warns" do
expect(Bundler.ui).to receive(:warn).with(*expected)
- subject.warn_old_tls_version_rubygems_connection(URI(uri), connection)
+ subject.warn_old_tls_version_rubygems_connection(Bundler::URI(uri), connection)
end
end