summaryrefslogtreecommitdiff
path: root/test/rubygems
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2023-03-16 12:57:49 +0900
committerHiroshi SHIBATA <[email protected]>2023-03-17 18:50:55 +0900
commit5211900d37573a82c1bdf7cb2354937cc4022ae1 (patch)
tree4951c15df9b302437b4ff173fe30fb5e211bd1fb /test/rubygems
parentb304cf324aed40977665ddcfcec7cc992feb949b (diff)
util/rubocop -A --only Style/SymbolProc
Diffstat (limited to 'test/rubygems')
-rw-r--r--test/rubygems/helper.rb8
-rw-r--r--test/rubygems/test_gem.rb6
-rw-r--r--test/rubygems/test_gem_available_set.rb6
-rw-r--r--test/rubygems/test_gem_commands_cert_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb66
-rw-r--r--test/rubygems/test_gem_commands_query_command.rb56
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb94
-rw-r--r--test/rubygems/test_gem_dependency_list.rb12
-rw-r--r--test/rubygems/test_gem_package_tar_reader_entry.rb4
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb4
-rw-r--r--test/rubygems/test_gem_request_set.rb28
-rw-r--r--test/rubygems/test_gem_request_set_gem_dependency_api.rb2
-rw-r--r--test/rubygems/test_gem_request_set_lockfile_parser.rb16
-rw-r--r--test/rubygems/test_gem_resolver.rb10
-rw-r--r--test/rubygems/test_gem_resolver_api_set.rb2
-rw-r--r--test/rubygems/test_gem_resolver_best_set.rb4
-rw-r--r--test/rubygems/test_gem_resolver_index_set.rb4
-rw-r--r--test/rubygems/test_gem_resolver_installer_set.rb22
-rw-r--r--test/rubygems/test_gem_resolver_lock_set.rb6
-rw-r--r--test/rubygems/test_gem_security_signer.rb14
-rw-r--r--test/rubygems/test_gem_source.rb6
-rw-r--r--test/rubygems/test_gem_source_git.rb2
-rw-r--r--test/rubygems/test_gem_source_local.rb2
-rw-r--r--test/rubygems/test_gem_source_subpath_problem.rb2
-rw-r--r--test/rubygems/test_gem_spec_fetcher.rb8
-rw-r--r--test/rubygems/test_gem_specification.rb26
26 files changed, 186 insertions, 228 deletions
diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb
index cfca3d3fb2..ada24c0d10 100644
--- a/test/rubygems/helper.rb
+++ b/test/rubygems/helper.rb
@@ -1051,16 +1051,14 @@ Also, a list:
unless Gem::RemoteFetcher === @fetcher
v = Gem.marshal_version
- specs = all.map {|spec| spec.name_tuple }
+ specs = all.map(&:name_tuple)
s_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic specs
- latest_specs = latest.map do |spec|
- spec.name_tuple
- end
+ latest_specs = latest.map(&:name_tuple)
l_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic latest_specs
- prerelease_specs = prerelease.map {|spec| spec.name_tuple }
+ prerelease_specs = prerelease.map(&:name_tuple)
p_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic prerelease_specs
@fetcher.data["#{@gem_repo}specs.#{v}.gz"] = s_zip
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index 227dfac509..0ade26f5b6 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -97,7 +97,7 @@ class TestGem < Gem::TestCase
installed = Gem.install "a", "= 1", :install_dir => gemhome2
- assert_equal %w[a-1], installed.map {|spec| spec.full_name }
+ assert_equal %w[a-1], installed.map(&:full_name)
assert_path_exist File.join(gemhome2, "gems", "a-1")
end
@@ -116,7 +116,7 @@ class TestGem < Gem::TestCase
rescue StandardError
Gem.install "a", "= 1", :install_dir => gemhome2
end
- assert_equal %w[a-1], installed.map {|spec| spec.full_name }
+ assert_equal %w[a-1], installed.map(&:full_name)
end
def test_self_install_permissions
@@ -1377,7 +1377,7 @@ class TestGem < Gem::TestCase
r.gem "b", "= 1"
end
- activated = Gem::Specification.map {|x| x.full_name }
+ activated = Gem::Specification.map(&:full_name)
assert_equal %w[a-1 b-1 c-2], activated.sort
end
diff --git a/test/rubygems/test_gem_available_set.rb b/test/rubygems/test_gem_available_set.rb
index 576f3f4221..cbaed1a686 100644
--- a/test/rubygems/test_gem_available_set.rb
+++ b/test/rubygems/test_gem_available_set.rb
@@ -36,12 +36,12 @@ class TestGemAvailableSet < Gem::TestCase
dep = Gem::Resolver::DependencyRequest.new dep("a"), nil
- assert_equal %w[a-1], set.find_all(dep).map {|spec| spec.full_name }
+ assert_equal %w[a-1], set.find_all(dep).map(&:full_name)
dep = Gem::Resolver::DependencyRequest.new dep("a", ">= 0.a"), nil
assert_equal %w[a-1 a-1.a],
- set.find_all(dep).map {|spec| spec.full_name }.sort
+ set.find_all(dep).map(&:full_name).sort
end
def test_match_platform
@@ -122,7 +122,7 @@ class TestGemAvailableSet < Gem::TestCase
set.add a2a, @source
set.add a2, @source
- g = set.sorted.map {|t| t.spec }
+ g = set.sorted.map(&:spec)
assert_equal [a3a, a2, a2a, a1, a1a], g
end
diff --git a/test/rubygems/test_gem_commands_cert_command.rb b/test/rubygems/test_gem_commands_cert_command.rb
index 45051fbf91..5c2bc279c0 100644
--- a/test/rubygems/test_gem_commands_cert_command.rb
+++ b/test/rubygems/test_gem_commands_cert_command.rb
@@ -731,12 +731,12 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
]
assert_equal [PUBLIC_CERT.to_pem, ALTERNATE_CERT.to_pem],
- @cmd.options[:add].map {|cert| cert.to_pem }
+ @cmd.options[:add].map(&:to_pem)
assert_equal %w[nobody example], @cmd.options[:remove]
assert_equal %w[nobody@example other@example],
- @cmd.options[:build].map {|name| name.to_s }
+ @cmd.options[:build].map(&:to_s)
assert_equal ["", "example"], @cmd.options[:list]
end
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index 0c93244f92..63caa3d42d 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -43,7 +43,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
end
end
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-2], @cmd.installed_specs.map(&:full_name)
end
def test_execute_explicit_version_includes_prerelease
@@ -65,7 +65,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
end
end
- assert_equal %w[a-2.a], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-2.a], @cmd.installed_specs.map(&:full_name)
end
def test_execute_local
@@ -91,7 +91,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
end
end
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-2], @cmd.installed_specs.map(&:full_name)
assert_match "1 gem installed", @ui.output
end
@@ -182,7 +182,7 @@ ERROR: Could not find a valid gem 'bar' (= 0.5) (required by 'foo' (>= 0)) in a
end
end
- assert_equal %w[a-2 b-2.a c-3], @cmd.installed_specs.map {|spec| spec.full_name }.sort
+ assert_equal %w[a-2 b-2.a c-3], @cmd.installed_specs.map(&:full_name).sort
assert_match "3 gems installed", @ui.output
end
@@ -465,7 +465,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-1], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-1], @cmd.installed_specs.map(&:full_name)
end
def test_execute_prerelease_wins_over_previous_ver
@@ -483,7 +483,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-2.a], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-2.a], @cmd.installed_specs.map(&:full_name)
end
def test_execute_with_version_specified_by_colon
@@ -500,7 +500,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-1], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-1], @cmd.installed_specs.map(&:full_name)
end
def test_execute_prerelease_skipped_when_non_pre_available
@@ -518,7 +518,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-2], @cmd.installed_specs.map(&:full_name)
end
def test_execute_required_ruby_version
@@ -548,7 +548,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-2], @cmd.installed_specs.map(&:full_name)
end
def test_execute_required_ruby_version_upper_bound
@@ -569,7 +569,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-2.0], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-2.0], @cmd.installed_specs.map(&:full_name)
end
def test_execute_required_ruby_version_specific_not_met
@@ -607,7 +607,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-1.0], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-1.0], @cmd.installed_specs.map(&:full_name)
end
def test_execute_required_ruby_version_specific_prerelease_not_met
@@ -774,7 +774,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-2], @cmd.installed_specs.map(&:full_name)
assert_match "1 gem installed", @ui.output
end
@@ -794,7 +794,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-2], @cmd.installed_specs.map(&:full_name)
assert_match "1 gem installed", @ui.output
end
@@ -814,7 +814,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-1], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-1], @cmd.installed_specs.map(&:full_name)
assert_match "1 gem installed", @ui.output
a1_gemspec = File.join(@gemhome, "specifications", "a-1.gemspec")
@@ -868,7 +868,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-1], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-1], @cmd.installed_specs.map(&:full_name)
assert_match "1 gem installed", @ui.output
@@ -902,7 +902,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-2 b-2], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-2 b-2], @cmd.installed_specs.map(&:full_name)
assert_match "2 gems installed", @ui.output
end
@@ -944,7 +944,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-1 b-1], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-1 b-1], @cmd.installed_specs.map(&:full_name)
end
def test_execute_conservative
@@ -970,7 +970,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[b-2], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[b-2], @cmd.installed_specs.map(&:full_name)
assert_equal "", @ui.error
assert_match "1 gem installed", @ui.output
@@ -992,7 +992,7 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.install_gem "a", ">= 0"
- assert_equal %w[a-2], @cmd.installed_specs.map {|s| s.full_name }
+ assert_equal %w[a-2], @cmd.installed_specs.map(&:full_name)
assert done_installing, "documentation was not generated"
end
@@ -1006,7 +1006,7 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.install_gem "a", ">= 0"
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-2], @cmd.installed_specs.map(&:full_name)
end
def test_install_gem_ignore_dependencies_remote_platform_local
@@ -1023,7 +1023,7 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.install_gem "a", ">= 0"
- assert_equal %W[a-3-#{local}], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %W[a-3-#{local}], @cmd.installed_specs.map(&:full_name)
end
def test_install_gem_ignore_dependencies_specific_file
@@ -1037,7 +1037,7 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.install_gem File.join(@tempdir, spec.file_name), nil
- assert_equal %w[a-2], @cmd.installed_specs.map {|s| s.full_name }
+ assert_equal %w[a-2], @cmd.installed_specs.map(&:full_name)
end
def test_parses_requirement_from_gemname
@@ -1107,7 +1107,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-2], @cmd.installed_specs.map(&:full_name)
assert_match "1 gem installed", @ui.output
@@ -1132,7 +1132,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-2], @cmd.installed_specs.map(&:full_name)
assert_match "1 gem installed", @ui.output
@@ -1159,7 +1159,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[], @cmd.installed_specs.map(&:full_name)
assert_match "Using a (2)", @ui.output
assert File.exist?("#{@gemdeps}.lock")
@@ -1183,7 +1183,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[], @cmd.installed_specs.map(&:full_name)
assert_match "Using a (2)", @ui.output
assert !File.exist?("#{@gemdeps}.lock")
@@ -1208,7 +1208,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[], @cmd.installed_specs.map(&:full_name)
assert_match "Using a (1)", @ui.output
end
@@ -1230,7 +1230,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_equal %w[a-2], @cmd.installed_specs.map(&:full_name)
assert_match "Installing a (2)", @ui.output
end
@@ -1253,7 +1253,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- names = @cmd.installed_specs.map {|spec| spec.full_name }
+ names = @cmd.installed_specs.map(&:full_name)
assert_equal %w[q-1.0 r-2.0], names
@@ -1280,7 +1280,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- names = @cmd.installed_specs.map {|spec| spec.full_name }
+ names = @cmd.installed_specs.map(&:full_name)
assert_equal %w[r-2.0], names
@@ -1307,7 +1307,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- names = @cmd.installed_specs.map {|spec| spec.full_name }
+ names = @cmd.installed_specs.map(&:full_name)
assert_equal %w[q-1.0 r-2.0], names
@@ -1339,7 +1339,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- names = @cmd.installed_specs.map {|spec| spec.full_name }
+ names = @cmd.installed_specs.map(&:full_name)
assert_equal %w[q-1.0 r-2.0], names
@@ -1374,7 +1374,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end
end
- names = @cmd.installed_specs.map {|spec| spec.full_name }
+ names = @cmd.installed_specs.map(&:full_name)
assert_equal %w[r-2.0], names
diff --git a/test/rubygems/test_gem_commands_query_command.rb b/test/rubygems/test_gem_commands_query_command.rb
index 6882098c53..99cbb60df2 100644
--- a/test/rubygems/test_gem_commands_query_command.rb
+++ b/test/rubygems/test_gem_commands_query_command.rb
@@ -22,9 +22,7 @@ class TestGemCommandsQueryCommandWithInstalledGems < Gem::TestCase
include TestGemCommandsQueryCommandSetup
def test_execute
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
@cmd.handle_options %w[-r]
@@ -45,9 +43,7 @@ pl (1 i386-linux)
end
def test_execute_all
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
@cmd.handle_options %w[-r --all]
@@ -68,9 +64,7 @@ pl (1 i386-linux)
end
def test_execute_all_prerelease
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
@cmd.handle_options %w[-r --all --prerelease]
@@ -310,9 +304,7 @@ pl (1)
end
def test_execute_local
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
@cmd.options[:domain] = :local
@@ -333,9 +325,7 @@ pl (1 i386-linux)
end
def test_execute_local_notty
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
@cmd.handle_options %w[]
@@ -355,9 +345,7 @@ pl (1 i386-linux)
end
def test_execute_local_quiet
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
@cmd.options[:domain] = :local
Gem.configuration.verbose = false
@@ -376,9 +364,7 @@ pl (1 i386-linux)
end
def test_execute_no_versions
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
@cmd.handle_options %w[-r --no-versions]
@@ -399,9 +385,7 @@ pl
end
def test_execute_notty
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
@cmd.handle_options %w[-r]
@@ -439,9 +423,7 @@ a (3.a)
end
def test_execute_prerelease_local
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
@cmd.handle_options %w[-l --prerelease]
@@ -461,9 +443,7 @@ pl (1 i386-linux)
end
def test_execute_no_prerelease_local
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
@cmd.handle_options %w[-l --no-prerelease]
@@ -483,9 +463,7 @@ pl (1 i386-linux)
end
def test_execute_remote
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
@cmd.options[:domain] = :remote
@@ -506,9 +484,7 @@ pl (1 i386-linux)
end
def test_execute_remote_notty
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
@cmd.handle_options %w[]
@@ -528,9 +504,7 @@ pl (1 i386-linux)
end
def test_execute_remote_quiet
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
@cmd.options[:domain] = :remote
Gem.configuration.verbose = false
@@ -569,9 +543,7 @@ pl (1 i386-linux)
# Test for multiple args handling!
def test_execute_multiple_args
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
@cmd.handle_options %w[a pl]
diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb
index 067eb309b1..5e59539ae4 100644
--- a/test/rubygems/test_gem_dependency_installer.rb
+++ b/test/rubygems/test_gem_dependency_installer.rb
@@ -156,7 +156,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b"
end
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name },
+ assert_equal %w[b-1], inst.installed_gems.map(&:full_name),
"sanity check"
Dir.chdir @tempdir do
@@ -164,7 +164,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "e"
end
- assert_equal %w[a-1 e-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1 e-1], inst.installed_gems.map(&:full_name)
end
def test_install_cache_dir
@@ -181,7 +181,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b"
end
- assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1 b-1], inst.installed_gems.map(&:full_name)
assert File.exist? File.join(@gemhome, "cache", @a1.file_name)
assert File.exist? File.join(@gemhome, "cache", @b1.file_name)
@@ -206,7 +206,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "a", req("= 2")
end
- assert_equal %w[a-2], inst.installed_gems.map {|s| s.full_name },
+ assert_equal %w[a-2], inst.installed_gems.map(&:full_name),
"sanity check"
FileUtils.rm File.join(@tempdir, a2.file_name)
@@ -217,7 +217,7 @@ class TestGemDependencyInstaller < Gem::TestCase
end
assert_equal %w[a-2 b-1], Gem::Specification.map(&:full_name)
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[b-1], inst.installed_gems.map(&:full_name)
end
# This asserts that if a gem's dependency is satisfied by an
@@ -254,7 +254,7 @@ class TestGemDependencyInstaller < Gem::TestCase
end
assert_equal %w[a-2 b-1], Gem::Specification.map(&:full_name)
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[b-1], inst.installed_gems.map(&:full_name)
end
def test_install_dependency
@@ -277,7 +277,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b"
end
- assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1 b-1], inst.installed_gems.map(&:full_name)
assert done_installing_ran, "post installs hook was not run"
end
@@ -297,7 +297,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b"
end
- assert_equal %w[a-1 aa-1 b-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1 aa-1 b-1], inst.installed_gems.map(&:full_name)
end
def test_install_dependency_development_deep
@@ -317,7 +317,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "d"
end
- assert_equal %w[a-1 aa-1 b-1 c-1 d-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1 aa-1 b-1 c-1 d-1], inst.installed_gems.map(&:full_name)
end
def test_install_dependency_development_shallow
@@ -337,7 +337,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "d"
end
- assert_equal %w[c-1 d-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[c-1 d-1], inst.installed_gems.map(&:full_name)
end
def test_install_dependency_existing
@@ -353,7 +353,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b"
end
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[b-1], inst.installed_gems.map(&:full_name)
end
def test_install_dependency_existing_extension
@@ -390,7 +390,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir pwd
end
- assert_equal %w[f-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[f-1], inst.installed_gems.map(&:full_name)
assert_path_exist e1.extension_dir
end
@@ -410,7 +410,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "f"
end
- assert_equal %w[f-2], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[f-2], inst.installed_gems.map(&:full_name)
end
def test_install_local
@@ -424,7 +424,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "a-1.gem"
end
- assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1], inst.installed_gems.map(&:full_name)
end
def test_install_local_prerelease
@@ -438,7 +438,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "a-1.a.gem"
end
- assert_equal %w[a-1.a], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1.a], inst.installed_gems.map(&:full_name)
end
def test_install_local_dependency
@@ -454,7 +454,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b-1.gem"
end
- assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1 b-1], inst.installed_gems.map(&:full_name)
end
def test_install_local_dependency_installed
@@ -472,7 +472,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b-1.gem"
end
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[b-1], inst.installed_gems.map(&:full_name)
end
def test_install_local_subdir
@@ -485,7 +485,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "gems/a-1.gem"
end
- assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1], inst.installed_gems.map(&:full_name)
end
def test_install_minimal_deps
@@ -511,7 +511,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b", req("= 1")
end
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name },
+ assert_equal %w[b-1], inst.installed_gems.map(&:full_name),
"sanity check"
Dir.chdir @tempdir do
@@ -519,7 +519,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "e"
end
- assert_equal %w[a-1 e-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1 e-1], inst.installed_gems.map(&:full_name)
end
def test_install_no_minimal_deps
@@ -545,7 +545,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b", req("= 1")
end
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name },
+ assert_equal %w[b-1], inst.installed_gems.map(&:full_name),
"sanity check"
Dir.chdir @tempdir do
@@ -553,7 +553,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "e"
end
- assert_equal %w[a-1 b-2 e-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1 b-2 e-1], inst.installed_gems.map(&:full_name)
end
def test_install_no_document
@@ -603,7 +603,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b"
end
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[b-1], inst.installed_gems.map(&:full_name)
end
def test_install_build_args
@@ -632,7 +632,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b"
end
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[b-1], inst.installed_gems.map(&:full_name)
end
def test_install_install_dir
@@ -653,7 +653,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b"
end
- assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1 b-1], inst.installed_gems.map(&:full_name)
assert File.exist?(File.join(gemhome2, "specifications", @a1.spec_name))
assert File.exist?(File.join(gemhome2, "cache", @a1.file_name))
@@ -677,7 +677,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b"
end
- assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1 b-1], inst.installed_gems.map(&:full_name)
a1, b1 = inst.installed_gems
assert_equal a1.spec_file, a1.loaded_from
@@ -701,7 +701,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b"
end
- assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1 b-1], inst.installed_gems.map(&:full_name)
end
def test_install_domain_local
@@ -720,7 +720,7 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal expected, e.message
end
- assert_equal [], inst.installed_gems.map {|s| s.full_name }
+ assert_equal [], inst.installed_gems.map(&:full_name)
end
def test_install_domain_remote
@@ -736,7 +736,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst = Gem::DependencyInstaller.new :domain => :remote
inst.install "a"
- assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1], inst.installed_gems.map(&:full_name)
end
def test_install_dual_repository
@@ -753,7 +753,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "a"
end
- assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name },
+ assert_equal %w[a-1], inst.installed_gems.map(&:full_name),
"sanity check"
ENV["GEM_HOME"] = @gemhome
@@ -765,7 +765,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "b"
end
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[b-1], inst.installed_gems.map(&:full_name)
end
def test_install_reinstall
@@ -800,7 +800,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install "a"
end
- assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1], inst.installed_gems.map(&:full_name)
end
def test_install_remote_dep
@@ -820,7 +820,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst.install dep
end
- assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1], inst.installed_gems.map(&:full_name)
end
def test_install_remote_platform_newer
@@ -853,7 +853,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst = Gem::DependencyInstaller.new :domain => :remote
inst.install "a"
- assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1], inst.installed_gems.map(&:full_name)
end
def test_install_platform_is_ignored_when_a_file_is_specified
@@ -864,7 +864,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst = Gem::DependencyInstaller.new :domain => :local
inst.install a_gem
- assert_equal %w[a-1-cpu-other_platform-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[a-1-cpu-other_platform-1], inst.installed_gems.map(&:full_name)
end
require "rubygems/openssl"
@@ -873,10 +873,10 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_install_security_policy
util_setup_gems
- data = File.open(@a1_gem, "rb") {|f| f.read }
+ data = File.open(@a1_gem, "rb", &:read)
@fetcher.data["http://gems.example.com/gems/a-1.gem"] = data
- data = File.open(@b1_gem, "rb") {|f| f.read }
+ data = File.open(@b1_gem, "rb", &:read)
@fetcher.data["http://gems.example.com/gems/b-1.gem"] = data
policy = Gem::Security::HighSecurity
@@ -889,7 +889,7 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal "unsigned gems are not allowed by the High Security policy",
e.message
- assert_equal %w[], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[], inst.installed_gems.map(&:full_name)
end
end
@@ -911,32 +911,32 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_install_version
util_setup_d
- data = File.open(@d2_gem, "rb") {|f| f.read }
+ data = File.open(@d2_gem, "rb", &:read)
@fetcher.data["http://gems.example.com/gems/d-2.gem"] = data
- data = File.open(@d1_gem, "rb") {|f| f.read }
+ data = File.open(@d1_gem, "rb", &:read)
@fetcher.data["http://gems.example.com/gems/d-1.gem"] = data
inst = Gem::DependencyInstaller.new
inst.install "d", "= 1"
- assert_equal %w[d-1], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[d-1], inst.installed_gems.map(&:full_name)
end
def test_install_version_default
util_setup_d
- data = File.open(@d2_gem, "rb") {|f| f.read }
+ data = File.open(@d2_gem, "rb", &:read)
@fetcher.data["http://gems.example.com/gems/d-2.gem"] = data
- data = File.open(@d1_gem, "rb") {|f| f.read }
+ data = File.open(@d1_gem, "rb", &:read)
@fetcher.data["http://gems.example.com/gems/d-1.gem"] = data
inst = Gem::DependencyInstaller.new
inst.install "d"
- assert_equal %w[d-2], inst.installed_gems.map {|s| s.full_name }
+ assert_equal %w[d-2], inst.installed_gems.map(&:full_name)
end
def test_install_legacy_spec_with_nil_required_ruby_version
@@ -1109,7 +1109,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst = Gem::DependencyInstaller.new
request_set = inst.resolve_dependencies "b", req(">= 0")
- requests = request_set.sorted_requests.map {|req| req.full_name }
+ requests = request_set.sorted_requests.map(&:full_name)
assert_equal %w[a-1 b-1], requests
end
@@ -1123,7 +1123,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst = Gem::DependencyInstaller.new :ignore_dependencies => true
request_set = inst.resolve_dependencies "b", req(">= 0")
- requests = request_set.sorted_requests.map {|req| req.full_name }
+ requests = request_set.sorted_requests.map(&:full_name)
assert request_set.ignore_dependencies
@@ -1140,7 +1140,7 @@ class TestGemDependencyInstaller < Gem::TestCase
inst = Gem::DependencyInstaller.new
request_set = inst.resolve_dependencies "a-1.gem", req(">= 0")
- requests = request_set.sorted_requests.map {|req| req.full_name }
+ requests = request_set.sorted_requests.map(&:full_name)
assert_equal %w[a-1], requests
end
diff --git a/test/rubygems/test_gem_dependency_list.rb b/test/rubygems/test_gem_dependency_list.rb
index 0dca8f8c3a..3991fb4daa 100644
--- a/test/rubygems/test_gem_dependency_list.rb
+++ b/test/rubygems/test_gem_dependency_list.rb
@@ -52,7 +52,7 @@ class TestGemDependencyList < Gem::TestCase
order = @deplist.dependency_order
- assert_equal %w[d-1 c-1 b-1 a-1], order.map {|s| s.full_name }
+ assert_equal %w[d-1 c-1 b-1 a-1], order.map(&:full_name)
end
def test_dependency_order_circle
@@ -61,7 +61,7 @@ class TestGemDependencyList < Gem::TestCase
order = @deplist.dependency_order
- assert_equal %w[b-1 c-1 a-1], order.map {|s| s.full_name }
+ assert_equal %w[b-1 c-1 a-1], order.map(&:full_name)
end
def test_dependency_order_development
@@ -79,7 +79,7 @@ class TestGemDependencyList < Gem::TestCase
order = deplist.dependency_order
- assert_equal %w[g-1 a-1 f-1 e-1], order.map {|s| s.full_name },
+ assert_equal %w[g-1 a-1 f-1 e-1], order.map(&:full_name),
"development on"
deplist2 = Gem::DependencyList.new
@@ -87,7 +87,7 @@ class TestGemDependencyList < Gem::TestCase
order = deplist2.dependency_order
- assert_equal %w[a-1 g-1 f-1 e-1], order.map {|s| s.full_name },
+ assert_equal %w[a-1 g-1 f-1 e-1], order.map(&:full_name),
"development off"
end
@@ -99,7 +99,7 @@ class TestGemDependencyList < Gem::TestCase
order = @deplist.dependency_order
- assert_equal %w[d-1 c-2 b-1 a-2 e-1], order.map {|s| s.full_name },
+ assert_equal %w[d-1 c-2 b-1 a-2 e-1], order.map(&:full_name),
"deps of trimmed specs not included"
end
@@ -108,7 +108,7 @@ class TestGemDependencyList < Gem::TestCase
order = @deplist.dependency_order
- assert_equal %w[c-2 a-1], order.map {|s| s.full_name }
+ assert_equal %w[c-2 a-1], order.map(&:full_name)
end
def test_find_name
diff --git a/test/rubygems/test_gem_package_tar_reader_entry.rb b/test/rubygems/test_gem_package_tar_reader_entry.rb
index 06e9c38e27..3f0b8debf9 100644
--- a/test/rubygems/test_gem_package_tar_reader_entry.rb
+++ b/test/rubygems/test_gem_package_tar_reader_entry.rb
@@ -23,9 +23,7 @@ class TestGemPackageTarReaderEntry < Gem::Package::TarTestCase
def test_open
io = TempIO.new @tar
header = Gem::Package::TarHeader.from io
- retval = Gem::Package::TarReader::Entry.open header, io do |entry|
- entry.getc
- end
+ retval = Gem::Package::TarReader::Entry.open header, io, &:getc
assert_equal "a", retval
assert_equal @tar.size, io.pos, "should have read to end of entry"
ensure
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index 4685afef6c..088acad841 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -336,9 +336,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
def test_download_install_dir
- a1_data = File.open @a1_gem, "rb" do |fp|
- fp.read
- end
+ a1_data = File.open @a1_gem, "rb", &:read
fetcher = util_fuck_with_fetcher a1_data
diff --git a/test/rubygems/test_gem_request_set.rb b/test/rubygems/test_gem_request_set.rb
index 1e80028ccc..cf0cd8b38d 100644
--- a/test/rubygems/test_gem_request_set.rb
+++ b/test/rubygems/test_gem_request_set.rb
@@ -324,7 +324,7 @@ ruby "0"
res = rs.resolve StaticSet.new([a, b])
assert_equal 2, res.size
- names = res.map {|s| s.full_name }.sort
+ names = res.map(&:full_name).sort
assert_equal ["a-2", "b-2"], names
@@ -343,7 +343,7 @@ ruby "0"
res = rs.resolve StaticSet.new([a, b, c])
assert_equal 3, res.size
- names = res.map {|s| s.full_name }.sort
+ names = res.map(&:full_name).sort
assert_equal %w[a-1.b b-1.b c-1.1.b], names
end
@@ -410,12 +410,12 @@ ruby "0"
res = rs.resolve
assert_equal 1, res.size
- names = res.map {|s| s.full_name }.sort
+ names = res.map(&:full_name).sort
assert_equal %w[a-1], names
assert_equal [@DR::BestSet, @DR::GitSet, @DR::VendorSet, @DR::SourceSet],
- rs.sets.map {|set| set.class }
+ rs.sets.map(&:class)
end
def test_resolve_ignore_dependencies
@@ -429,7 +429,7 @@ ruby "0"
res = rs.resolve StaticSet.new([a, b])
assert_equal 1, res.size
- names = res.map {|s| s.full_name }.sort
+ names = res.map(&:full_name).sort
assert_equal %w[a-2], names
end
@@ -474,12 +474,12 @@ ruby "0"
res = rs.resolve
assert_equal 2, res.size
- names = res.map {|s| s.full_name }.sort
+ names = res.map(&:full_name).sort
assert_equal ["a-1", "b-2"], names
assert_equal [@DR::BestSet, @DR::GitSet, @DR::VendorSet, @DR::SourceSet],
- rs.sets.map {|set| set.class }
+ rs.sets.map(&:class)
end
def test_sorted_requests
@@ -492,7 +492,7 @@ ruby "0"
rs.resolve StaticSet.new([a, b, c])
- names = rs.sorted_requests.map {|s| s.full_name }
+ names = rs.sorted_requests.map(&:full_name)
assert_equal %w[c-2 b-2 a-2], names
end
@@ -521,14 +521,14 @@ ruby "0"
installers << installer
end
- assert_equal %w[b-1 a-1], reqs.map {|req| req.full_name }
+ assert_equal %w[b-1 a-1], reqs.map(&:full_name)
assert_equal %w[b-1 a-1],
installers.map {|installer| installer.spec.full_name }
assert_path_exist File.join @gemhome, "specifications", "a-1.gemspec"
assert_path_exist File.join @gemhome, "specifications", "b-1.gemspec"
- assert_equal %w[b-1 a-1], installed.map {|s| s.full_name }
+ assert_equal %w[b-1 a-1], installed.map(&:full_name)
assert done_installing_ran
end
@@ -551,7 +551,7 @@ ruby "0"
assert_path_exist File.join @tempdir, "specifications", "a-1.gemspec"
assert_path_exist File.join @tempdir, "specifications", "b-1.gemspec"
- assert_equal %w[b-1 a-1], installed.map {|s| s.full_name }
+ assert_equal %w[b-1 a-1], installed.map(&:full_name)
end
def test_install_into_development_shallow
@@ -583,7 +583,7 @@ ruby "0"
assert_equal @tempdir, ENV["GEM_HOME"]
end
- assert_equal %w[a-1 b-1], installed.map {|s| s.full_name }.sort
+ assert_equal %w[a-1 b-1], installed.map(&:full_name).sort
end
def test_sorted_requests_development_shallow
@@ -608,7 +608,7 @@ ruby "0"
rs.resolve StaticSet.new [a_spec, b_spec, c_spec]
- assert_equal %w[b-1 a-1], rs.sorted_requests.map {|req| req.full_name }
+ assert_equal %w[b-1 a-1], rs.sorted_requests.map(&:full_name)
end
def test_tsort_each_child_development
@@ -637,7 +637,7 @@ ruby "0"
deps = rs.enum_for(:tsort_each_child, a_req).to_a
- assert_equal %w[b], deps.map {|dep| dep.name }
+ assert_equal %w[b], deps.map(&:name)
end
def test_tsort_each_child_development_shallow
diff --git a/test/rubygems/test_gem_request_set_gem_dependency_api.rb b/test/rubygems/test_gem_request_set_gem_dependency_api.rb
index a8ecb8a50b..b8507291d1 100644
--- a/test/rubygems/test_gem_request_set_gem_dependency_api.rb
+++ b/test/rubygems/test_gem_request_set_gem_dependency_api.rb
@@ -493,7 +493,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
groups = @gda.send :gem_group, "a", :group => :b, :groups => [:c, :d]
end
- assert_equal [:a, :b, :c, :d], groups.sort_by {|group| group.to_s }
+ assert_equal [:a, :b, :c, :d], groups.sort_by(&:to_s)
end
def test_gemspec
diff --git a/test/rubygems/test_gem_request_set_lockfile_parser.rb b/test/rubygems/test_gem_request_set_lockfile_parser.rb
index 69a3a328aa..942edec75b 100644
--- a/test/rubygems/test_gem_request_set_lockfile_parser.rb
+++ b/test/rubygems/test_gem_request_set_lockfile_parser.rb
@@ -93,7 +93,7 @@ DEPENDENCIES
assert lockfile_set, "could not find a LockSet"
- assert_equal %w[a-2], lockfile_set.specs.map {|tuple| tuple.full_name }
+ assert_equal %w[a-2], lockfile_set.specs.map(&:full_name)
end
def test_parse_dependencies
@@ -123,7 +123,7 @@ DEPENDENCIES
assert lockfile_set, "could not find a LockSet"
- assert_equal %w[a-2], lockfile_set.specs.map {|tuple| tuple.full_name }
+ assert_equal %w[a-2], lockfile_set.specs.map(&:full_name)
end
def test_parse_DEPENDENCIES_git
@@ -217,7 +217,7 @@ DEPENDENCIES
assert lockfile_set, "found a LockSet"
- assert_equal %w[a-2], lockfile_set.specs.map {|s| s.full_name }
+ assert_equal %w[a-2], lockfile_set.specs.map(&:full_name)
end
def test_parse_GEM_remote_multiple
@@ -245,7 +245,7 @@ DEPENDENCIES
assert lockfile_set, "found a LockSet"
- assert_equal %w[a-2], lockfile_set.specs.map {|s| s.full_name }
+ assert_equal %w[a-2], lockfile_set.specs.map(&:full_name)
assert_equal %w[https://gems.example/ https://other.example/],
lockfile_set.specs.flat_map {|s| s.sources.map {|src| src.uri.to_s } }
@@ -283,7 +283,7 @@ DEPENDENCIES
assert git_set, "could not find a GitSet"
- assert_equal %w[a-2], git_set.specs.values.map {|s| s.full_name }
+ assert_equal %w[a-2], git_set.specs.values.map(&:full_name)
assert_equal [dep("b", ">= 3"), dep("c")],
git_set.specs.values.first.dependencies
@@ -437,7 +437,7 @@ DEPENDENCIES
assert vendor_set, "could not find a VendorSet"
- assert_equal %w[a-1], vendor_set.specs.values.map {|s| s.full_name }
+ assert_equal %w[a-1], vendor_set.specs.values.map(&:full_name)
spec = vendor_set.load_spec "a", nil, nil, nil
@@ -496,14 +496,14 @@ DEPENDENCIES
assert lockfile_set, "could not find a LockSet"
- assert_equal %w[a-2 b-3], lockfile_set.specs.map {|tuple| tuple.full_name }
+ assert_equal %w[a-2 b-3], lockfile_set.specs.map(&:full_name)
expected = [
Gem::Platform::RUBY,
Gem::Platform.new("x86_64-linux"),
]
- assert_equal expected, lockfile_set.specs.map {|tuple| tuple.platform }
+ assert_equal expected, lockfile_set.specs.map(&:platform)
spec = lockfile_set.specs.first
diff --git a/test/rubygems/test_gem_resolver.rb b/test/rubygems/test_gem_resolver.rb
index c849af04f3..435b01ed71 100644
--- a/test/rubygems/test_gem_resolver.rb
+++ b/test/rubygems/test_gem_resolver.rb
@@ -25,10 +25,10 @@ class TestGemResolver < Gem::TestCase
def assert_resolves_to(expected, resolver)
actual = resolver.resolve
- exp = expected.sort_by {|s| s.full_name }
- act = actual.map {|a| a.spec.spec }.sort_by {|s| s.full_name }
+ exp = expected.sort_by(&:full_name)
+ act = actual.map {|a| a.spec.spec }.sort_by(&:full_name)
- msg = "Set of gems was not the same: #{exp.map {|x| x.full_name }.inspect} != #{act.map {|x| x.full_name }.inspect}"
+ msg = "Set of gems was not the same: #{exp.map(&:full_name).inspect} != #{act.map(&:full_name).inspect}"
assert_equal exp, act, msg
rescue Gem::DependencyResolutionError => e
@@ -104,7 +104,7 @@ class TestGemResolver < Gem::TestCase
res.requests a1, act, reqs
- assert_equal ["b (= 2)"], reqs.map {|req| req.to_s }
+ assert_equal ["b (= 2)"], reqs.map(&:to_s)
end
def test_requests_development
@@ -126,7 +126,7 @@ class TestGemResolver < Gem::TestCase
res.requests spec, act, reqs
- assert_equal ["b (= 2)"], reqs.map {|req| req.to_s }
+ assert_equal ["b (= 2)"], reqs.map(&:to_s)
assert spec.instance_variable_defined? :@called
end
diff --git a/test/rubygems/test_gem_resolver_api_set.rb b/test/rubygems/test_gem_resolver_api_set.rb
index 7d3a5ee77d..a718d839fa 100644
--- a/test/rubygems/test_gem_resolver_api_set.rb
+++ b/test/rubygems/test_gem_resolver_api_set.rb
@@ -149,7 +149,7 @@ class TestGemResolverAPISet < Gem::TestCase
set.prefetch [a_dep, b_dep]
- assert_equal %w[a-1], set.find_all(a_dep).map {|s| s.full_name }
+ assert_equal %w[a-1], set.find_all(a_dep).map(&:full_name)
assert_empty set.find_all(b_dep)
end
diff --git a/test/rubygems/test_gem_resolver_best_set.rb b/test/rubygems/test_gem_resolver_best_set.rb
index c1c67ba832..66c014c5cc 100644
--- a/test/rubygems/test_gem_resolver_best_set.rb
+++ b/test/rubygems/test_gem_resolver_best_set.rb
@@ -29,7 +29,7 @@ class TestGemResolverBestSet < Gem::TestCase
found = set.find_all req
- assert_equal %w[a-1], found.map {|s| s.full_name }
+ assert_equal %w[a-1], found.map(&:full_name)
end
def test_find_all_fallback
@@ -49,7 +49,7 @@ class TestGemResolverBestSet < Gem::TestCase
found = set.find_all req
- assert_equal %w[a-1], found.map {|s| s.full_name }
+ assert_equal %w[a-1], found.map(&:full_name)
end
def test_find_all_local
diff --git a/test/rubygems/test_gem_resolver_index_set.rb b/test/rubygems/test_gem_resolver_index_set.rb
index 3b8f047808..15d6465a78 100644
--- a/test/rubygems/test_gem_resolver_index_set.rb
+++ b/test/rubygems/test_gem_resolver_index_set.rb
@@ -41,7 +41,7 @@ class TestGemResolverIndexSet < Gem::TestCase
found = set.find_all req
- assert_equal %w[a-1], found.map {|s| s.full_name }
+ assert_equal %w[a-1], found.map(&:full_name)
end
def test_find_all_local
@@ -82,6 +82,6 @@ class TestGemResolverIndexSet < Gem::TestCase
found = set.find_all req
- assert_equal %w[a-1.a], found.map {|s| s.full_name }
+ assert_equal %w[a-1.a], found.map(&:full_name)
end
end
diff --git a/test/rubygems/test_gem_resolver_installer_set.rb b/test/rubygems/test_gem_resolver_installer_set.rb
index 7617919e2c..432d483872 100644
--- a/test/rubygems/test_gem_resolver_installer_set.rb
+++ b/test/rubygems/test_gem_resolver_installer_set.rb
@@ -14,7 +14,7 @@ class TestGemResolverInstallerSet < Gem::TestCase
set.add_always_install dep("a")
- assert_equal %w[a-2], set.always_install.map {|s| s.full_name }
+ assert_equal %w[a-2], set.always_install.map(&:full_name)
e = assert_raise Gem::UnsatisfiableDependencyError do
set.add_always_install dep("b")
@@ -48,7 +48,7 @@ class TestGemResolverInstallerSet < Gem::TestCase
set.add_always_install dep("a")
- assert_equal %w[a-1], set.always_install.map {|s| s.full_name }
+ assert_equal %w[a-1], set.always_install.map(&:full_name)
end
def test_add_always_install_platform_if_gem_platforms_modified_by_platform_flag
@@ -67,7 +67,7 @@ class TestGemResolverInstallerSet < Gem::TestCase
set.add_always_install dep("a")
- assert_equal %w[a-1-x86-freebsd-9], set.always_install.map {|s| s.full_name }
+ assert_equal %w[a-1-x86-freebsd-9], set.always_install.map(&:full_name)
end
def test_add_always_install_index_spec_platform
@@ -80,7 +80,7 @@ class TestGemResolverInstallerSet < Gem::TestCase
set = Gem::Resolver::InstallerSet.new :both
set.add_always_install dep("a")
- assert_equal [Gem::Platform.local], set.always_install.map {|s| s.platform }
+ assert_equal [Gem::Platform.local], set.always_install.map(&:platform)
end
def test_add_always_install_prerelease
@@ -93,7 +93,7 @@ class TestGemResolverInstallerSet < Gem::TestCase
set.add_always_install dep("a")
- assert_equal %w[a-1], set.always_install.map {|s| s.full_name }
+ assert_equal %w[a-1], set.always_install.map(&:full_name)
end
def test_add_always_install_prerelease_github_problem
@@ -111,7 +111,7 @@ class TestGemResolverInstallerSet < Gem::TestCase
set.add_always_install dep("a")
- assert_equal %w[a-1], set.always_install.map {|s| s.full_name }
+ assert_equal %w[a-1], set.always_install.map(&:full_name)
end
def test_add_always_install_prerelease_only
@@ -142,7 +142,7 @@ class TestGemResolverInstallerSet < Gem::TestCase
req = Gem::Resolver::DependencyRequest.new dep("a"), nil
- assert_equal %w[a-1], set.find_all(req).map {|spec| spec.full_name }
+ assert_equal %w[a-1], set.find_all(req).map(&:full_name)
end
def test_consider_local_eh
@@ -198,7 +198,7 @@ class TestGemResolverInstallerSet < Gem::TestCase
req = Gem::Resolver::DependencyRequest.new dep("a"), nil
- assert_equal %w[a-2], set.find_all(req).map {|spec| spec.full_name }
+ assert_equal %w[a-2], set.find_all(req).map(&:full_name)
end
def test_find_all_prerelease
@@ -211,12 +211,12 @@ class TestGemResolverInstallerSet < Gem::TestCase
req = Gem::Resolver::DependencyRequest.new dep("a"), nil
- assert_equal %w[a-1], set.find_all(req).map {|spec| spec.full_name }
+ assert_equal %w[a-1], set.find_all(req).map(&:full_name)
req = Gem::Resolver::DependencyRequest.new dep("a", ">= 0.a"), nil
assert_equal %w[a-1 a-1.a],
- set.find_all(req).map {|spec| spec.full_name }.sort
+ set.find_all(req).map(&:full_name).sort
end
def test_find_all_prerelease_dependencies_with_add_local
@@ -228,7 +228,7 @@ class TestGemResolverInstallerSet < Gem::TestCase
req = Gem::Resolver::DependencyRequest.new dep("activesupport", ">= 4.2.0"), nil
- assert_equal %w[activesupport-7.1.0.alpha], set.find_all(req).map {|spec| spec.full_name }
+ assert_equal %w[activesupport-7.1.0.alpha], set.find_all(req).map(&:full_name)
end
def test_load_spec
diff --git a/test/rubygems/test_gem_resolver_lock_set.rb b/test/rubygems/test_gem_resolver_lock_set.rb
index e01d73093c..cc9a510c9d 100644
--- a/test/rubygems/test_gem_resolver_lock_set.rb
+++ b/test/rubygems/test_gem_resolver_lock_set.rb
@@ -15,7 +15,7 @@ class TestGemResolverLockSet < Gem::TestCase
specs = @set.add "a", "2", Gem::Platform::RUBY
spec = specs.first
- assert_equal %w[a-2], @set.specs.map {|t| t.full_name }
+ assert_equal %w[a-2], @set.specs.map(&:full_name)
assert_kind_of Gem::Resolver::LockSpecification, spec
@@ -33,11 +33,11 @@ class TestGemResolverLockSet < Gem::TestCase
found = @set.find_all dep "a"
- assert_equal %w[a-2], found.map {|s| s.full_name }
+ assert_equal %w[a-2], found.map(&:full_name)
found = @set.find_all dep "a", ">= 0.a"
- assert_equal %w[a-1.a a-2], found.map {|s| s.full_name }
+ assert_equal %w[a-1.a a-2], found.map(&:full_name)
end
def test_load_spec
diff --git a/test/rubygems/test_gem_security_signer.rb b/test/rubygems/test_gem_security_signer.rb
index 6b2a4a201a..f71f08957d 100644
--- a/test/rubygems/test_gem_security_signer.rb
+++ b/test/rubygems/test_gem_security_signer.rb
@@ -36,8 +36,8 @@ class TestGemSecuritySigner < Gem::TestCase
def test_initialize_cert_chain_mixed
signer = Gem::Security::Signer.new nil, [@cert_file, CHILD_CERT]
- assert_equal [PUBLIC_CERT, CHILD_CERT].map {|c| c.to_pem },
- signer.cert_chain.map {|c| c.to_pem }
+ assert_equal [PUBLIC_CERT, CHILD_CERT].map(&:to_pem),
+ signer.cert_chain.map(&:to_pem)
end
def test_initialize_cert_chain_invalid
@@ -49,8 +49,8 @@ class TestGemSecuritySigner < Gem::TestCase
def test_initialize_cert_chain_path
signer = Gem::Security::Signer.new nil, [@cert_file]
- assert_equal [PUBLIC_CERT].map {|c| c.to_pem },
- signer.cert_chain.map {|c| c.to_pem }
+ assert_equal [PUBLIC_CERT].map(&:to_pem),
+ signer.cert_chain.map(&:to_pem)
end
def test_initialize_default
@@ -65,7 +65,7 @@ class TestGemSecuritySigner < Gem::TestCase
signer = Gem::Security::Signer.new nil, nil
assert_equal PRIVATE_KEY.to_pem, signer.key.to_pem
- assert_equal [PUBLIC_CERT.to_pem], signer.cert_chain.map {|c| c.to_pem }
+ assert_equal [PUBLIC_CERT.to_pem], signer.cert_chain.map(&:to_pem)
end
def test_initialize_key_path
@@ -99,7 +99,7 @@ class TestGemSecuritySigner < Gem::TestCase
signer.load_cert_chain
assert_equal [PUBLIC_CERT.to_pem, CHILD_CERT.to_pem],
- signer.cert_chain.map {|c| c.to_pem }
+ signer.cert_chain.map(&:to_pem)
end
def test_load_cert_chain_broken
@@ -111,7 +111,7 @@ class TestGemSecuritySigner < Gem::TestCase
signer.load_cert_chain
assert_equal [CHILD_CERT.to_pem, GRANDCHILD_CERT.to_pem],
- signer.cert_chain.map {|c| c.to_pem }
+ signer.cert_chain.map(&:to_pem)
end
def test_sign
diff --git a/test/rubygems/test_gem_source.rb b/test/rubygems/test_gem_source.rb
index af39303085..fa82098dc5 100644
--- a/test/rubygems/test_gem_source.rb
+++ b/test/rubygems/test_gem_source.rb
@@ -104,9 +104,7 @@ class TestGemSource < Gem::TestCase
end
def test_fetch_spec_platform
- specs = spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ specs = spec_fetcher(&:legacy_platform)
spec = @source.fetch_spec tuple("pl", Gem::Version.new(1), "i386-linux")
@@ -122,7 +120,7 @@ class TestGemSource < Gem::TestCase
end
def test_load_specs
- released = @source.load_specs(:released).map {|spec| spec.full_name }
+ released = @source.load_specs(:released).map(&:full_name)
assert_equal %W[a-2 a-1 b-2], released
cache_dir = File.join Gem.spec_cache_dir, "gems.example.com%80"
diff --git a/test/rubygems/test_gem_source_git.rb b/test/rubygems/test_gem_source_git.rb
index 3ece28b147..1c8fcf9e9f 100644
--- a/test/rubygems/test_gem_source_git.rb
+++ b/test/rubygems/test_gem_source_git.rb
@@ -251,7 +251,7 @@ class TestGemSourceGit < Gem::TestCase
specs = source.specs
end
- assert_equal %w[a-1 b-1], specs.map {|spec| spec.full_name }
+ assert_equal %w[a-1 b-1], specs.map(&:full_name)
a_spec = specs.shift
diff --git a/test/rubygems/test_gem_source_local.rb b/test/rubygems/test_gem_source_local.rb
index ace3923009..2e16389850 100644
--- a/test/rubygems/test_gem_source_local.rb
+++ b/test/rubygems/test_gem_source_local.rb
@@ -72,7 +72,7 @@ class TestGemSourceLocal < Gem::TestCase
@sl.load_specs :released
- inner = [@a, @ap, @b].map {|t| t.name_tuple }.inspect
+ inner = [@a, @ap, @b].map(&:name_tuple).inspect
assert_equal "#<Gem::Source::Local specs: #{inner}>", @sl.inspect
end
diff --git a/test/rubygems/test_gem_source_subpath_problem.rb b/test/rubygems/test_gem_source_subpath_problem.rb
index 219c344290..e52cb58868 100644
--- a/test/rubygems/test_gem_source_subpath_problem.rb
+++ b/test/rubygems/test_gem_source_subpath_problem.rb
@@ -43,7 +43,7 @@ class TestGemSourceSubpathProblem < Gem::TestCase
Gem::NameTuple.new(@b2.name, @b2.version, "ruby"),
]))
- released = @source.load_specs(:latest).map {|spec| spec.full_name }
+ released = @source.load_specs(:latest).map(&:full_name)
assert_equal %W[a-1 b-2], released
end
end
diff --git a/test/rubygems/test_gem_spec_fetcher.rb b/test/rubygems/test_gem_spec_fetcher.rb
index f23a93350b..cd6aa8e9b2 100644
--- a/test/rubygems/test_gem_spec_fetcher.rb
+++ b/test/rubygems/test_gem_spec_fetcher.rb
@@ -108,9 +108,7 @@ class TestGemSpecFetcher < Gem::TestCase
def test_spec_for_dependency_platform
util_set_arch "i386-linux"
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
dep = Gem::Dependency.new "pl", 1
specs_and_sources, _ = @sf.spec_for_dependency dep
@@ -126,9 +124,7 @@ class TestGemSpecFetcher < Gem::TestCase
def test_spec_for_dependency_mismatched_platform
util_set_arch "hrpa-989"
- spec_fetcher do |fetcher|
- fetcher.legacy_platform
- end
+ spec_fetcher(&:legacy_platform)
dep = Gem::Dependency.new "pl", 1
specs_and_sources, errors = @sf.spec_for_dependency dep
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index d326efc17e..a49a0d32b9 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -691,7 +691,7 @@ end
version
]
- actual_value = Gem::Specification.attribute_names.map {|a| a.to_s }.sort
+ actual_value = Gem::Specification.attribute_names.map(&:to_s).sort
assert_equal expected_value, actual_value
end
@@ -964,13 +964,13 @@ dependencies: []
install_specs @a1
assert_includes Gem::Specification.all_names, "a-1"
- assert_includes Gem::Specification.stubs.map {|s| s.full_name }, "a-1"
+ assert_includes Gem::Specification.stubs.map(&:full_name), "a-1"
uninstall_gem @a1
Gem::Specification.reset
refute_includes Gem::Specification.all_names, "a-1"
- refute_includes Gem::Specification.stubs.map {|s| s.full_name }, "a-1"
+ refute_includes Gem::Specification.stubs.map(&:full_name), "a-1"
end
def test_self_remove_spec_removed
@@ -985,7 +985,7 @@ dependencies: []
Gem::Specification.reset
refute_includes Gem::Specification.all_names, "a-1"
- refute_includes Gem::Specification.stubs.map {|s| s.full_name }, "a-1"
+ refute_includes Gem::Specification.stubs.map(&:full_name), "a-1"
end
def test_self_stubs_for_lazy_loading
@@ -997,14 +997,14 @@ dependencies: []
save_gemspec("a-1", "1", dir_standard_specs) {|s| s.name = "a" }
save_gemspec("b-1", "1", dir_standard_specs) {|s| s.name = "b" }
- assert_equal ["a-1"], Gem::Specification.stubs_for("a").map {|s| s.full_name }
+ assert_equal ["a-1"], Gem::Specification.stubs_for("a").map(&:full_name)
assert_equal 1, Gem::Specification.class_variable_get(:@@stubs_by_name).length
- assert_equal ["b-1"], Gem::Specification.stubs_for("b").map {|s| s.full_name }
+ assert_equal ["b-1"], Gem::Specification.stubs_for("b").map(&:full_name)
assert_equal 2, Gem::Specification.class_variable_get(:@@stubs_by_name).length
assert_equal(
- Gem::Specification.stubs_for("a").map {|s| s.object_id },
- Gem::Specification.stubs_for("a").map {|s| s.object_id }
+ Gem::Specification.stubs_for("a").map(&:object_id),
+ Gem::Specification.stubs_for("a").map(&:object_id)
)
Gem.loaded_specs.delete "a"
@@ -1017,7 +1017,7 @@ dependencies: []
save_gemspec("b-1", "1", File.join(Gem.dir, "specifications")) {|s| s.name = "b" }
- assert_equal [], Gem::Specification.stubs_for("b").map {|s| s.full_name }
+ assert_equal [], Gem::Specification.stubs_for("b").map(&:full_name)
end
def test_self_stubs_for_mult_platforms
@@ -1254,7 +1254,7 @@ dependencies: []
awesome.add_dependency :gem_name
end
- assert_equal %w[true gem_name], gem.dependencies.map {|dep| dep.name }
+ assert_equal %w[true gem_name], gem.dependencies.map(&:name)
end
def test_add_dependency_from_existing_dependency
@@ -1324,9 +1324,7 @@ dependencies: []
assert_empty @ext.build_args
- File.open @ext.build_info_file, "w" do |io|
- io.puts
- end
+ File.open @ext.build_info_file, "w", &:puts
assert_empty @ext.build_args
@@ -2188,7 +2186,7 @@ dependencies: []
expected = %w[rake jabber4r pqa]
- assert_equal expected, @c1.runtime_dependencies.map {|d| d.name }
+ assert_equal expected, @c1.runtime_dependencies.map(&:name)
end
def test_spaceship_name