aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/helper.rb4
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb2
-rw-r--r--test/rubygems/test_gem_local_remote_options.rb12
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb26
-rw-r--r--test/rubygems/test_gem_request.rb32
-rw-r--r--test/rubygems/test_gem_request_connection_pools.rb14
-rw-r--r--test/rubygems/test_gem_resolver.rb2
-rw-r--r--test/rubygems/test_gem_resolver_api_set.rb18
-rw-r--r--test/rubygems/test_gem_resolver_api_specification.rb4
-rw-r--r--test/rubygems/test_gem_resolver_best_set.rb6
-rw-r--r--test/rubygems/test_gem_source.rb10
-rw-r--r--test/rubygems/test_gem_source_git.rb2
-rw-r--r--test/rubygems/test_gem_source_list.rb4
-rw-r--r--test/rubygems/test_gem_source_lock.rb2
-rw-r--r--test/rubygems/test_gem_source_subpath_problem.rb2
-rw-r--r--test/rubygems/test_gem_spec_fetcher.rb2
-rw-r--r--test/rubygems/test_webauthn_listener.rb20
-rw-r--r--test/rubygems/utilities.rb12
18 files changed, 87 insertions, 87 deletions
diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb
index e6774ded38..f830523586 100644
--- a/test/rubygems/helper.rb
+++ b/test/rubygems/helper.rb
@@ -17,7 +17,7 @@ require "pp"
require "rubygems/package"
require "shellwords"
require "tmpdir"
-require "uri"
+require "rubygems/vendor/uri/lib/uri"
require "zlib"
require "benchmark" # stdlib
require_relative "mock_gem_ui"
@@ -395,7 +395,7 @@ class Gem::TestCase < Test::Unit::TestCase
Gem::RemoteFetcher.fetcher = Gem::FakeFetcher.new
@gem_repo = "http://gems.example.com/"
- @uri = URI.parse @gem_repo
+ @uri = Gem::URI.parse @gem_repo
Gem.sources.replace [@gem_repo]
Gem.searcher = nil
diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb
index 3740e523c5..8999723ba1 100644
--- a/test/rubygems/test_gem_dependency_installer.rb
+++ b/test/rubygems/test_gem_dependency_installer.rb
@@ -489,7 +489,7 @@ class TestGemDependencyInstaller < Gem::TestCase
# compact index is available
compact_index_response = Gem::Net::HTTPResponse.new "1.1", 200, "OK"
- compact_index_response.uri = URI("http://gems.example.com")
+ compact_index_response.uri = Gem::URI("http://gems.example.com")
@fetcher.data["http://gems.example.com/"] = compact_index_response
# but private local gem not present there
diff --git a/test/rubygems/test_gem_local_remote_options.rb b/test/rubygems/test_gem_local_remote_options.rb
index b84e70e8b8..cea9cde82b 100644
--- a/test/rubygems/test_gem_local_remote_options.rb
+++ b/test/rubygems/test_gem_local_remote_options.rb
@@ -34,7 +34,7 @@ class TestGemLocalRemoteOptions < Gem::TestCase
def test_clear_sources_option
@cmd.add_local_remote_options
- s = URI.parse "http://only-gems.example.com/"
+ s = Gem::URI.parse "http://only-gems.example.com/"
@cmd.handle_options %W[--clear-sources --source #{s}]
assert_equal [s.to_s], Gem.sources
@@ -76,10 +76,10 @@ class TestGemLocalRemoteOptions < Gem::TestCase
def test_source_option
@cmd.add_source_option
- s1 = URI.parse "http://more-gems.example.com/"
- s2 = URI.parse "http://even-more-gems.example.com/"
- s3 = URI.parse "http://other-gems.example.com/some_subdir"
- s4 = URI.parse "http://more-gems.example.com/" # Intentional duplicate
+ s1 = Gem::URI.parse "http://more-gems.example.com/"
+ s2 = Gem::URI.parse "http://even-more-gems.example.com/"
+ s3 = Gem::URI.parse "http://other-gems.example.com/some_subdir"
+ s4 = Gem::URI.parse "http://more-gems.example.com/" # Intentional duplicate
original_sources = Gem.sources.dup
@@ -97,7 +97,7 @@ class TestGemLocalRemoteOptions < Gem::TestCase
original_sources = Gem.sources.dup
- source = URI.parse "http://more-gems.example.com/"
+ source = Gem::URI.parse "http://more-gems.example.com/"
@cmd.handle_options %W[-s #{source}]
original_sources << source
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index 42565b0b16..da1d4f818c 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -162,7 +162,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
def test_cache_update_path
- uri = URI "http://example/file"
+ uri = Gem::URI "http://example/file"
path = File.join @tempdir, "file"
fetcher = util_fuck_with_fetcher "hello"
@@ -176,7 +176,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_cache_update_path_with_utf8_internal_encoding
with_internal_encoding("UTF-8") do
- uri = URI "http://example/file"
+ uri = Gem::URI "http://example/file"
path = File.join @tempdir, "file"
data = String.new("\xC8").force_encoding(Encoding::BINARY)
@@ -190,7 +190,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
def test_cache_update_path_no_update
- uri = URI "http://example/file"
+ uri = Gem::URI "http://example/file"
path = File.join @tempdir, "file"
fetcher = util_fuck_with_fetcher "hello"
@@ -613,7 +613,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
nil
end
- assert_nil fetcher.fetch_path(URI.parse(@gem_repo), Time.at(0))
+ assert_nil fetcher.fetch_path(Gem::URI.parse(@gem_repo), Time.at(0))
end
def test_implicit_no_proxy
@@ -671,7 +671,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
res
end
- data = fetcher.fetch_http URI.parse(url)
+ data = fetcher.fetch_http Gem::URI.parse(url)
assert_equal "real_path", data
end
@@ -689,7 +689,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
e = assert_raise Gem::RemoteFetcher::FetchError do
- fetcher.fetch_http URI.parse(url)
+ fetcher.fetch_http Gem::URI.parse(url)
end
assert_equal "too many redirects (#{url})", e.message
@@ -706,7 +706,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
e = assert_raise Gem::RemoteFetcher::FetchError do
- fetcher.fetch_http URI.parse(url)
+ fetcher.fetch_http Gem::URI.parse(url)
end
assert_equal "redirecting but no redirect location was given (#{url})", e.message
@@ -714,7 +714,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_http_with_additional_headers
ENV["http_proxy"] = @proxy_uri
- ENV["no_proxy"] = URI.parse(@server_uri).host
+ ENV["no_proxy"] = Gem::URI.parse(@server_uri).host
fetcher = Gem::RemoteFetcher.new nil, nil, { "X-Captain" => "murphy" }
@fetcher = fetcher
assert_equal "murphy", fetcher.fetch_path(@server_uri)
@@ -747,7 +747,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
s3_uri_signer
end
- data = fetcher.fetch_s3 URI.parse(url)
+ data = fetcher.fetch_s3 Gem::URI.parse(url)
assert_equal "https://my-bucket.s3.#{region}.amazonaws.com/gems/specs.4.8.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=testuser%2F20190624%2F#{region}%2Fs3%2Faws4_request&X-Amz-Date=20190624T050641Z&X-Amz-Expires=86400#{token ? "&X-Amz-Security-Token=" + token : ""}&X-Amz-SignedHeaders=host&X-Amz-Signature=#{signature}", $fetched_uri.to_s
assert_equal "success", data
@@ -893,7 +893,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
@fetcher = fetcher
e = assert_raise Gem::RemoteFetcher::FetchError do
- fetcher.fetch_s3 URI.parse(url)
+ fetcher.fetch_s3 Gem::URI.parse(url)
end
assert_match expected_message, e.message
@@ -936,7 +936,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_observe_no_proxy_env_single_host
use_ui @stub_ui do
ENV["http_proxy"] = @proxy_uri
- ENV["no_proxy"] = URI.parse(@server_uri).host
+ ENV["no_proxy"] = Gem::URI.parse(@server_uri).host
fetcher = Gem::RemoteFetcher.new nil
@fetcher = fetcher
assert_data_from_server fetcher.fetch_path(@server_uri)
@@ -946,7 +946,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_observe_no_proxy_env_list
use_ui @stub_ui do
ENV["http_proxy"] = @proxy_uri
- ENV["no_proxy"] = "fakeurl.com, #{URI.parse(@server_uri).host}"
+ ENV["no_proxy"] = "fakeurl.com, #{Gem::URI.parse(@server_uri).host}"
fetcher = Gem::RemoteFetcher.new nil
@fetcher = fetcher
assert_data_from_server fetcher.fetch_path(@server_uri)
@@ -958,7 +958,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
@fetcher = fetcher
assert_throws :block_called do
- fetcher.request URI("http://example"), Gem::Net::HTTP::Get do |req|
+ fetcher.request Gem::URI("http://example"), Gem::Net::HTTP::Get do |req|
assert_kind_of Gem::Net::HTTPGenericRequest, req
throw :block_called
end
diff --git a/test/rubygems/test_gem_request.rb b/test/rubygems/test_gem_request.rb
index d5eb245352..5e9b264dac 100644
--- a/test/rubygems/test_gem_request.rb
+++ b/test/rubygems/test_gem_request.rb
@@ -34,7 +34,7 @@ class TestGemRequest < Gem::TestCase
super
@proxy_uri = "http://localhost:1234"
- @uri = URI("http://example")
+ @uri = Gem::URI("http://example")
@request = make_request @uri, nil, nil, nil
end
@@ -56,7 +56,7 @@ class TestGemRequest < Gem::TestCase
def test_initialize_proxy_URI
proxy_uri = "http://proxy.example.com"
- request = make_request @uri, nil, nil, URI(proxy_uri)
+ request = make_request @uri, nil, nil, Gem::URI(proxy_uri)
assert_equal proxy_uri, request.proxy_uri.to_s
end
@@ -77,18 +77,18 @@ class TestGemRequest < Gem::TestCase
def test_initialize_proxy_ENV_https
ENV["https_proxy"] = @proxy_uri
- request = make_request URI("https://example"), nil, nil, nil
+ request = make_request Gem::URI("https://example"), nil, nil, nil
proxy = request.proxy_uri
- assert_equal URI(@proxy_uri), proxy
+ assert_equal Gem::URI(@proxy_uri), proxy
end
def test_proxy_ENV
ENV["http_proxy"] = "http://proxy"
ENV["https_proxy"] = ""
- request = make_request URI("https://example"), nil, nil, nil
+ request = make_request Gem::URI("https://example"), nil, nil, nil
proxy = request.proxy_uri
@@ -102,7 +102,7 @@ class TestGemRequest < Gem::TestCase
def self.get_cert_files
[TestGemRequest::PUBLIC_CERT_FILE]
end
- end.create_with_proxy URI("https://example"), nil, nil, nil
+ end.create_with_proxy Gem::URI("https://example"), nil, nil, nil
Gem::Request.configure_connection_for_https connection, request.cert_files
@@ -121,7 +121,7 @@ class TestGemRequest < Gem::TestCase
def self.get_cert_files
[TestGemRequest::PUBLIC_CERT_FILE]
end
- end.create_with_proxy URI("https://example"), nil, nil, nil
+ end.create_with_proxy Gem::URI("https://example"), nil, nil, nil
Gem::Request.configure_connection_for_https connection, request.cert_files
@@ -138,17 +138,17 @@ class TestGemRequest < Gem::TestCase
request = make_request @uri, nil, nil, nil
proxy = request.proxy_uri
- assert_equal URI(@proxy_uri), proxy
+ assert_equal Gem::URI(@proxy_uri), proxy
end
def test_get_proxy_from_env_https
ENV["https_proxy"] = @proxy_uri
- uri = URI("https://example")
+ uri = Gem::URI("https://example")
request = make_request uri, nil, nil, nil
proxy = request.proxy_uri
- assert_equal URI(@proxy_uri), proxy
+ assert_equal Gem::URI(@proxy_uri), proxy
end
def test_get_proxy_from_env_domain
@@ -191,7 +191,7 @@ class TestGemRequest < Gem::TestCase
end
def test_fetch
- uri = Gem::Uri.new(URI.parse("#{@gem_repo}/specs.#{Gem.marshal_version}"))
+ uri = Gem::Uri.new(Gem::URI.parse("#{@gem_repo}/specs.#{Gem.marshal_version}"))
response = util_stub_net_http(body: :junk, code: 200) do
@request = make_request(uri, Gem::Net::HTTP::Get, nil, nil)
@@ -204,7 +204,7 @@ class TestGemRequest < Gem::TestCase
def test_fetch_basic_auth
Gem.configuration.verbose = :really
- uri = Gem::Uri.new(URI.parse("https://user:pass@example.rubygems/specs.#{Gem.marshal_version}"))
+ uri = Gem::Uri.new(Gem::URI.parse("https://user:pass@example.rubygems/specs.#{Gem.marshal_version}"))
conn = util_stub_net_http(body: :junk, code: 200) do |c|
use_ui @ui do
@request = make_request(uri, Gem::Net::HTTP::Get, nil, nil)
@@ -220,7 +220,7 @@ class TestGemRequest < Gem::TestCase
def test_fetch_basic_auth_encoded
Gem.configuration.verbose = :really
- uri = Gem::Uri.new(URI.parse("https://user:%7BDEScede%7Dpass@example.rubygems/specs.#{Gem.marshal_version}"))
+ uri = Gem::Uri.new(Gem::URI.parse("https://user:%7BDEScede%7Dpass@example.rubygems/specs.#{Gem.marshal_version}"))
conn = util_stub_net_http(body: :junk, code: 200) do |c|
use_ui @ui do
@@ -237,7 +237,7 @@ class TestGemRequest < Gem::TestCase
def test_fetch_basic_oauth_encoded
Gem.configuration.verbose = :really
- uri = Gem::Uri.new(URI.parse("https://%7BDEScede%7Dpass:x-oauth-basic@example.rubygems/specs.#{Gem.marshal_version}"))
+ uri = Gem::Uri.new(Gem::URI.parse("https://%7BDEScede%7Dpass:x-oauth-basic@example.rubygems/specs.#{Gem.marshal_version}"))
conn = util_stub_net_http(body: :junk, code: 200) do |c|
use_ui @ui do
@@ -253,7 +253,7 @@ class TestGemRequest < Gem::TestCase
end
def test_fetch_head
- uri = Gem::Uri.new(URI.parse("#{@gem_repo}/specs.#{Gem.marshal_version}"))
+ uri = Gem::Uri.new(Gem::URI.parse("#{@gem_repo}/specs.#{Gem.marshal_version}"))
response = util_stub_net_http(body: "", code: 200) do |_conn|
@request = make_request(uri, Gem::Net::HTTP::Get, nil, nil)
@request.fetch
@@ -264,7 +264,7 @@ class TestGemRequest < Gem::TestCase
end
def test_fetch_unmodified
- uri = Gem::Uri.new(URI.parse("#{@gem_repo}/specs.#{Gem.marshal_version}"))
+ uri = Gem::Uri.new(Gem::URI.parse("#{@gem_repo}/specs.#{Gem.marshal_version}"))
t = Time.utc(2013, 1, 2, 3, 4, 5)
conn, response = util_stub_net_http(body: "", code: 304) do |c|
@request = make_request(uri, Gem::Net::HTTP::Get, t, nil)
diff --git a/test/rubygems/test_gem_request_connection_pools.rb b/test/rubygems/test_gem_request_connection_pools.rb
index 4e1e7de07b..7a814d3acb 100644
--- a/test/rubygems/test_gem_request_connection_pools.rb
+++ b/test/rubygems/test_gem_request_connection_pools.rb
@@ -18,7 +18,7 @@ class TestGemRequestConnectionPool < Gem::TestCase
@old_client = Gem::Request::ConnectionPools.client
Gem::Request::ConnectionPools.client = FakeHttp
- @proxy = URI "http://proxy.example"
+ @proxy = Gem::URI "http://proxy.example"
end
def teardown
@@ -49,7 +49,7 @@ class TestGemRequestConnectionPool < Gem::TestCase
end
def test_checkout_same_connection
- uri = URI.parse("http://example/some_endpoint")
+ uri = Gem::URI.parse("http://example/some_endpoint")
pools = Gem::Request::ConnectionPools.new nil, []
pool = pools.pool_for uri
@@ -99,7 +99,7 @@ class TestGemRequestConnectionPool < Gem::TestCase
def test_net_http_args
pools = Gem::Request::ConnectionPools.new nil, []
- net_http_args = pools.send :net_http_args, URI("http://example"), nil
+ net_http_args = pools.send :net_http_args, Gem::URI("http://example"), nil
assert_equal ["example", 80], net_http_args
end
@@ -107,7 +107,7 @@ class TestGemRequestConnectionPool < Gem::TestCase
def test_net_http_args_ipv6
pools = Gem::Request::ConnectionPools.new nil, []
- net_http_args = pools.send :net_http_args, URI("http://[::1]"), nil
+ net_http_args = pools.send :net_http_args, Gem::URI("http://[::1]"), nil
assert_equal ["::1", 80], net_http_args
end
@@ -115,7 +115,7 @@ class TestGemRequestConnectionPool < Gem::TestCase
def test_net_http_args_proxy
pools = Gem::Request::ConnectionPools.new nil, []
- net_http_args = pools.send :net_http_args, URI("http://example"), @proxy
+ net_http_args = pools.send :net_http_args, Gem::URI("http://example"), @proxy
assert_equal ["example", 80, "proxy.example", 80, nil, nil], net_http_args
end
@@ -126,7 +126,7 @@ class TestGemRequestConnectionPool < Gem::TestCase
pools = Gem::Request::ConnectionPools.new nil, []
- net_http_args = pools.send :net_http_args, URI("http://example"), @proxy
+ net_http_args = pools.send :net_http_args, Gem::URI("http://example"), @proxy
assert_equal ["example", 80, nil, nil], net_http_args
ensure
@@ -134,7 +134,7 @@ class TestGemRequestConnectionPool < Gem::TestCase
end
def test_thread_waits_for_connection
- uri = URI.parse("http://example/some_endpoint")
+ uri = Gem::URI.parse("http://example/some_endpoint")
pools = Gem::Request::ConnectionPools.new nil, []
pool = pools.pool_for uri
diff --git a/test/rubygems/test_gem_resolver.rb b/test/rubygems/test_gem_resolver.rb
index c2bdc5332c..b7dadda708 100644
--- a/test/rubygems/test_gem_resolver.rb
+++ b/test/rubygems/test_gem_resolver.rb
@@ -8,7 +8,7 @@ class TestGemResolver < Gem::TestCase
end
def set(*specs)
- source = Gem::Source.new URI @gem_repo
+ source = Gem::Source.new Gem::URI @gem_repo
specs = specs.map do |spec|
Gem::Resolver::SpecSpecification.new nil, spec, source
diff --git a/test/rubygems/test_gem_resolver_api_set.rb b/test/rubygems/test_gem_resolver_api_set.rb
index c0c6d82f19..5781cf37d2 100644
--- a/test/rubygems/test_gem_resolver_api_set.rb
+++ b/test/rubygems/test_gem_resolver_api_set.rb
@@ -6,30 +6,30 @@ class TestGemResolverAPISet < Gem::TestCase
def setup
super
- @dep_uri = URI "#{@gem_repo}info/"
+ @dep_uri = Gem::URI "#{@gem_repo}info/"
end
def test_initialize
set = Gem::Resolver::APISet.new
- assert_equal URI("https://index.rubygems.org/info/"), set.dep_uri
- assert_equal URI("https://index.rubygems.org/"), set.uri
- assert_equal Gem::Source.new(URI("https://index.rubygems.org")), set.source
+ assert_equal Gem::URI("https://index.rubygems.org/info/"), set.dep_uri
+ assert_equal Gem::URI("https://index.rubygems.org/"), set.uri
+ assert_equal Gem::Source.new(Gem::URI("https://index.rubygems.org")), set.source
end
def test_initialize_deeper_uri
set = Gem::Resolver::APISet.new "https://rubygemsserver.com/mygems/info"
- assert_equal URI("https://rubygemsserver.com/mygems/info"), set.dep_uri
- assert_equal URI("https://rubygemsserver.com/"), set.uri
- assert_equal Gem::Source.new(URI("https://rubygemsserver.com/")), set.source
+ assert_equal Gem::URI("https://rubygemsserver.com/mygems/info"), set.dep_uri
+ assert_equal Gem::URI("https://rubygemsserver.com/"), set.uri
+ assert_equal Gem::Source.new(Gem::URI("https://rubygemsserver.com/")), set.source
end
def test_initialize_uri
set = Gem::Resolver::APISet.new @dep_uri
- assert_equal URI("#{@gem_repo}info/"), set.dep_uri
- assert_equal URI(@gem_repo.to_s), set.uri
+ assert_equal Gem::URI("#{@gem_repo}info/"), set.dep_uri
+ assert_equal Gem::URI(@gem_repo.to_s), set.uri
end
def test_find_all
diff --git a/test/rubygems/test_gem_resolver_api_specification.rb b/test/rubygems/test_gem_resolver_api_specification.rb
index 49f3cc81d0..2119d73478 100644
--- a/test/rubygems/test_gem_resolver_api_specification.rb
+++ b/test/rubygems/test_gem_resolver_api_specification.rb
@@ -124,7 +124,7 @@ class TestGemResolverAPISpecification < Gem::TestCase
fetcher.spec "a", 1
end
- dep_uri = URI(@gem_repo) + "info"
+ dep_uri = Gem::URI(@gem_repo) + "info"
set = Gem::Resolver::APISet.new dep_uri
data = {
name: "a",
@@ -148,7 +148,7 @@ class TestGemResolverAPISpecification < Gem::TestCase
end
end
- dep_uri = URI(@gem_repo) + "info"
+ dep_uri = Gem::URI(@gem_repo) + "info"
set = Gem::Resolver::APISet.new dep_uri
data = {
name: "j",
diff --git a/test/rubygems/test_gem_resolver_best_set.rb b/test/rubygems/test_gem_resolver_best_set.rb
index 80aa883364..8a750cdf8f 100644
--- a/test/rubygems/test_gem_resolver_best_set.rb
+++ b/test/rubygems/test_gem_resolver_best_set.rb
@@ -34,7 +34,7 @@ class TestGemResolverBestSet < Gem::TestCase
set = Gem::Resolver::BestSet.new
- api_uri = URI(@gem_repo)
+ api_uri = Gem::URI(@gem_repo)
set.sets << Gem::Resolver::APISet.new(api_uri)
@@ -94,7 +94,7 @@ class TestGemResolverBestSet < Gem::TestCase
def test_replace_failed_api_set
set = Gem::Resolver::BestSet.new
- api_uri = URI(@gem_repo) + "./info/"
+ api_uri = Gem::URI(@gem_repo) + "./info/"
api_set = Gem::Resolver::APISet.new api_uri
set.sets << api_set
@@ -131,7 +131,7 @@ class TestGemResolverBestSet < Gem::TestCase
def test_replace_failed_api_set_uri_with_credentials
set = Gem::Resolver::BestSet.new
- api_uri = URI(@gem_repo) + "./info/"
+ api_uri = Gem::URI(@gem_repo) + "./info/"
api_uri.user = "user"
api_uri.password = "pass"
api_set = Gem::Resolver::APISet.new api_uri
diff --git a/test/rubygems/test_gem_source.rb b/test/rubygems/test_gem_source.rb
index aa26dd07f0..4d445f3437 100644
--- a/test/rubygems/test_gem_source.rb
+++ b/test/rubygems/test_gem_source.rb
@@ -22,7 +22,7 @@ class TestGemSource < Gem::TestCase
end
def test_initialize_invalid_uri
- assert_raise URI::InvalidURIError do
+ assert_raise Gem::URI::InvalidURIError do
Gem::Source.new "git@example:a.git"
end
end
@@ -36,7 +36,7 @@ class TestGemSource < Gem::TestCase
end
def test_cache_dir_escapes_windows_paths
- uri = URI.parse("file:///C:/WINDOWS/Temp/gem_repo")
+ uri = Gem::URI.parse("file:///C:/WINDOWS/Temp/gem_repo")
root = Gem.spec_cache_dir
cache_dir = @source.cache_dir(uri).gsub(root, "")
assert !cache_dir.include?(":"), "#{cache_dir} should not contain a :"
@@ -44,7 +44,7 @@ class TestGemSource < Gem::TestCase
def test_dependency_resolver_set_bundler_api
response = Gem::Net::HTTPResponse.new "1.1", 200, "OK"
- response.uri = URI("http://example")
+ response.uri = Gem::URI("http://example")
@fetcher.data[@gem_repo] = response
@@ -78,7 +78,7 @@ class TestGemSource < Gem::TestCase
spec = @source.fetch_spec tuple("a", Gem::Version.new(1), "ruby")
assert_equal a1.full_name, spec.full_name
- cache_dir = @source.cache_dir URI.parse(spec_uri)
+ cache_dir = @source.cache_dir Gem::URI.parse(spec_uri)
cache_file = File.join cache_dir, a1.spec_name
@@ -91,7 +91,7 @@ class TestGemSource < Gem::TestCase
spec_uri = "#{@gem_repo}/#{Gem::MARSHAL_SPEC_DIR}#{a1.spec_name}"
@fetcher.data["#{spec_uri}.rz"] = nil
- cache_dir = @source.cache_dir URI.parse(spec_uri)
+ cache_dir = @source.cache_dir Gem::URI.parse(spec_uri)
FileUtils.mkdir_p cache_dir
cache_file = File.join cache_dir, a1.spec_name
diff --git a/test/rubygems/test_gem_source_git.rb b/test/rubygems/test_gem_source_git.rb
index 18265bd814..20e750a0d4 100644
--- a/test/rubygems/test_gem_source_git.rb
+++ b/test/rubygems/test_gem_source_git.rb
@@ -289,7 +289,7 @@ class TestGemSourceGit < Gem::TestCase
end
def test_uri
- assert_equal URI(@repository), @source.uri
+ assert_equal Gem::URI(@repository), @source.uri
end
def test_uri_hash
diff --git a/test/rubygems/test_gem_source_list.rb b/test/rubygems/test_gem_source_list.rb
index fc084830ba..64353f8f90 100644
--- a/test/rubygems/test_gem_source_list.rb
+++ b/test/rubygems/test_gem_source_list.rb
@@ -37,7 +37,7 @@ class TestGemSourceList < Gem::TestCase
assert_kind_of Gem::Source, source
- assert_kind_of URI, source.uri
+ assert_kind_of Gem::URI, source.uri
assert_equal source.uri.to_s, @uri
assert_equal [source], sl.sources
@@ -99,7 +99,7 @@ class TestGemSourceList < Gem::TestCase
def test_include_eh
assert @sl.include?(@uri), "string comparison not working"
- assert @sl.include?(URI.parse(@uri)), "uri comparison not working"
+ assert @sl.include?(Gem::URI.parse(@uri)), "uri comparison not working"
end
def test_include_matches_a_source
diff --git a/test/rubygems/test_gem_source_lock.rb b/test/rubygems/test_gem_source_lock.rb
index ece55581ec..91ffee68f2 100644
--- a/test/rubygems/test_gem_source_lock.rb
+++ b/test/rubygems/test_gem_source_lock.rb
@@ -110,6 +110,6 @@ class TestGemSourceLock < Gem::TestCase
remote = Gem::Source.new @gem_repo
lock = Gem::Source::Lock.new remote
- assert_equal URI(@gem_repo), lock.uri
+ assert_equal Gem::URI(@gem_repo), lock.uri
end
end
diff --git a/test/rubygems/test_gem_source_subpath_problem.rb b/test/rubygems/test_gem_source_subpath_problem.rb
index 1ca9b67159..a451a81a25 100644
--- a/test/rubygems/test_gem_source_subpath_problem.rb
+++ b/test/rubygems/test_gem_source_subpath_problem.rb
@@ -22,7 +22,7 @@ class TestGemSourceSubpathProblem < Gem::TestCase
def test_dependency_resolver_set
response = Gem::Net::HTTPResponse.new "1.1", 200, "OK"
- response.uri = URI("http://example")
+ response.uri = Gem::URI("http://example")
@fetcher.data["#{@gem_repo}/"] = response
diff --git a/test/rubygems/test_gem_spec_fetcher.rb b/test/rubygems/test_gem_spec_fetcher.rb
index 0fca9f0c48..cb4a4f7204 100644
--- a/test/rubygems/test_gem_spec_fetcher.rb
+++ b/test/rubygems/test_gem_spec_fetcher.rb
@@ -11,7 +11,7 @@ class TestGemSpecFetcher < Gem::TestCase
def setup
super
- @uri = URI.parse @gem_repo
+ @uri = Gem::URI.parse @gem_repo
@source = Gem::Source.new(@uri)
@sf = Gem::SpecFetcher.new
diff --git a/test/rubygems/test_webauthn_listener.rb b/test/rubygems/test_webauthn_listener.rb
index e3f7c8c395..08edabceb2 100644
--- a/test/rubygems/test_webauthn_listener.rb
+++ b/test/rubygems/test_webauthn_listener.rb
@@ -19,7 +19,7 @@ class WebauthnListenerTest < Gem::TestCase
def test_listener_thread_retreives_otp_code
thread = Gem::GemcutterUtilities::WebauthnListener.listener_thread(Gem.host, @server)
- Gem::MockBrowser.get URI("http://localhost:#{@port}?code=xyz")
+ Gem::MockBrowser.get Gem::URI("http://localhost:#{@port}?code=xyz")
thread.join
assert_equal "xyz", thread[:otp]
@@ -27,7 +27,7 @@ class WebauthnListenerTest < Gem::TestCase
def test_listener_thread_sets_error
thread = Gem::GemcutterUtilities::WebauthnListener.listener_thread(Gem.host, @server)
- Gem::MockBrowser.post URI("http://localhost:#{@port}?code=xyz")
+ Gem::MockBrowser.post Gem::URI("http://localhost:#{@port}?code=xyz")
thread.join
assert_equal "Security device verification failed: Invalid HTTP method POST received.", thread[:error].message
@@ -35,13 +35,13 @@ class WebauthnListenerTest < Gem::TestCase
def test_wait_for_otp_code_get_follows_options
wait_for_otp_code
- assert Gem::MockBrowser.options(URI("http://localhost:#{@port}?code=xyz")).is_a? Gem::Net::HTTPNoContent
- assert Gem::MockBrowser.get(URI("http://localhost:#{@port}?code=xyz")).is_a? Gem::Net::HTTPOK
+ assert Gem::MockBrowser.options(Gem::URI("http://localhost:#{@port}?code=xyz")).is_a? Gem::Net::HTTPNoContent
+ assert Gem::MockBrowser.get(Gem::URI("http://localhost:#{@port}?code=xyz")).is_a? Gem::Net::HTTPOK
end
def test_wait_for_otp_code_options_request
wait_for_otp_code
- response = Gem::MockBrowser.options URI("http://localhost:#{@port}?code=xyz")
+ response = Gem::MockBrowser.options Gem::URI("http://localhost:#{@port}?code=xyz")
assert response.is_a? Gem::Net::HTTPNoContent
assert_equal Gem.host, response["access-control-allow-origin"]
@@ -52,7 +52,7 @@ class WebauthnListenerTest < Gem::TestCase
def test_wait_for_otp_code_get_request
wait_for_otp_code
- response = Gem::MockBrowser.get URI("http://localhost:#{@port}?code=xyz")
+ response = Gem::MockBrowser.get Gem::URI("http://localhost:#{@port}?code=xyz")
assert response.is_a? Gem::Net::HTTPOK
assert_equal "text/plain; charset=utf-8", response["Content-Type"]
@@ -69,7 +69,7 @@ class WebauthnListenerTest < Gem::TestCase
def test_wait_for_otp_code_invalid_post_req_method
wait_for_otp_code_expect_error_with_message("Security device verification failed: Invalid HTTP method POST received.")
- response = Gem::MockBrowser.post URI("http://localhost:#{@port}?code=xyz")
+ response = Gem::MockBrowser.post Gem::URI("http://localhost:#{@port}?code=xyz")
assert response
assert response.is_a? Gem::Net::HTTPMethodNotAllowed
@@ -82,7 +82,7 @@ class WebauthnListenerTest < Gem::TestCase
def test_wait_for_otp_code_incorrect_path
wait_for_otp_code_expect_error_with_message("Security device verification failed: Page at /path not found.")
- response = Gem::MockBrowser.post URI("http://localhost:#{@port}/path?code=xyz")
+ response = Gem::MockBrowser.post Gem::URI("http://localhost:#{@port}/path?code=xyz")
assert response.is_a? Gem::Net::HTTPNotFound
assert_equal "close", response["Connection"]
@@ -93,7 +93,7 @@ class WebauthnListenerTest < Gem::TestCase
def test_wait_for_otp_code_no_params_response
wait_for_otp_code_expect_error_with_message("Security device verification failed: Did not receive OTP from https://rubygems.org.")
- response = Gem::MockBrowser.get URI("http://localhost:#{@port}")
+ response = Gem::MockBrowser.get Gem::URI("http://localhost:#{@port}")
assert response.is_a? Gem::Net::HTTPBadRequest
assert_equal "text/plain; charset=utf-8", response["Content-Type"]
@@ -107,7 +107,7 @@ class WebauthnListenerTest < Gem::TestCase
def test_wait_for_otp_code_incorrect_params
wait_for_otp_code_expect_error_with_message("Security device verification failed: Did not receive OTP from https://rubygems.org.")
- response = Gem::MockBrowser.get URI("http://localhost:#{@port}?param=xyz")
+ response = Gem::MockBrowser.get Gem::URI("http://localhost:#{@port}?param=xyz")
assert response.is_a? Gem::Net::HTTPBadRequest
assert_equal "text/plain; charset=utf-8", response["Content-Type"]
diff --git a/test/rubygems/utilities.rb b/test/rubygems/utilities.rb
index 996b1f3440..357379f88d 100644
--- a/test/rubygems/utilities.rb
+++ b/test/rubygems/utilities.rb
@@ -40,16 +40,16 @@ class Gem::FakeFetcher
end
def find_data(path)
- return Gem.read_binary path.path if URI === path && path.scheme == "file"
+ return Gem.read_binary path.path if Gem::URI === path && path.scheme == "file"
- if URI === path && "URI::#{path.scheme.upcase}" != path.class.name
+ if Gem::URI === path && "Gem::URI::#{path.scheme.upcase}" != path.class.name
raise ArgumentError,
"mismatch for scheme #{path.scheme} and class #{path.class}"
end
path = path.to_s
@paths << path
- raise ArgumentError, "need full URI" unless path.start_with?("https://", "http://")
+ raise ArgumentError, "need full Gem::URI" unless path.start_with?("https://", "http://")
unless @data.key? path
raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path)
@@ -194,7 +194,7 @@ end
# Example:
#
# # Sends a get request to http://localhost:5678
-# Gem::MockBrowser.get URI("http://localhost:5678")
+# Gem::MockBrowser.get Gem::URI("http://localhost:5678")
#
# See RubyGems' tests for more examples of MockBrowser.
#
@@ -368,12 +368,12 @@ class Gem::TestCase::SpecFetcherSetup
begin
gem_repo = @test.gem_repo
@test.gem_repo = @repository
- @test.uri = URI @repository
+ @test.uri = Gem::URI @repository
@test.util_setup_spec_fetcher(*@downloaded)
ensure
@test.gem_repo = gem_repo
- @test.uri = URI gem_repo
+ @test.uri = Gem::URI gem_repo
end
@gems.each do |spec, gem|