[rubygems/rubygems] util/rubocop -A --only Style/StringLiteralsInInterpolation

https://github.com/rubygems/rubygems/commit/cb554f6eb7
This commit is contained in:
Hiroshi SHIBATA 2023-03-16 13:00:54 +09:00
parent 83f9aa8f02
commit 4bb5ce8188
36 changed files with 62 additions and 62 deletions

View File

@ -903,7 +903,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# Glob pattern for require-able path suffixes. # Glob pattern for require-able path suffixes.
def self.suffix_pattern def self.suffix_pattern
@suffix_pattern ||= "{#{suffixes.join(',')}}" @suffix_pattern ||= "{#{suffixes.join(",")}}"
end end
## ##

View File

@ -290,7 +290,7 @@ class Gem::BasicSpecification
def lib_dirs_glob def lib_dirs_glob
dirs = if self.raw_require_paths dirs = if self.raw_require_paths
if self.raw_require_paths.size > 1 if self.raw_require_paths.size > 1
"{#{self.raw_require_paths.join(',')}}" "{#{self.raw_require_paths.join(",")}}"
else else
self.raw_require_paths.first self.raw_require_paths.first
end end

View File

@ -227,7 +227,7 @@ class Gem::Command
if args.size > 1 if args.size > 1
raise Gem::CommandLineError, raise Gem::CommandLineError,
"Too many gem names (#{args.join(', ')}); please specify only one" "Too many gem names (#{args.join(", ")}); please specify only one"
end end
args.first args.first

View File

@ -200,7 +200,7 @@ class Gem::CommandManager
if possibilities.size > 1 if possibilities.size > 1
raise Gem::CommandLineError, raise Gem::CommandLineError,
"Ambiguous command #{cmd_name} matches [#{possibilities.join(', ')}]" "Ambiguous command #{cmd_name} matches [#{possibilities.join(", ")}]"
elsif possibilities.empty? elsif possibilities.empty?
raise Gem::UnknownCommandError.new(cmd_name) raise Gem::UnknownCommandError.new(cmd_name)
end end

View File

@ -89,7 +89,7 @@ If no gems are named all gems in GEM_HOME are cleaned.
verbose do verbose do
skipped = @default_gems.map {|spec| spec.full_name } skipped = @default_gems.map {|spec| spec.full_name }
"Skipped default gems: #{skipped.join ', '}" "Skipped default gems: #{skipped.join ", "}"
end end
end end

View File

@ -91,7 +91,7 @@ prefix or only the files that are requireable.
def files_in_gem(spec) def files_in_gem(spec)
gem_path = spec.full_gem_path gem_path = spec.full_gem_path
extra = "/{#{spec.require_paths.join ','}}" if options[:lib_only] extra = "/{#{spec.require_paths.join ","}}" if options[:lib_only]
glob = "#{gem_path}#{extra}/**/*" glob = "#{gem_path}#{extra}/**/*"
prefix_re = /#{Regexp.escape(gem_path)}\// prefix_re = /#{Regexp.escape(gem_path)}\//

View File

@ -327,7 +327,7 @@ platform.
summary_width = 80 - margin_width - desc_width summary_width = 80 - margin_width - desc_width
wrap_indent = " " * (margin_width + desc_width) wrap_indent = " " * (margin_width + desc_width)
format = "#{' ' * margin_width}%-#{desc_width}s%s" format = "#{" " * margin_width}%-#{desc_width}s%s"
@command_manager.command_names.each do |cmd_name| @command_manager.command_names.each do |cmd_name|
command = @command_manager[cmd_name] command = @command_manager[cmd_name]
@ -366,7 +366,7 @@ platform.
command = @command_manager[possibilities.first] command = @command_manager[possibilities.first]
command.invoke("--help") command.invoke("--help")
elsif possibilities.size > 1 elsif possibilities.size > 1
alert_warning "Ambiguous command #{command_name} (#{possibilities.join(', ')})" alert_warning "Ambiguous command #{command_name} (#{possibilities.join(", ")})"
else else
alert_warning "Unknown command #{command_name}. Try: gem help commands" alert_warning "Unknown command #{command_name}. Try: gem help commands"
end end

View File

@ -78,7 +78,7 @@ permission to.
say "Owners for gem: #{name}" say "Owners for gem: #{name}"
owners.each do |owner| owners.each do |owner|
say "- #{owner['email'] || owner['handle'] || owner['id']}" say "- #{owner["email"] || owner["handle"] || owner["id"]}"
end end
end end
end end

View File

@ -133,7 +133,7 @@ prefix and suffix. If ruby was installed as `ruby18`, gem will be
installed as `gem18`. installed as `gem18`.
By default, this RubyGems will install gem as: By default, this RubyGems will install gem as:
#{Gem.default_exec_format % 'gem'} #{Gem.default_exec_format % "gem"}
EOF EOF
end end

View File

@ -33,7 +33,7 @@ longer using.
end end
gem_to_atime.sort_by {|_, atime| atime }.each do |name, atime| gem_to_atime.sort_by {|_, atime| atime }.each do |name, atime|
say "#{name} at #{atime.strftime '%c'}" say "#{name} at #{atime.strftime "%c"}"
end end
end end
end end

View File

@ -127,10 +127,10 @@ command to remove old versions.
if updated.empty? if updated.empty?
say "Nothing to update" say "Nothing to update"
else else
say "Gems updated: #{updated_names.join(' ')}" say "Gems updated: #{updated_names.join(" ")}"
end end
say "Gems already up-to-date: #{up_to_date_names.join(' ')}" unless up_to_date_names.empty? say "Gems already up-to-date: #{up_to_date_names.join(" ")}" unless up_to_date_names.empty?
say "Gems not currently installed: #{not_installed_names.join(' ')}" unless not_installed_names.empty? say "Gems not currently installed: #{not_installed_names.join(" ")}" unless not_installed_names.empty?
end end
def fetch_remote_gems(spec) # :nodoc: def fetch_remote_gems(spec) # :nodoc:

View File

@ -38,7 +38,7 @@ module Kernel
if gem_name.kind_of? Gem::Dependency if gem_name.kind_of? Gem::Dependency
unless Gem::Deprecate.skip unless Gem::Deprecate.skip
warn "#{Gem.location_of_caller.join ':'}:Warning: Kernel.gem no longer "\ warn "#{Gem.location_of_caller.join ":"}:Warning: Kernel.gem no longer "\
"accepts a Gem::Dependency object, please pass the name "\ "accepts a Gem::Dependency object, please pass the name "\
"and requirements directly" "and requirements directly"
end end

View File

@ -126,7 +126,7 @@ module Kernel
if names.size > 1 if names.size > 1
RUBYGEMS_ACTIVATION_MONITOR.exit RUBYGEMS_ACTIVATION_MONITOR.exit
raise Gem::LoadError, "#{path} found in multiple gems: #{names.join ', '}" raise Gem::LoadError, "#{path} found in multiple gems: #{names.join ", "}"
end end
# Ok, now find a gem that has no conflicts, starting # Ok, now find a gem that has no conflicts, starting

View File

@ -32,7 +32,7 @@ class Gem::Doctor
Gem::REPOSITORY_SUBDIRECTORIES.sort - Gem::REPOSITORY_SUBDIRECTORIES.sort -
REPOSITORY_EXTENSION_MAP.map {|(k,_)| k }.sort REPOSITORY_EXTENSION_MAP.map {|(k,_)| k }.sort
raise "Update REPOSITORY_EXTENSION_MAP, missing: #{missing.join ', '}" unless raise "Update REPOSITORY_EXTENSION_MAP, missing: #{missing.join ", "}" unless
missing.empty? missing.empty?
## ##

View File

@ -60,7 +60,7 @@ module Gem
def build_message def build_message
names = specs.map(&:full_name) names = specs.map(&:full_name)
"Could not find '#{name}' (#{requirement}) - did find: [#{names.join ','}]\n" "Could not find '#{name}' (#{requirement}) - did find: [#{names.join ","}]\n"
end end
end end

View File

@ -255,7 +255,7 @@ class Gem::UnsatisfiableDependencyError < Gem::DependencyError
def initialize(dep, platform_mismatch=nil) def initialize(dep, platform_mismatch=nil)
if platform_mismatch && !platform_mismatch.empty? if platform_mismatch && !platform_mismatch.empty?
plats = platform_mismatch.map {|x| x.platform.to_s }.sort.uniq plats = platform_mismatch.map {|x| x.platform.to_s }.sort.uniq
super "Unable to resolve dependency: No match for '#{dep}' on this platform. Found: #{plats.join(', ')}" super "Unable to resolve dependency: No match for '#{dep}' on this platform. Found: #{plats.join(", ")}"
else else
if dep.explicit? if dep.explicit?
super "Unable to resolve dependency: user requested '#{dep}'" super "Unable to resolve dependency: user requested '#{dep}'"

View File

@ -189,7 +189,7 @@ EOF
if @build_args.empty? if @build_args.empty?
say "Building native extensions. This could take a while..." say "Building native extensions. This could take a while..."
else else
say "Building native extensions with: '#{@build_args.join ' '}'" say "Building native extensions with: '#{@build_args.join " "}'"
say "This could take a while..." say "This could take a while..."
end end

View File

@ -211,7 +211,7 @@ module Gem::GemcutterUtilities
say clean_text(response.body) say clean_text(response.body)
end end
when Net::HTTPPermanentRedirect, Net::HTTPRedirection then when Net::HTTPPermanentRedirect, Net::HTTPRedirection then
message = "The request has redirected permanently to #{response['location']}. Please check your defined push host URL." message = "The request has redirected permanently to #{response["location"]}. Please check your defined push host URL."
message = "#{error_prefix}: #{message}" if error_prefix message = "#{error_prefix}: #{message}" if error_prefix
say clean_text(message) say clean_text(message)

View File

@ -141,7 +141,7 @@ module Gem::InstallUpdateOptions
end unless v end unless v
unless v unless v
message = v ? v : "(tried #{Gem::GEM_DEP_FILES.join ', '})" message = v ? v : "(tried #{Gem::GEM_DEP_FILES.join ", "})"
raise Gem::OptionParser::InvalidArgument, raise Gem::OptionParser::InvalidArgument,
"cannot find gem dependencies file #{message}" "cannot find gem dependencies file #{message}"

View File

@ -807,7 +807,7 @@ TEXT
rb_topdir = RbConfig::TOPDIR || File.dirname(rb_config["bindir"]) rb_topdir = RbConfig::TOPDIR || File.dirname(rb_config["bindir"])
# get ruby executable file name from RbConfig # get ruby executable file name from RbConfig
ruby_exe = "#{rb_config['RUBY_INSTALL_NAME']}#{rb_config['EXEEXT']}" ruby_exe = "#{rb_config["RUBY_INSTALL_NAME"]}#{rb_config["EXEEXT"]}"
ruby_exe = "ruby.exe" if ruby_exe.empty? ruby_exe = "ruby.exe" if ruby_exe.empty?
if File.exist?(File.join bindir, ruby_exe) if File.exist?(File.join bindir, ruby_exe)

View File

@ -692,7 +692,7 @@ EOM
end end
if (duplicates = @files.group_by {|f| f }.select {|_k,v| v.size > 1 }.map(&:first)) && duplicates.any? if (duplicates = @files.group_by {|f| f }.select {|_k,v| v.size > 1 }.map(&:first)) && duplicates.any?
raise Gem::Security::Exception, "duplicate files in the package: (#{duplicates.map(&:inspect).join(', ')})" raise Gem::Security::Exception, "duplicate files in the package: (#{duplicates.map(&:inspect).join(", ")})"
end end
end end

View File

@ -263,7 +263,7 @@ module Gem::QueryUtils
end end
end end
entry << " (#{list.join ', '})" entry << " (#{list.join ", "})"
end end
def make_entry(entry_tuples, platforms) def make_entry(entry_tuples, platforms)
@ -282,7 +282,7 @@ module Gem::QueryUtils
end end
def spec_authors(entry, spec) def spec_authors(entry, spec)
authors = "Author#{spec.authors.length > 1 ? 's' : ''}: ".dup authors = "Author#{spec.authors.length > 1 ? "s" : ""}: ".dup
authors << spec.authors.join(", ") authors << spec.authors.join(", ")
entry << format_text(authors, 68, 4) entry << format_text(authors, 68, 4)
end end
@ -296,7 +296,7 @@ module Gem::QueryUtils
def spec_license(entry, spec) def spec_license(entry, spec)
return if spec.license.nil? || spec.license.empty? return if spec.license.nil? || spec.license.empty?
licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: ".dup licenses = "License#{spec.licenses.length > 1 ? "s" : ""}: ".dup
licenses << spec.licenses.join(", ") licenses << spec.licenses.join(", ")
entry << "\n" << format_text(licenses, 68, 4) entry << "\n" << format_text(licenses, 68, 4)
end end
@ -327,7 +327,7 @@ module Gem::QueryUtils
if platforms.length == 1 if platforms.length == 1
title = platforms.values.length == 1 ? "Platform" : "Platforms" title = platforms.values.length == 1 ? "Platform" : "Platforms"
entry << " #{title}: #{platforms.values.sort.join(', ')}\n" entry << " #{title}: #{platforms.values.sort.join(", ")}\n"
else else
entry << " Platforms:\n" entry << " Platforms:\n"

View File

@ -163,7 +163,7 @@ class Gem::Requirement
"#{op} #{version}" "#{op} #{version}"
end.uniq end.uniq
" (#{list.join ', '})" " (#{list.join ", "})"
end end
## ##

View File

@ -28,7 +28,7 @@ module Gem::SecurityOption
policy = Gem::Security::Policies[value] policy = Gem::Security::Policies[value]
unless policy unless policy
valid = Gem::Security::Policies.keys.sort valid = Gem::Security::Policies.keys.sort
raise Gem::OptionParser::InvalidArgument, "#{value} (#{valid.join ', '} are valid)" raise Gem::OptionParser::InvalidArgument, "#{value} (#{valid.join ", "} are valid)"
end end
policy policy
end end

View File

@ -2348,7 +2348,7 @@ class Gem::Specification < Gem::BasicSpecification
when Array then "[" + obj.map {|x| ruby_code x }.join(", ") + "]" when Array then "[" + obj.map {|x| ruby_code x }.join(", ") + "]"
when Hash then when Hash then
seg = obj.keys.sort.map {|k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" } seg = obj.keys.sort.map {|k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
"{ #{seg.join(', ')} }" "{ #{seg.join(", ")} }"
when Gem::Version then obj.to_s.dump when Gem::Version then obj.to_s.dump
when DateLike then obj.strftime("%Y-%m-%d").dump when DateLike then obj.strftime("%Y-%m-%d").dump
when Time then obj.strftime("%Y-%m-%d").dump when Time then obj.strftime("%Y-%m-%d").dump

View File

@ -213,7 +213,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
end end
" if #{dep.name} is semantically versioned, use:\n" \ " if #{dep.name} is semantically versioned, use:\n" \
" add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join '.'}'#{bugfix}" " add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join "."}'#{bugfix}"
end end
warning_messages << ["open-ended dependency on #{dep} is not recommended", recommendation].join("\n") + "\n" warning_messages << ["open-ended dependency on #{dep} is not recommended", recommendation].join("\n") + "\n"
@ -253,7 +253,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
@specification.instance_variable_get("@#{attrname}").nil? @specification.instance_variable_get("@#{attrname}").nil?
end end
return if nil_attributes.empty? return if nil_attributes.empty?
error "#{nil_attributes.join ', '} must not be nil" error "#{nil_attributes.join ", "} must not be nil"
end end
def validate_rubygems_version def validate_rubygems_version
@ -374,7 +374,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
license value '#{license}' is invalid. Use a license identifier from license value '#{license}' is invalid. Use a license identifier from
http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard license. http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard license.
WARNING WARNING
message += "Did you mean #{suggestions.map {|s| "'#{s}'" }.join(', ')}?\n" unless suggestions.nil? message += "Did you mean #{suggestions.map {|s| "'#{s}'" }.join(", ")}?\n" unless suggestions.nil?
warning(message) warning(message)
end end
end end

View File

@ -201,7 +201,7 @@ class Gem::Uninstaller
remove = if @force_executables.nil? remove = if @force_executables.nil?
ask_yes_no("Remove executables:\n" + ask_yes_no("Remove executables:\n" +
"\t#{executables.join ', '}\n\n" + "\t#{executables.join ", "}\n\n" +
"in addition to the gem?", "in addition to the gem?",
true) true)
else else

View File

@ -334,7 +334,7 @@ class Gem::TestCase < Test::Unit::TestCase
ruby ruby
end end
@git = ENV["GIT"] || "git#{RbConfig::CONFIG['EXEEXT']}" @git = ENV["GIT"] || "git#{RbConfig::CONFIG["EXEEXT"]}"
Gem.ensure_gem_subdirectories @gemhome Gem.ensure_gem_subdirectories @gemhome
Gem.ensure_default_gem_subdirectories @gemhome Gem.ensure_default_gem_subdirectories @gemhome
@ -1256,7 +1256,7 @@ Also, a list:
ruby = ENV["RUBY"] ruby = ENV["RUBY"]
return ruby if ruby return ruby if ruby
ruby = "ruby" ruby = "ruby"
rubyexe = "#{ruby}#{RbConfig::CONFIG['EXEEXT']}" rubyexe = "#{ruby}#{RbConfig::CONFIG["EXEEXT"]}"
3.times do 3.times do
if File.exist?(ruby) && File.executable?(ruby) && !File.directory?(ruby) if File.exist?(ruby) && File.executable?(ruby) && !File.directory?(ruby)
@ -1331,8 +1331,8 @@ Also, a list:
end end
end end
@@good_rake = "#{rubybin} #{escape_path(__dir__, 'good_rake.rb')}" @@good_rake = "#{rubybin} #{escape_path(__dir__, "good_rake.rb")}"
@@bad_rake = "#{rubybin} #{escape_path(__dir__, 'bad_rake.rb')}" @@bad_rake = "#{rubybin} #{escape_path(__dir__, "bad_rake.rb")}"
## ##
# Construct a new Gem::Dependency. # Construct a new Gem::Dependency.

View File

@ -664,7 +664,7 @@ class TestGem < Gem::TestCase
gemdir = File.join @tempdir, "a/b/c/gemdir" gemdir = File.join @tempdir, "a/b/c/gemdir"
FileUtils.rm_rf File.join(@tempdir, "a") rescue nil FileUtils.rm_rf File.join(@tempdir, "a") rescue nil
refute File.exist?(File.join(@tempdir, "a")), refute File.exist?(File.join(@tempdir, "a")),
"manually remove #{File.join @tempdir, 'a'}, tests are broken" "manually remove #{File.join @tempdir, "a"}, tests are broken"
Gem.use_paths gemdir Gem.use_paths gemdir
Gem.ensure_gem_subdirectories gemdir Gem.ensure_gem_subdirectories gemdir

View File

@ -128,9 +128,9 @@ Added '/CN=alternate/DC=example'
output.shift output.shift
assert_equal "Please repeat the passphrase for your Private Key: ", assert_equal "Please repeat the passphrase for your Private Key: ",
output.shift output.shift
assert_equal "Certificate: #{File.join @tempdir, 'gem-public_cert.pem'}", assert_equal "Certificate: #{File.join @tempdir, "gem-public_cert.pem"}",
output.shift output.shift
assert_equal "Private Key: #{File.join @tempdir, 'gem-private_key.pem'}", assert_equal "Private Key: #{File.join @tempdir, "gem-private_key.pem"}",
output.shift output.shift
assert_equal "Don't forget to move the key file to somewhere private!", assert_equal "Don't forget to move the key file to somewhere private!",
@ -160,9 +160,9 @@ Added '/CN=alternate/DC=example'
output.shift output.shift
assert_equal "Please repeat the passphrase for your Private Key: ", assert_equal "Please repeat the passphrase for your Private Key: ",
output.shift output.shift
assert_equal "Certificate: #{File.join @tempdir, 'gem-public_cert.pem'}", assert_equal "Certificate: #{File.join @tempdir, "gem-public_cert.pem"}",
output.shift output.shift
assert_equal "Private Key: #{File.join @tempdir, 'gem-private_key.pem'}", assert_equal "Private Key: #{File.join @tempdir, "gem-private_key.pem"}",
output.shift output.shift
assert_equal "Don't forget to move the key file to somewhere private!", assert_equal "Don't forget to move the key file to somewhere private!",
@ -220,9 +220,9 @@ Added '/CN=alternate/DC=example'
output.shift output.shift
assert_equal "Please repeat the passphrase for your Private Key: ", assert_equal "Please repeat the passphrase for your Private Key: ",
output.shift output.shift
assert_equal "Certificate: #{File.join @tempdir, 'gem-public_cert.pem'}", assert_equal "Certificate: #{File.join @tempdir, "gem-public_cert.pem"}",
output.shift output.shift
assert_equal "Private Key: #{File.join @tempdir, 'gem-private_key.pem'}", assert_equal "Private Key: #{File.join @tempdir, "gem-private_key.pem"}",
output.shift output.shift
assert_equal "Don't forget to move the key file to somewhere private!", assert_equal "Don't forget to move the key file to somewhere private!",
@ -283,7 +283,7 @@ Added '/CN=alternate/DC=example'
output = @ui.output.split "\n" output = @ui.output.split "\n"
assert_equal "Certificate: #{File.join @tempdir, 'gem-public_cert.pem'}", assert_equal "Certificate: #{File.join @tempdir, "gem-public_cert.pem"}",
output.shift output.shift
assert_empty output assert_empty output
@ -305,7 +305,7 @@ Added '/CN=alternate/DC=example'
output = @ui.output.split "\n" output = @ui.output.split "\n"
assert_equal "Certificate: #{File.join @tempdir, 'gem-public_cert.pem'}", assert_equal "Certificate: #{File.join @tempdir, "gem-public_cert.pem"}",
output.shift output.shift
assert_empty output assert_empty output
@ -326,7 +326,7 @@ Added '/CN=alternate/DC=example'
output = @ui.output.split "\n" output = @ui.output.split "\n"
assert_equal "Certificate: #{File.join @tempdir, 'gem-public_cert.pem'}", assert_equal "Certificate: #{File.join @tempdir, "gem-public_cert.pem"}",
output.shift output.shift
assert_empty output assert_empty output

View File

@ -105,7 +105,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
end end
@response = "Successfully registered gem: freewill (1.0.0)" @response = "Successfully registered gem: freewill (1.0.0)"
@fetcher.data["#{@spec.metadata['allowed_push_host']}/api/v1/gems"] = HTTPResponseFactory.create(body: @response, code: 200, msg: "OK") @fetcher.data["#{@spec.metadata["allowed_push_host"]}/api/v1/gems"] = HTTPResponseFactory.create(body: @response, code: 200, msg: "OK")
@fetcher.data["#{Gem.host}/api/v1/gems"] = @fetcher.data["#{Gem.host}/api/v1/gems"] =
["fail", 500, "Internal Server Error"] ["fail", 500, "Internal Server Error"]

View File

@ -210,7 +210,7 @@ class TestGemCommandsSigninCommand < Gem::TestCase
# Set the expected response for the Web-API supplied # Set the expected response for the Web-API supplied
ENV["RUBYGEMS_HOST"] = host ENV["RUBYGEMS_HOST"] = host
data_key = "#{ENV['RUBYGEMS_HOST']}/api/v1/api_key" data_key = "#{ENV["RUBYGEMS_HOST"]}/api/v1/api_key"
fetcher.data[data_key] = HTTPResponseFactory.create(body: api_key, code: 200, msg: "OK") fetcher.data[data_key] = HTTPResponseFactory.create(body: api_key, code: 200, msg: "OK")
use_ui key_name_ui do use_ui key_name_ui do
@ -241,9 +241,9 @@ class TestGemCommandsSigninCommand < Gem::TestCase
# Set the expected response for the Web-API supplied # Set the expected response for the Web-API supplied
ENV["RUBYGEMS_HOST"] = host || Gem::DEFAULT_HOST ENV["RUBYGEMS_HOST"] = host || Gem::DEFAULT_HOST
data_key = "#{ENV['RUBYGEMS_HOST']}/api/v1/api_key" data_key = "#{ENV["RUBYGEMS_HOST"]}/api/v1/api_key"
fetcher.data[data_key] = response fetcher.data[data_key] = response
profile = "#{ENV['RUBYGEMS_HOST']}/api/v1/profile/me.yaml" profile = "#{ENV["RUBYGEMS_HOST"]}/api/v1/profile/me.yaml"
fetcher.data[profile] = profile_response fetcher.data[profile] = profile_response
Gem::RemoteFetcher.fetcher = fetcher Gem::RemoteFetcher.fetcher = fetcher

View File

@ -36,7 +36,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
end end
output = output.join "\n" output = output.join "\n"
bundle = File.join(@dest_path, "rust_ruby_example.#{RbConfig::CONFIG['DLEXT']}") bundle = File.join(@dest_path, "rust_ruby_example.#{RbConfig::CONFIG["DLEXT"]}")
assert_match(/Finished/, output) assert_match(/Finished/, output)
assert_match(/release/, output) assert_match(/release/, output)
@ -62,7 +62,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
end end
output = output.join "\n" output = output.join "\n"
bundle = File.join(@dest_path, "rust_ruby_example.#{RbConfig::CONFIG['DLEXT']}") bundle = File.join(@dest_path, "rust_ruby_example.#{RbConfig::CONFIG["DLEXT"]}")
assert_ffi_handle bundle, "hello_from_rubygems" assert_ffi_handle bundle, "hello_from_rubygems"
assert_ffi_handle bundle, "hello_from_rubygems_version" assert_ffi_handle bundle, "hello_from_rubygems_version"

View File

@ -1977,7 +1977,7 @@ gem 'other', version
bin_env = get_bin_env bin_env = get_bin_env
assert_equal("#!#{bin_env} #{RbConfig::CONFIG['ruby_install_name']}", assert_equal("#!#{bin_env} #{RbConfig::CONFIG["ruby_install_name"]}",
shebang) shebang)
end end

View File

@ -268,10 +268,10 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_split_name def test_split_name
assert_equal ["b" * 100, "a" * 155], assert_equal ["b" * 100, "a" * 155],
@tar_writer.split_name("#{'a' * 155}/#{'b' * 100}") @tar_writer.split_name("#{"a" * 155}/#{"b" * 100}")
assert_equal ["#{'qwer/' * 19}bla", "a" * 151], assert_equal ["#{"qwer/" * 19}bla", "a" * 151],
@tar_writer.split_name("#{'a' * 151}/#{'qwer/' * 19}bla") @tar_writer.split_name("#{"a" * 151}/#{"qwer/" * 19}bla")
names = [ names = [
([""] + ["123456789"] * 9 + ["1234567890"]).join("/"), # 101 bytes (several pieces) ([""] + ["123456789"] * 9 + ["1234567890"]).join("/"), # 101 bytes (several pieces)
(["123456789"] * 9 + ["1234567890"] + [""]).join("/"), # 101 bytes (several pieces) (["123456789"] * 9 + ["1234567890"] + [""]).join("/"), # 101 bytes (several pieces)

View File

@ -208,7 +208,7 @@ class TestGemRequest < Gem::TestCase
end end
auth_header = conn.payload["Authorization"] auth_header = conn.payload["Authorization"]
assert_equal "Basic #{Base64.encode64('user:pass')}".strip, auth_header assert_equal "Basic #{Base64.encode64("user:pass")}".strip, auth_header
assert_includes @ui.output, "GET https://user:REDACTED@example.rubygems/specs.#{Gem.marshal_version}" assert_includes @ui.output, "GET https://user:REDACTED@example.rubygems/specs.#{Gem.marshal_version}"
end end
@ -225,7 +225,7 @@ class TestGemRequest < Gem::TestCase
end end
auth_header = conn.payload["Authorization"] auth_header = conn.payload["Authorization"]
assert_equal "Basic #{Base64.encode64('user:{DEScede}pass')}".strip, auth_header assert_equal "Basic #{Base64.encode64("user:{DEScede}pass")}".strip, auth_header
assert_includes @ui.output, "GET https://user:REDACTED@example.rubygems/specs.#{Gem.marshal_version}" assert_includes @ui.output, "GET https://user:REDACTED@example.rubygems/specs.#{Gem.marshal_version}"
end end
@ -242,7 +242,7 @@ class TestGemRequest < Gem::TestCase
end end
auth_header = conn.payload["Authorization"] auth_header = conn.payload["Authorization"]
assert_equal "Basic #{Base64.encode64('{DEScede}pass:x-oauth-basic')}".strip, auth_header assert_equal "Basic #{Base64.encode64("{DEScede}pass:x-oauth-basic")}".strip, auth_header
assert_includes @ui.output, "GET https://REDACTED:x-oauth-basic@example.rubygems/specs.#{Gem.marshal_version}" assert_includes @ui.output, "GET https://REDACTED:x-oauth-basic@example.rubygems/specs.#{Gem.marshal_version}"
end end