summaryrefslogtreecommitdiff
path: root/test/rubygems/utilities.rb
diff options
context:
space:
mode:
authorDaniel Niknam <mhmd.niknam@gmail.com>2021-08-22 01:40:21 +1000
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-08-31 19:06:14 +0900
commit3adc141a79cdab83671b7f68301901dd7726e7c4 (patch)
treef54b06d49939b7fe03358acdca0f5b178a583a12 /test/rubygems/utilities.rb
parent19e1d3cdce96b9e58a0947b6fcbabd6da06cbd11 (diff)
[rubygems/rubygems] Refactor `Gem::RemoteFetcher::FetchError` initializer to `build` method
The `initialize` method is already doing a lot and by adding the `Gem::PrintableUri` to redact sensitive information, things are getting complicated and hard to read here. For the start, I have refactored the `initialize` method into a class method called `build`. https://github.com/rubygems/rubygems/commit/4312e8fdf5
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4789
Diffstat (limited to 'test/rubygems/utilities.rb')
-rw-r--r--test/rubygems/utilities.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/rubygems/utilities.rb b/test/rubygems/utilities.rb
index 20416fe70b..36513dcd31 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.new("no data for #{path}", path)
+ raise Gem::RemoteFetcher::FetchError.build("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.new("no data for #{path}", path)
+ raise Gem::RemoteFetcher::FetchError.build("no data for #{path}", path)
end
data = @data[path]