From 589377fbdce9d281041535e3bf63f008689bb776 Mon Sep 17 00:00:00 2001 From: Daniel Niknam Date: Sun, 22 Aug 2021 20:06:02 +1000 Subject: [rubygems/rubygems] Refactor `Gem::RemoteFetcher::FetchError.build` back to its initialize method https://github.com/rubygems/rubygems/commit/21dcdd2dc5 --- test/rubygems/test_gem_commands_sources_command.rb | 2 +- test/rubygems/test_gem_remote_fetcher.rb | 2 +- test/rubygems/test_gem_resolver_best_set.rb | 6 +++--- test/rubygems/test_gem_spec_fetcher.rb | 2 +- test/rubygems/test_remote_fetch_error.rb | 6 +++--- test/rubygems/utilities.rb | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb index 6fcbbf657b..7bca0f3803 100644 --- a/test/rubygems/test_gem_commands_sources_command.rb +++ b/test/rubygems/test_gem_commands_sources_command.rb @@ -182,7 +182,7 @@ class TestGemCommandsSourcesCommand < Gem::TestCase uri = "http://beta-gems.example.com/specs.#{@marshal_version}.gz" @fetcher.data[uri] = proc do - raise Gem::RemoteFetcher::FetchError.build('it died', uri) + raise Gem::RemoteFetcher::FetchError.new('it died', uri) end @cmd.handle_options %w[--add http://beta-gems.example.com] diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb index b4c82ce588..5ce420b91a 100644 --- a/test/rubygems/test_gem_remote_fetcher.rb +++ b/test/rubygems/test_gem_remote_fetcher.rb @@ -204,7 +204,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== @test_data end - raise Gem::RemoteFetcher::FetchError.build("haha!", '') + raise Gem::RemoteFetcher::FetchError.new("haha!", '') end end diff --git a/test/rubygems/test_gem_resolver_best_set.rb b/test/rubygems/test_gem_resolver_best_set.rb index a448ec05a4..0e279d16a8 100644 --- a/test/rubygems/test_gem_resolver_best_set.rb +++ b/test/rubygems/test_gem_resolver_best_set.rb @@ -106,7 +106,7 @@ class TestGemResolverBestSet < Gem::TestCase error_uri = api_uri + 'a' - error = Gem::RemoteFetcher::FetchError.build 'bogus', error_uri + error = Gem::RemoteFetcher::FetchError.new 'bogus', error_uri set.replace_failed_api_set error @@ -124,7 +124,7 @@ class TestGemResolverBestSet < Gem::TestCase set.sets << index_set - error = Gem::RemoteFetcher::FetchError.build 'bogus', @gem_repo + error = Gem::RemoteFetcher::FetchError.new 'bogus', @gem_repo e = assert_raise Gem::RemoteFetcher::FetchError do set.replace_failed_api_set error @@ -145,7 +145,7 @@ class TestGemResolverBestSet < Gem::TestCase error_uri = api_uri + 'a' - error = Gem::RemoteFetcher::FetchError.build 'bogus', error_uri + error = Gem::RemoteFetcher::FetchError.new 'bogus', error_uri set.replace_failed_api_set error diff --git a/test/rubygems/test_gem_spec_fetcher.rb b/test/rubygems/test_gem_spec_fetcher.rb index be862aa138..afae46e120 100644 --- a/test/rubygems/test_gem_spec_fetcher.rb +++ b/test/rubygems/test_gem_spec_fetcher.rb @@ -144,7 +144,7 @@ class TestGemSpecFetcher < Gem::TestCase def test_spec_for_dependency_bad_fetch_spec src = Gem::Source.new(@gem_repo) def src.fetch_spec(name) - raise Gem::RemoteFetcher::FetchError.build("bad news from the internet", @uri) + raise Gem::RemoteFetcher::FetchError.new("bad news from the internet", @uri) end Gem.sources.replace [src] diff --git a/test/rubygems/test_remote_fetch_error.rb b/test/rubygems/test_remote_fetch_error.rb index cdc9ddad77..b9e58389d3 100644 --- a/test/rubygems/test_remote_fetch_error.rb +++ b/test/rubygems/test_remote_fetch_error.rb @@ -3,17 +3,17 @@ require_relative 'helper' class TestRemoteFetchError < Gem::TestCase def test_password_redacted - error = Gem::RemoteFetcher::FetchError.build('There was an error fetching', 'https://user:secret@gemsource.org') + error = Gem::RemoteFetcher::FetchError.new('There was an error fetching', 'https://user:secret@gemsource.org') refute_match %r{secret}, error.to_s end def test_invalid_url - error = Gem::RemoteFetcher::FetchError.build('There was an error fetching', 'https://::gemsource.org') + error = Gem::RemoteFetcher::FetchError.new('There was an error fetching', 'https://::gemsource.org') assert_equal error.to_s, 'There was an error fetching (https://::gemsource.org)' end def test_to_s - error = Gem::RemoteFetcher::FetchError.build('There was an error fetching', 'https://gemsource.org') + error = Gem::RemoteFetcher::FetchError.new('There was an error fetching', 'https://gemsource.org') assert_equal error.to_s, 'There was an error fetching (https://gemsource.org)' end end diff --git a/test/rubygems/utilities.rb b/test/rubygems/utilities.rb index 36513dcd31..20416fe70b 100644 --- a/test/rubygems/utilities.rb +++ b/test/rubygems/utilities.rb @@ -51,7 +51,7 @@ class Gem::FakeFetcher raise ArgumentError, 'need full URI' unless path.start_with?("https://", "http://") unless @data.key? path - raise Gem::RemoteFetcher::FetchError.build("no data for #{path}", path) + raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path) end if @data[path].kind_of?(Array) && @data[path].first.kind_of?(Array) @@ -124,7 +124,7 @@ class Gem::FakeFetcher raise ArgumentError, 'need full URI' unless path =~ %r{^http://} unless @data.key? path - raise Gem::RemoteFetcher::FetchError.build("no data for #{path}", path) + raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path) end data = @data[path] -- cgit v1.2.3