diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2024-01-15 20:51:35 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-01-29 12:15:10 +0900 |
commit | f3123f8af2c79d3e40719865fc3700277fe1ae72 (patch) | |
tree | 121a8540d2155879504bad535afc1c415740d022 /spec/bundler/bundler/fetcher | |
parent | d64d0b54231208c7bec899a7fe8c3b98ec2e9a1b (diff) |
[rubygems/rubygems] Use rubygems vendored uri from Bundler when available
https://github.com/rubygems/rubygems/commit/5d6a8f2fb4
Diffstat (limited to 'spec/bundler/bundler/fetcher')
-rw-r--r-- | spec/bundler/bundler/fetcher/base_spec.rb | 6 | ||||
-rw-r--r-- | spec/bundler/bundler/fetcher/compact_index_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/bundler/fetcher/dependency_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/bundler/fetcher/downloader_spec.rb | 28 | ||||
-rw-r--r-- | spec/bundler/bundler/fetcher/index_spec.rb | 2 |
5 files changed, 21 insertions, 21 deletions
diff --git a/spec/bundler/bundler/fetcher/base_spec.rb b/spec/bundler/bundler/fetcher/base_spec.rb index fa1021ecf7..b8c6b57b10 100644 --- a/spec/bundler/bundler/fetcher/base_spec.rb +++ b/spec/bundler/bundler/fetcher/base_spec.rb @@ -37,7 +37,7 @@ RSpec.describe Bundler::Fetcher::Base do end describe "#fetch_uri" do - let(:remote_uri_obj) { Bundler::URI("http://rubygems.org") } + let(:remote_uri_obj) { Gem::URI("http://rubygems.org") } before { allow(subject).to receive(:remote_uri).and_return(remote_uri_obj) } @@ -50,10 +50,10 @@ RSpec.describe Bundler::Fetcher::Base do end context "when the remote uri's host is not rubygems.org" do - let(:remote_uri_obj) { Bundler::URI("http://otherhost.org") } + let(:remote_uri_obj) { Gem::URI("http://otherhost.org") } it "should return the remote uri" do - expect(subject.fetch_uri).to eq(Bundler::URI("http://otherhost.org")) + expect(subject.fetch_uri).to eq(Gem::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 9889d3cede..a988171f34 100644 --- a/spec/bundler/bundler/fetcher/compact_index_spec.rb +++ b/spec/bundler/bundler/fetcher/compact_index_spec.rb @@ -5,7 +5,7 @@ require "bundler/compact_index_client" RSpec.describe Bundler::Fetcher::CompactIndex do let(:downloader) { double(:downloader) } - let(:display_uri) { Bundler::URI("http://sampleuri.com") } + let(:display_uri) { Gem::URI("http://sampleuri.com") } let(:remote) { double(:remote, cache_slug: "lsjdf", uri: display_uri) } let(:gem_remote_fetcher) { nil } let(:compact_index) { described_class.new(downloader, remote, display_uri, gem_remote_fetcher) } diff --git a/spec/bundler/bundler/fetcher/dependency_spec.rb b/spec/bundler/bundler/fetcher/dependency_spec.rb index 262ae39463..c420b7c07f 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: Bundler::URI("http://localhost:5000")) } + let(:remote) { double(:remote, uri: Gem::URI("http://localhost:5000")) } let(:display_uri) { "http://sample_uri.com" } let(:gem_remote_fetcher) { nil } @@ -255,7 +255,7 @@ RSpec.describe Bundler::Fetcher::Dependency do end describe "#dependency_api_uri" do - let(:uri) { Bundler::URI("http://gem-api.com") } + let(:uri) { Gem::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 88a8c174f1..d5c32f4730 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) { Bundler::URI("http://www.uri-to-fetch.com/api/v2/endpoint") } + let(:uri) { Gem::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(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) + expect(subject).to receive(:fetch).with(Gem::URI("http://www.uri-to-fetch.com/api/v2/endpoint"), options, 0).and_call_original + expect(subject).to receive(:fetch).with(Gem::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) { Bundler::URI("ssh://username:password@www.uri-to-fetch.com/api/v2/endpoint") } + let(:uri) { Gem::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(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) + expect(subject).to receive(:fetch).with(Gem::URI("ssh://username:password@www.uri-to-fetch.com/api/v2/endpoint"), options, 0).and_call_original + expect(subject).to receive(:fetch).with(Gem::URI("ssh://username:password@www.uri-to-fetch.com/api/v1/endpoint"), options, 1) subject.fetch(uri, options, counter) end end @@ -89,7 +89,7 @@ RSpec.describe Bundler::Fetcher::Downloader do end context "when the there are credentials provided in the request" do - let(:uri) { Bundler::URI("http://user:password@www.uri-to-fetch.com") } + let(:uri) { Gem::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) }. @@ -100,7 +100,7 @@ RSpec.describe Bundler::Fetcher::Downloader do context "when the request response is a Gem::Net::HTTPForbidden" do let(:http_response) { Gem::Net::HTTPForbidden.new("1.1", 403, "Forbidden") } - let(:uri) { Bundler::URI("http://user:password@www.uri-to-fetch.com") } + let(:uri) { Gem::URI("http://user:password@www.uri-to-fetch.com") } it "should raise a Bundler::Fetcher::AuthenticationForbiddenError with the uri host" do expect { subject.fetch(uri, options, counter) }.to raise_error(Bundler::Fetcher::AuthenticationForbiddenError, @@ -117,7 +117,7 @@ RSpec.describe Bundler::Fetcher::Downloader do end context "when the there are credentials provided in the request" do - let(:uri) { Bundler::URI("http://username:password@www.uri-to-fetch.com/api/v2/endpoint") } + let(:uri) { Gem::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) }. @@ -152,7 +152,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) { Bundler::URI("http://username:password%24@www.uri-to-fetch.com/api/v2/endpoint") } + let(:uri) { Gem::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$") @@ -161,7 +161,7 @@ RSpec.describe Bundler::Fetcher::Downloader do end context "that is all unescaped characters" do - let(:uri) { Bundler::URI("http://username:password@www.uri-to-fetch.com/api/v2/endpoint") } + let(:uri) { Gem::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) @@ -170,7 +170,7 @@ RSpec.describe Bundler::Fetcher::Downloader do end context "and there is no password provided" do - let(:uri) { Bundler::URI("http://username@www.uri-to-fetch.com/api/v2/endpoint") } + let(:uri) { Gem::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) @@ -179,7 +179,7 @@ RSpec.describe Bundler::Fetcher::Downloader do end context "that contains cgi escaped characters" do - let(:uri) { Bundler::URI("http://username%24@www.uri-to-fetch.com/api/v2/endpoint") } + let(:uri) { Gem::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) @@ -230,7 +230,7 @@ RSpec.describe Bundler::Fetcher::Downloader do end context "when the there are credentials provided in the request" do - let(:uri) { Bundler::URI("http://username:password@www.uri-to-fetch.com/api/v2/endpoint") } + let(:uri) { Gem::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 eea0050a6b..dff9ccc3cc 100644 --- a/spec/bundler/bundler/fetcher/index_spec.rb +++ b/spec/bundler/bundler/fetcher/index_spec.rb @@ -20,7 +20,7 @@ RSpec.describe Bundler::Fetcher::Index do end context "error handling" do - let(:remote_uri) { Bundler::URI("http://remote-uri.org") } + let(:remote_uri) { Gem::URI("http://remote-uri.org") } before do allow(rubygems).to receive(:fetch_all_remote_specs) { raise Gem::RemoteFetcher::FetchError.new(error_message, display_uri) } allow(subject).to receive(:remote_uri).and_return(remote_uri) |