diff options
Diffstat (limited to 'test')
32 files changed, 366 insertions, 366 deletions
diff --git a/test/rubygems/bundler_test_gem.rb b/test/rubygems/bundler_test_gem.rb index 319112bac8..ca2980e04b 100644 --- a/test/rubygems/bundler_test_gem.rb +++ b/test/rubygems/bundler_test_gem.rb @@ -131,9 +131,9 @@ class TestBundlerGem < Gem::TestCase install_specs a, b, c - install_gem a, :install_dir => path - install_gem b, :install_dir => path - install_gem c, :install_dir => path + install_gem a, install_dir: path + install_gem b, install_dir: path + install_gem c, install_dir: path ENV["GEM_PATH"] = path @@ -183,9 +183,9 @@ class TestBundlerGem < Gem::TestCase install_specs a, b, c - install_gem a, :install_dir => path - install_gem b, :install_dir => path - install_gem c, :install_dir => path + install_gem a, install_dir: path + install_gem b, install_dir: path + install_gem c, install_dir: path ENV["GEM_PATH"] = path @@ -201,7 +201,7 @@ class TestBundlerGem < Gem::TestCase f.puts "gem 'a'" end out0 = with_path_and_rubyopt(new_path, new_rubyopt) do - IO.popen("foo", :chdir => "sub1", &:read).split(/\n/) + IO.popen("foo", chdir: "sub1", &:read).split(/\n/) end File.open path, "a" do |f| @@ -209,7 +209,7 @@ class TestBundlerGem < Gem::TestCase f.puts "gem 'c'" end out = with_path_and_rubyopt(new_path, new_rubyopt) do - IO.popen("foo", :chdir => "sub1", &:read).split(/\n/) + IO.popen("foo", chdir: "sub1", &:read).split(/\n/) end Dir.rmdir "sub1" diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb index 705ed71f0c..1cdf7c4459 100644 --- a/test/rubygems/helper.rb +++ b/test/rubygems/helper.rb @@ -607,14 +607,14 @@ class Gem::TestCase < Test::Unit::TestCase gem = File.join(@tempdir, File.basename(gem)) end - Gem::Installer.at(gem, options.merge({ :wrappers => true })).install + Gem::Installer.at(gem, options.merge({ wrappers: true })).install end ## # Builds and installs the Gem::Specification +spec+ into the user dir def install_gem_user(spec) - install_gem spec, :user_install => true + install_gem spec, user_install: true end ## @@ -626,7 +626,7 @@ class Gem::TestCase < Test::Unit::TestCase def ask_if_ok(spec) true end - end.new(spec.name, :executables => true, :user_install => true).uninstall + end.new(spec.name, executables: true, user_install: true).uninstall end ## @@ -778,7 +778,7 @@ class Gem::TestCase < Test::Unit::TestCase def install_specs(*specs) specs.each do |spec| - Gem::Installer.for_spec(spec, :force => true).install + Gem::Installer.for_spec(spec, force: true).install end Gem.searcher = nil @@ -789,7 +789,7 @@ class Gem::TestCase < Test::Unit::TestCase def install_default_gems(*specs) specs.each do |spec| - installer = Gem::Installer.for_spec(spec, :install_as_default => true) + installer = Gem::Installer.for_spec(spec, install_as_default: true) installer.install Gem.register_default_spec(spec) end diff --git a/test/rubygems/installer_test_case.rb b/test/rubygems/installer_test_case.rb index dc978d06b0..abddcbe848 100644 --- a/test/rubygems/installer_test_case.rb +++ b/test/rubygems/installer_test_case.rb @@ -163,7 +163,7 @@ class Gem::InstallerTestCase < Gem::TestCase @user_gem = @user_spec.cache_file - Gem::Installer.at @user_gem, :user_install => true + Gem::Installer.at @user_gem, user_install: true end ## @@ -215,7 +215,7 @@ class Gem::InstallerTestCase < Gem::TestCase end end - Gem::Installer.at @gem, :force => force + Gem::Installer.at @gem, force: force end ## @@ -223,8 +223,8 @@ class Gem::InstallerTestCase < Gem::TestCase def util_installer(spec, gem_home, force=true) Gem::Installer.at(spec.cache_file, - :install_dir => gem_home, - :force => force) + install_dir: gem_home, + force: force) end @@symlink_supported = nil diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 6537afad2a..d4c307978e 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -96,7 +96,7 @@ class TestGem < Gem::TestCase gemhome2 = "#{@gemhome}2" - installed = Gem.install "a", "= 1", :install_dir => gemhome2 + installed = Gem.install "a", "= 1", install_dir: gemhome2 assert_equal %w[a-1], installed.map(&:full_name) @@ -115,7 +115,7 @@ class TestGem < Gem::TestCase begin raise "Error" rescue StandardError - Gem.install "a", "= 1", :install_dir => gemhome2 + Gem.install "a", "= 1", install_dir: gemhome2 end assert_equal %w[a-1], installed.map(&:full_name) end @@ -154,11 +154,11 @@ class TestGem < Gem::TestCase def assert_self_install_permissions(format_executable: false) mask = Gem.win_platform? ? 0o700 : 0o777 options = { - :dir_mode => 0o500, - :prog_mode => Gem.win_platform? ? 0o410 : 0o510, - :data_mode => 0o640, - :wrappers => true, - :format_executable => format_executable, + dir_mode: 0o500, + prog_mode: Gem.win_platform? ? 0o410 : 0o510, + data_mode: 0o640, + wrappers: true, + format_executable: format_executable, } Dir.chdir @tempdir do Dir.mkdir "bin" @@ -1552,9 +1552,9 @@ class TestGem < Gem::TestCase g = util_spec "g", "1", nil, "lib/g.rb" m = util_spec "m", "1", nil, "lib/m.rb" - install_gem g, :install_dir => Gem.dir - m0 = install_gem m, :install_dir => Gem.dir - m1 = install_gem m, :install_dir => Gem.user_dir + install_gem g, install_dir: Gem.dir + m0 = install_gem m, install_dir: Gem.dir + m1 = install_gem m, install_dir: Gem.user_dir assert_equal m0.gem_dir, File.join(Gem.dir, "gems", "m-1") assert_equal m1.gem_dir, File.join(Gem.user_dir, "gems", "m-1") @@ -1608,9 +1608,9 @@ class TestGem < Gem::TestCase g = util_spec "g", "1", nil, "lib/g.rb" m = util_spec "m", "1", nil, "lib/m.rb" - install_gem g, :install_dir => Gem.dir - install_gem m, :install_dir => Gem.dir - install_gem m, :install_dir => Gem.user_dir + install_gem g, install_dir: Gem.dir + install_gem m, install_dir: Gem.dir + install_gem m, install_dir: Gem.user_dir Gem.use_paths Gem.dir, [Gem.dir, Gem.user_dir] diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb index 3d0f04830e..3695f9488f 100644 --- a/test/rubygems/test_gem_command.rb +++ b/test/rubygems/test_gem_command.rb @@ -92,7 +92,7 @@ class TestGemCommand < Gem::TestCase options[:help] = value end - @cmd.defaults = { :help => true } + @cmd.defaults = { help: true } @cmd.when_invoked do |options| assert options[:help], "Help options should default true" diff --git a/test/rubygems/test_gem_commands_cleanup_command.rb b/test/rubygems/test_gem_commands_cleanup_command.rb index 732b3288a5..bcb8871b57 100644 --- a/test/rubygems/test_gem_commands_cleanup_command.rb +++ b/test/rubygems/test_gem_commands_cleanup_command.rb @@ -169,7 +169,7 @@ class TestGemCommandsCleanupCommand < Gem::TestCase FileUtils.chmod 0o555, @gemhome @a_1_1, = util_gem "a", "1.1" - @a_1_1 = install_gem @a_1_1, :user_install => true # pick up user install path + @a_1_1 = install_gem @a_1_1, user_install: true # pick up user install path Gem::Specification.dirs = [Gem.dir, Gem.user_dir] @@ -243,11 +243,11 @@ class TestGemCommandsCleanupCommand < Gem::TestCase e_1, = util_gem "e", "1" e_2, = util_gem "e", "2" - c_1 = install_gem c_1, :user_install => true # pick up user install path + c_1 = install_gem c_1, user_install: true # pick up user install path c_2 = install_gem c_2 d_1 = install_gem d_1 - d_2 = install_gem d_2, :user_install => true # pick up user install path + d_2 = install_gem d_2, user_install: true # pick up user install path e_1 = install_gem e_1 e_2 = install_gem e_2 @@ -270,8 +270,8 @@ class TestGemCommandsCleanupCommand < Gem::TestCase d_1, = util_gem "d", "1.0" d_2, = util_gem "d", "1.1" - c_1 = install_gem c_1, :user_install => true # pick up user install path - c_2 = install_gem c_2, :user_install => true # pick up user install path + c_1 = install_gem c_1, user_install: true # pick up user install path + c_2 = install_gem c_2, user_install: true # pick up user install path d_1 = install_gem d_1 d_2 = install_gem d_2 diff --git a/test/rubygems/test_gem_commands_exec_command.rb b/test/rubygems/test_gem_commands_exec_command.rb index 28da23cc3b..e52fe247a2 100644 --- a/test/rubygems/test_gem_commands_exec_command.rb +++ b/test/rubygems/test_gem_commands_exec_command.rb @@ -71,10 +71,10 @@ class TestGemCommandsExecCommand < Gem::TestCase assert_equal options, { args: ["install", "--no-color", "--help", "--verbose"], executable: "pod", - :explicit_prerelease => false, + explicit_prerelease: false, gem_name: "cocoapods", prerelease: false, - :version => Gem::Requirement.new(["> 1", "< 1.3"]), + version: Gem::Requirement.new(["> 1", "< 1.3"]), build_args: nil, } end @@ -87,7 +87,7 @@ class TestGemCommandsExecCommand < Gem::TestCase args: [], executable: "rails", gem_name: "rails", - :version => Gem::Requirement.new([">= 0"]), + version: Gem::Requirement.new([">= 0"]), build_args: nil, } end @@ -100,7 +100,7 @@ class TestGemCommandsExecCommand < Gem::TestCase args: [], executable: "rails", gem_name: "rails", - :version => Gem::Requirement.new(["= 7.1"]), + version: Gem::Requirement.new(["= 7.1"]), build_args: nil, } end diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb index c38c94e5e2..5b09512ac4 100644 --- a/test/rubygems/test_gem_commands_install_command.rb +++ b/test/rubygems/test_gem_commands_install_command.rb @@ -1337,7 +1337,7 @@ ERROR: Possible alternatives: non_existent_with_hint fetcher.gem "r", "2.0", "q" => nil end - i = Gem::Installer.at specs["q-1.0"].cache_file, :install_dir => "gf-path" + i = Gem::Installer.at specs["q-1.0"].cache_file, install_dir: "gf-path" i.install assert File.file?("gf-path/specifications/q-1.0.gemspec"), "not installed" diff --git a/test/rubygems/test_gem_commands_pristine_command.rb b/test/rubygems/test_gem_commands_pristine_command.rb index 0f878b8513..a17d7837c9 100644 --- a/test/rubygems/test_gem_commands_pristine_command.rb +++ b/test/rubygems/test_gem_commands_pristine_command.rb @@ -296,7 +296,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase build_args = %w[--with-awesome=true --sweet] - install_gem a, :build_args => build_args + install_gem a, build_args: build_args @cmd.options[:args] = %w[a] diff --git a/test/rubygems/test_gem_commands_push_command.rb b/test/rubygems/test_gem_commands_push_command.rb index bb0363da1a..d4f0794a98 100644 --- a/test/rubygems/test_gem_commands_push_command.rb +++ b/test/rubygems/test_gem_commands_push_command.rb @@ -230,7 +230,7 @@ class TestGemCommandsPushCommand < Gem::TestCase @api_key = "DOESNTMATTER" keys = { - :rubygems_api_key => @api_key, + rubygems_api_key: @api_key, } File.open Gem.configuration.credentials_path, "w" do |f| diff --git a/test/rubygems/test_gem_commands_stale_command.rb b/test/rubygems/test_gem_commands_stale_command.rb index 1c224d0785..ea7493b418 100644 --- a/test/rubygems/test_gem_commands_stale_command.rb +++ b/test/rubygems/test_gem_commands_stale_command.rb @@ -25,11 +25,11 @@ class TestGemCommandsStaleCommand < Gem::TestCase files.each do |file| filename = File.join(bar_baz.full_gem_path, file) FileUtils.mkdir_p File.dirname filename - FileUtils.touch(filename, :mtime => Time.now) + FileUtils.touch(filename, mtime: Time.now) filename = File.join(foo_bar.full_gem_path, file) FileUtils.mkdir_p File.dirname filename - FileUtils.touch(filename, :mtime => Time.now - 86_400) + FileUtils.touch(filename, mtime: Time.now - 86_400) end use_ui @stub_ui do diff --git a/test/rubygems/test_gem_commands_uninstall_command.rb b/test/rubygems/test_gem_commands_uninstall_command.rb index 5dd10a4c00..4daa61cb0c 100644 --- a/test/rubygems/test_gem_commands_uninstall_command.rb +++ b/test/rubygems/test_gem_commands_uninstall_command.rb @@ -21,7 +21,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase gemhome2 = "#{@gemhome}2" a_4, = util_gem "a", 4 - install_gem a_4, :install_dir => gemhome2 + install_gem a_4, install_dir: gemhome2 assert_gems_presence "a-1", "a-4", "b-2", "default-1", dirs: [@gemhome, gemhome2] @@ -381,7 +381,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase gemhome2 = "#{@gemhome}2" a_4, = util_gem "a", 4 - install_gem a_4, :install_dir => gemhome2 + install_gem a_4, install_dir: gemhome2 assert_gems_presence "a-4", dirs: [@gemhome, gemhome2] @@ -400,7 +400,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase gemhome2 = "#{@gemhome}2" a_4, = util_gem "a", 4 - install_gem a_4, :install_dir => gemhome2 + install_gem a_4, install_dir: gemhome2 assert_gems_presence "a-4", dirs: [@gemhome, gemhome2] diff --git a/test/rubygems/test_gem_commands_update_command.rb b/test/rubygems/test_gem_commands_update_command.rb index 02dd57f660..324bd9c747 100644 --- a/test/rubygems/test_gem_commands_update_command.rb +++ b/test/rubygems/test_gem_commands_update_command.rb @@ -205,7 +205,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase gemhome2 = "#{@gemhome}2" - Gem::Installer.at(rubygems_update_package, :install_dir => gemhome2).install + Gem::Installer.at(rubygems_update_package, install_dir: gemhome2).install Gem.use_paths @gemhome, [gemhome2, @gemhome] @@ -670,10 +670,10 @@ class TestGemCommandsUpdateCommand < Gem::TestCase @cmd.handle_options %w[--system] expected = { - :args => [], - :document => %w[ri], - :force => false, - :system => true, + args: [], + document: %w[ri], + force: false, + system: true, } assert_equal expected, @cmd.options @@ -689,10 +689,10 @@ class TestGemCommandsUpdateCommand < Gem::TestCase @cmd.handle_options %w[--system 1.3.7] expected = { - :args => [], - :document => %w[ri], - :force => false, - :system => "1.3.7", + args: [], + document: %w[ri], + force: false, + system: "1.3.7", } assert_equal expected, @cmd.options diff --git a/test/rubygems/test_gem_config_file.rb b/test/rubygems/test_gem_config_file.rb index f53125cc0c..ad120d2aaa 100644 --- a/test/rubygems/test_gem_config_file.rb +++ b/test/rubygems/test_gem_config_file.rb @@ -191,7 +191,7 @@ class TestGemConfigFile < Gem::TestCase util_config_file - assert_equal({ :rubygems => "701229f217cdf23b1344c7b4b54ca97" }, + assert_equal({ rubygems: "701229f217cdf23b1344c7b4b54ca97" }, @cfg.api_keys) end @@ -369,7 +369,7 @@ if you believe they were disclosed to a third party. assert_equal "x", @cfg.rubygems_api_key expected = { - :rubygems_api_key => "x", + rubygems_api_key: "x", } assert_equal expected, load_yaml_file(@cfg.credentials_path) @@ -393,7 +393,7 @@ if you believe they were disclosed to a third party. end expected = { - :rubygems_api_key => "x", + rubygems_api_key: "x", } assert_equal expected, load_yaml_file(@cfg.credentials_path) @@ -542,7 +542,7 @@ if you believe they were disclosed to a third party. end def test_dump_with_rubygems_yaml - symbol_key_hash = { :foo => "bar" } + symbol_key_hash = { foo: "bar" } actual = Gem::ConfigFile.dump_with_rubygems_yaml(symbol_key_hash) diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb index f43c221a9d..f08274eac8 100644 --- a/test/rubygems/test_gem_dependency_installer.rb +++ b/test/rubygems/test_gem_dependency_installer.rb @@ -75,7 +75,7 @@ class TestGemDependencyInstaller < Gem::TestCase @fetcher.data["http://gems.example.com/gems/a-10.a.gem"] = p1a_data dep = Gem::Dependency.new "a" - inst = Gem::DependencyInstaller.new :prerelease => true + inst = Gem::DependencyInstaller.new prerelease: true inst.install dep assert_equal %w[a-10.a], Gem::Specification.map(&:full_name) @@ -97,7 +97,7 @@ class TestGemDependencyInstaller < Gem::TestCase dep = Gem::Dependency.new "a" - inst = Gem::DependencyInstaller.new :prerelease => true + inst = Gem::DependencyInstaller.new prerelease: true inst.install dep assert_equal %w[a-1.b b-1.b c-1.1.b], Gem::Specification.map(&:full_name) @@ -132,7 +132,7 @@ class TestGemDependencyInstaller < Gem::TestCase @fetcher.data["http://gems.example.com/gems/a-1.gem"] = p1a_data dep = Gem::Dependency.new "a" - inst = Gem::DependencyInstaller.new :prerelease => true + inst = Gem::DependencyInstaller.new prerelease: true inst.install dep assert_equal %w[a-1], Gem::Specification.map(&:full_name) @@ -153,7 +153,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :ignore_dependencies => true + inst = Gem::DependencyInstaller.new ignore_dependencies: true inst.install "b" end @@ -178,7 +178,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir dir do - inst = Gem::DependencyInstaller.new :cache_dir => @tempdir + inst = Gem::DependencyInstaller.new cache_dir: @tempdir inst.install "b" end @@ -274,7 +274,7 @@ class TestGemDependencyInstaller < Gem::TestCase FileUtils.mv @b1_gem, @tempdir Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new(:build_docs_in_background => false) + inst = Gem::DependencyInstaller.new(build_docs_in_background: false) inst.install "b" end @@ -294,7 +294,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new(:development => true) + inst = Gem::DependencyInstaller.new(development: true) inst.install "b" end @@ -314,7 +314,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new(:development => true) + inst = Gem::DependencyInstaller.new(development: true) inst.install "d" end @@ -334,7 +334,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new(:development => true, :dev_shallow => true) + inst = Gem::DependencyInstaller.new(development: true, dev_shallow: true) inst.install "d" end @@ -421,7 +421,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :domain => :local + inst = Gem::DependencyInstaller.new domain: :local inst.install "a-1.gem" end @@ -435,7 +435,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :domain => :local + inst = Gem::DependencyInstaller.new domain: :local inst.install "a-1.a.gem" end @@ -451,7 +451,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :domain => :local + inst = Gem::DependencyInstaller.new domain: :local inst.install "b-1.gem" end @@ -469,7 +469,7 @@ class TestGemDependencyInstaller < Gem::TestCase Dir.chdir @tempdir do Gem::Installer.at("a-1.gem").install - inst = Gem::DependencyInstaller.new :domain => :local + inst = Gem::DependencyInstaller.new domain: :local inst.install "b-1.gem" end @@ -516,7 +516,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :domain => :local + inst = Gem::DependencyInstaller.new domain: :local inst.install "gems/a-1.gem" end @@ -542,7 +542,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :ignore_dependencies => true + inst = Gem::DependencyInstaller.new ignore_dependencies: true inst.install "b", req("= 1") end @@ -550,7 +550,7 @@ class TestGemDependencyInstaller < Gem::TestCase "sanity check" Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :minimal_deps => true + inst = Gem::DependencyInstaller.new minimal_deps: true inst.install "e" end @@ -576,7 +576,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :ignore_dependencies => true + inst = Gem::DependencyInstaller.new ignore_dependencies: true inst.install "b", req("= 1") end @@ -584,7 +584,7 @@ class TestGemDependencyInstaller < Gem::TestCase "sanity check" Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :minimal_deps => false + inst = Gem::DependencyInstaller.new minimal_deps: false inst.install "e" end @@ -601,7 +601,7 @@ class TestGemDependencyInstaller < Gem::TestCase assert_empty dep_installer.document end - inst = Gem::DependencyInstaller.new :domain => :local, :document => [] + inst = Gem::DependencyInstaller.new domain: :local, document: [] inst.install @a1_gem @@ -615,7 +615,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :env_shebang => true, :wrappers => true, :format_executable => false + inst = Gem::DependencyInstaller.new env_shebang: true, wrappers: true, format_executable: false inst.install "a" end @@ -634,7 +634,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :force => true + inst = Gem::DependencyInstaller.new force: true inst.install "b" end @@ -649,7 +649,7 @@ class TestGemDependencyInstaller < Gem::TestCase build_args = %w[--a --b="c"] Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new(:build_args => build_args) + inst = Gem::DependencyInstaller.new(build_args: build_args) inst.install "a" end @@ -663,7 +663,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :ignore_dependencies => true + inst = Gem::DependencyInstaller.new ignore_dependencies: true inst.install "b" end @@ -684,7 +684,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :install_dir => gemhome2 + inst = Gem::DependencyInstaller.new install_dir: gemhome2 inst.install "b" end @@ -708,7 +708,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :domain => :both + inst = Gem::DependencyInstaller.new domain: :both inst.install "b" end @@ -732,7 +732,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :domain => :both + inst = Gem::DependencyInstaller.new domain: :both inst.install "b" end @@ -747,7 +747,7 @@ class TestGemDependencyInstaller < Gem::TestCase Dir.chdir @tempdir do e = assert_raise Gem::UnsatisfiableDependencyError do - inst = Gem::DependencyInstaller.new :domain => :local + inst = Gem::DependencyInstaller.new domain: :local inst.install "b" end @@ -768,7 +768,7 @@ class TestGemDependencyInstaller < Gem::TestCase @fetcher.data["http://gems.example.com/gems/a-1.gem"] = a1_data - inst = Gem::DependencyInstaller.new :domain => :remote + inst = Gem::DependencyInstaller.new domain: :remote inst.install "a" assert_equal %w[a-1], inst.installed_gems.map(&:full_name) @@ -784,7 +784,7 @@ class TestGemDependencyInstaller < Gem::TestCase gemhome2 = "#{@gemhome}2" Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :install_dir => gemhome2 + inst = Gem::DependencyInstaller.new install_dir: gemhome2 inst.install "a" end @@ -811,7 +811,7 @@ class TestGemDependencyInstaller < Gem::TestCase inst = nil Dir.chdir @tempdir do - inst = Gem::DependencyInstaller.new :force => true + inst = Gem::DependencyInstaller.new force: true inst.install "a" end @@ -885,7 +885,7 @@ class TestGemDependencyInstaller < Gem::TestCase @fetcher.data["http://gems.example.com/gems/#{a2_o.file_name}"] = a2_o_data - inst = Gem::DependencyInstaller.new :domain => :remote + inst = Gem::DependencyInstaller.new domain: :remote inst.install "a" assert_equal %w[a-1], inst.installed_gems.map(&:full_name) @@ -896,7 +896,7 @@ class TestGemDependencyInstaller < Gem::TestCase s.platform = Gem::Platform.new %w[cpu other_platform 1] end - inst = Gem::DependencyInstaller.new :domain => :local + inst = Gem::DependencyInstaller.new domain: :local inst.install a_gem assert_equal %w[a-1-cpu-other_platform-1], inst.installed_gems.map(&:full_name) @@ -915,7 +915,7 @@ class TestGemDependencyInstaller < Gem::TestCase @fetcher.data["http://gems.example.com/gems/b-1.gem"] = data policy = Gem::Security::HighSecurity - inst = Gem::DependencyInstaller.new :security_policy => policy + inst = Gem::DependencyInstaller.new security_policy: policy e = assert_raise Gem::Security::Exception do inst.install "b" @@ -935,7 +935,7 @@ class TestGemDependencyInstaller < Gem::TestCase @fetcher.data["http://gems.example.com/gems/a-1.gem"] = read_binary(@a1_gem) - inst = Gem::DependencyInstaller.new :wrappers => false, :format_executable => false + inst = Gem::DependencyInstaller.new wrappers: false, format_executable: false inst.install "a" refute_match(/This file was generated by RubyGems./, @@ -1155,7 +1155,7 @@ class TestGemDependencyInstaller < Gem::TestCase FileUtils.mv @a1_gem, @tempdir FileUtils.mv @b1_gem, @tempdir - inst = Gem::DependencyInstaller.new :ignore_dependencies => true + inst = Gem::DependencyInstaller.new ignore_dependencies: true request_set = inst.resolve_dependencies "b", req(">= 0") requests = request_set.sorted_requests.map(&:full_name) diff --git a/test/rubygems/test_gem_gemcutter_utilities.rb b/test/rubygems/test_gem_gemcutter_utilities.rb index 6bd6cfd979..31933c9419 100644 --- a/test/rubygems/test_gem_gemcutter_utilities.rb +++ b/test/rubygems/test_gem_gemcutter_utilities.rb @@ -53,7 +53,7 @@ class TestGemGemcutterUtilities < Gem::TestCase end def test_api_key - keys = { :rubygems_api_key => "KEY" } + keys = { rubygems_api_key: "KEY" } File.open Gem.configuration.credentials_path, "w" do |f| f.write Gem::ConfigFile.dump_with_rubygems_yaml(keys) @@ -65,7 +65,7 @@ class TestGemGemcutterUtilities < Gem::TestCase end def test_api_key_override - keys = { :rubygems_api_key => "KEY", :other => "OTHER" } + keys = { rubygems_api_key: "KEY", other: "OTHER" } File.open Gem.configuration.credentials_path, "w" do |f| f.write Gem::ConfigFile.dump_with_rubygems_yaml(keys) @@ -318,7 +318,7 @@ class TestGemGemcutterUtilities < Gem::TestCase end def test_verify_api_key - keys = { :other => "a5fdbb6ba150cbb83aad2bb2fede64cf040453903" } + keys = { other: "a5fdbb6ba150cbb83aad2bb2fede64cf040453903" } File.open Gem.configuration.credentials_path, "w" do |f| f.write Gem::ConfigFile.dump_with_rubygems_yaml(keys) end diff --git a/test/rubygems/test_gem_indexer.rb b/test/rubygems/test_gem_indexer.rb index 56bf3d9264..111c9154fe 100644 --- a/test/rubygems/test_gem_indexer.rb +++ b/test/rubygems/test_gem_indexer.rb @@ -56,7 +56,7 @@ class TestGemIndexer < Gem::TestCase assert_predicate indexer, :build_modern end - with_indexer(@indexerdir, :build_modern => true) do |indexer| + with_indexer(@indexerdir, build_modern: true) do |indexer| assert_predicate indexer, :build_modern end end diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb index d0f213fb8d..4fa8b7f4fe 100644 --- a/test/rubygems/test_gem_installer.rb +++ b/test/rubygems/test_gem_installer.rb @@ -299,7 +299,7 @@ gem 'other', version end policy = Gem::Security::HighSecurity - installer = Gem::Installer.at a_gem, :security_policy => policy + installer = Gem::Installer.at a_gem, security_policy: policy assert_raise Gem::Security::Exception do installer.ensure_loadable_spec @@ -352,8 +352,8 @@ gem 'other', version ENV["PATH"] = [ENV["PATH"], bin_dir].compact.join(File::PATH_SEPARATOR) options = { - :bin_dir => bin_dir, - :install_dir => "/non/existent", + bin_dir: bin_dir, + install_dir: "/non/existent", } inst = Gem::Installer.at "", options @@ -749,8 +749,8 @@ gem 'other', version installer = Gem::Installer.at( gem_with_dangling_symlink, - :user_install => false, - :force => true + user_install: false, + force: true ) build_rake_in do @@ -821,7 +821,7 @@ gem 'other', version File.chmod(0o555, Gem.plugindir) system_path = File.join(Gem.plugindir, "a_plugin.rb") user_path = File.join(Gem.plugindir(Gem.user_dir), "a_plugin.rb") - installer = Gem::Installer.at spec.cache_file, :user_install => true, :force => true + installer = Gem::Installer.at spec.cache_file, user_install: true, force: true assert_equal spec, installer.install @@ -846,7 +846,7 @@ gem 'other', version build_root = File.join(@tempdir, "build_root") build_root_path = File.join(build_root, Gem.plugindir.gsub(/^[a-zA-Z]:/, ""), "a_plugin.rb") - installer = Gem::Installer.at spec.cache_file, :build_root => build_root + installer = Gem::Installer.at spec.cache_file, build_root: build_root assert_equal spec, installer.install @@ -953,7 +953,7 @@ end path = Gem::Package.build @spec - installer = Gem::Installer.at path, :install_dir => "#{@gemhome}3" + installer = Gem::Installer.at path, install_dir: "#{@gemhome}3" assert_equal @spec, installer.install end @@ -977,7 +977,7 @@ end def test_initialize_user_install @gem = setup_base_gem - installer = Gem::Installer.at @gem, :user_install => true + installer = Gem::Installer.at @gem, user_install: true assert_equal File.join(Gem.user_dir, "gems", @spec.full_name), installer.gem_dir @@ -988,7 +988,7 @@ end @gem = setup_base_gem installer = - Gem::Installer.at @gem, :user_install => true, :bin_dir => @tempdir + Gem::Installer.at @gem, user_install: true, bin_dir: @tempdir assert_equal File.join(Gem.user_dir, "gems", @spec.full_name), installer.gem_dir @@ -1001,7 +1001,7 @@ end @gem = setup_base_gem installer = - Gem::Installer.at @gem, :install_dir => gemhome2, :user_install => true + Gem::Installer.at @gem, install_dir: gemhome2, user_install: true installer.install assert_path_exist File.join(gemhome2, "gems", @spec.full_name) @@ -1250,7 +1250,7 @@ end Gem::Package.build @spec end end - installer = Gem::Installer.at @gem, :force => true + installer = Gem::Installer.at @gem, force: true build_rake_in do use_ui @ui do assert_equal @spec, installer.install @@ -1268,7 +1268,7 @@ end end use_ui @ui do - installer = Gem::Installer.at missing_dep_gem, :force => true + installer = Gem::Installer.at missing_dep_gem, force: true installer.install end @@ -1280,7 +1280,7 @@ end build_root = File.join(@tempdir, "build_root") @gem = setup_base_gem - installer = Gem::Installer.at @gem, :build_root => build_root + installer = Gem::Installer.at @gem, build_root: build_root assert_equal @spec, installer.install end @@ -1294,7 +1294,7 @@ end FileUtils.chmod "-w", @gemhome - installer = Gem::Installer.at @gem, :build_root => build_root + installer = Gem::Installer.at @gem, build_root: build_root assert_equal @spec, installer.install @@ -1429,7 +1429,7 @@ end use_ui @ui do path = Gem::Package.build @spec - installer = Gem::Installer.at path, :post_install_message => false + installer = Gem::Installer.at path, post_install_message: false installer.install end @@ -1453,7 +1453,7 @@ end use_ui @ui do path = Gem::Package.build @spec - installer = Gem::Installer.at path, :install_dir => gemhome2 + installer = Gem::Installer.at path, install_dir: gemhome2 installer.install end @@ -1492,7 +1492,7 @@ end # reinstall the gem, this is also the same as pristine use_ui @ui do - installer = Gem::Installer.at path, :force => true + installer = Gem::Installer.at path, force: true installer.install end @@ -1518,7 +1518,7 @@ end use_ui @ui do path = Gem::Package.build @spec - installer = Gem::Installer.at path, :user_install => true + installer = Gem::Installer.at path, user_install: true installer.install end @@ -1770,7 +1770,7 @@ end # that it work everything out on it's own. Gem::Specification.reset - installer = Gem::Installer.at gem, :install_dir => gemhome2 + installer = Gem::Installer.at gem, install_dir: gemhome2 build_rake_in do use_ui @ui do @@ -1918,9 +1918,9 @@ end installer = Gem::Installer.at( gem_with_ill_formated_platform, - :install_dir => @gemhome, - :user_install => false, - :force => true + install_dir: @gemhome, + user_install: false, + force: true ) use_ui @ui do @@ -1960,7 +1960,7 @@ end plugins_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ""), "plugins") @gem = setup_base_gem - installer = use_ui(@ui) { Gem::Installer.at @gem, :build_root => build_root } + installer = use_ui(@ui) { Gem::Installer.at @gem, build_root: build_root } assert_equal build_root, installer.build_root assert_equal bin_dir, installer.bin_dir @@ -2301,7 +2301,7 @@ end def test_write_build_info_file_install_dir @gem = setup_base_gem - installer = Gem::Installer.at @gem, :install_dir => "#{@gemhome}2" + installer = Gem::Installer.at @gem, install_dir: "#{@gemhome}2" installer.build_args = %w[ --with-libyaml-dir /usr/local/Cellar/libyaml/0.1.4 @@ -2406,7 +2406,7 @@ end def test_default_gem_loaded_from spec = util_spec "a" - installer = Gem::Installer.for_spec spec, :install_as_default => true + installer = Gem::Installer.for_spec spec, install_as_default: true installer.install assert_predicate spec, :default_gem? end diff --git a/test/rubygems/test_gem_package_tar_header.rb b/test/rubygems/test_gem_package_tar_header.rb index bbdf20c23c..4469750f9a 100644 --- a/test/rubygems/test_gem_package_tar_header.rb +++ b/test/rubygems/test_gem_package_tar_header.rb @@ -8,19 +8,19 @@ class TestGemPackageTarHeader < Gem::Package::TarTestCase super header = { - :name => "x", - :mode => 0o644, - :uid => 1000, - :gid => 10_000, - :size => 100, - :mtime => 12_345, - :typeflag => "0", - :linkname => "link", - :uname => "user", - :gname => "group", - :devmajor => 1, - :devminor => 2, - :prefix => "y", + name: "x", + mode: 0o644, + uid: 1000, + gid: 10_000, + size: 100, + mtime: 12_345, + typeflag: "0", + linkname: "link", + uname: "user", + gname: "group", + devmajor: 1, + devminor: 2, + prefix: "y", } @tar_header = Gem::Package::TarHeader.new header @@ -59,29 +59,29 @@ class TestGemPackageTarHeader < Gem::Package::TarTestCase def test_initialize_bad assert_raise ArgumentError do - Gem::Package::TarHeader.new :name => "", :size => "", :mode => "" + Gem::Package::TarHeader.new name: "", size: "", mode: "" end assert_raise ArgumentError do - Gem::Package::TarHeader.new :name => "", :size => "", :prefix => "" + Gem::Package::TarHeader.new name: "", size: "", prefix: "" end assert_raise ArgumentError do - Gem::Package::TarHeader.new :name => "", :prefix => "", :mode => "" + Gem::Package::TarHeader.new name: "", prefix: "", mode: "" end assert_raise ArgumentError do - Gem::Package::TarHeader.new :prefix => "", :size => "", :mode => "" + Gem::Package::TarHeader.new prefix: "", size: "", mode: "" end end def test_initialize_typeflag header = { - :mode => "", - :name => "", - :prefix => "", - :size => "", - :typeflag => "", + mode: "", + name: "", + prefix: "", + size: "", + typeflag: "", } tar_header = Gem::Package::TarHeader.new header @@ -92,9 +92,9 @@ class TestGemPackageTarHeader < Gem::Package::TarTestCase def test_empty_eh refute_empty @tar_header - @tar_header = Gem::Package::TarHeader.new :name => "x", :prefix => "", - :mode => 0, :size => 0, - :empty => true + @tar_header = Gem::Package::TarHeader.new name: "x", prefix: "", + mode: 0, size: 0, + empty: true assert_empty @tar_header end diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb index 72df720825..e6971015c4 100644 --- a/test/rubygems/test_gem_remote_fetcher.rb +++ b/test/rubygems/test_gem_remote_fetcher.rb @@ -757,7 +757,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== def test_fetch_s3_config_creds Gem.configuration[:s3_source] = { - "my-bucket" => { :id => "testuser", :secret => "testpass" }, + "my-bucket" => { id: "testuser", secret: "testpass" }, } url = "s3://my-bucket/gems/specs.4.8.gz" Time.stub :now, Time.at(1_561_353_581) do @@ -769,7 +769,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== def test_fetch_s3_config_creds_with_region Gem.configuration[:s3_source] = { - "my-bucket" => { :id => "testuser", :secret => "testpass", :region => "us-west-2" }, + "my-bucket" => { id: "testuser", secret: "testpass", region: "us-west-2" }, } url = "s3://my-bucket/gems/specs.4.8.gz" Time.stub :now, Time.at(1_561_353_581) do @@ -781,7 +781,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== def test_fetch_s3_config_creds_with_token Gem.configuration[:s3_source] = { - "my-bucket" => { :id => "testuser", :secret => "testpass", :security_token => "testtoken" }, + "my-bucket" => { id: "testuser", secret: "testpass", security_token: "testtoken" }, } url = "s3://my-bucket/gems/specs.4.8.gz" Time.stub :now, Time.at(1_561_353_581) do @@ -796,7 +796,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== ENV["AWS_SECRET_ACCESS_KEY"] = "testpass" ENV["AWS_SESSION_TOKEN"] = nil Gem.configuration[:s3_source] = { - "my-bucket" => { :provider => "env" }, + "my-bucket" => { provider: "env" }, } url = "s3://my-bucket/gems/specs.4.8.gz" Time.stub :now, Time.at(1_561_353_581) do @@ -812,7 +812,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== ENV["AWS_SECRET_ACCESS_KEY"] = "testpass" ENV["AWS_SESSION_TOKEN"] = nil Gem.configuration[:s3_source] = { - "my-bucket" => { :provider => "env", :region => "us-west-2" }, + "my-bucket" => { provider: "env", region: "us-west-2" }, } url = "s3://my-bucket/gems/specs.4.8.gz" Time.stub :now, Time.at(1_561_353_581) do @@ -828,7 +828,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== ENV["AWS_SECRET_ACCESS_KEY"] = "testpass" ENV["AWS_SESSION_TOKEN"] = "testtoken" Gem.configuration[:s3_source] = { - "my-bucket" => { :provider => "env" }, + "my-bucket" => { provider: "env" }, } url = "s3://my-bucket/gems/specs.4.8.gz" Time.stub :now, Time.at(1_561_353_581) do @@ -848,7 +848,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== def test_fetch_s3_instance_profile_creds Gem.configuration[:s3_source] = { - "my-bucket" => { :provider => "instance_profile" }, + "my-bucket" => { provider: "instance_profile" }, } url = "s3://my-bucket/gems/specs.4.8.gz" @@ -862,7 +862,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== def test_fetch_s3_instance_profile_creds_with_region Gem.configuration[:s3_source] = { - "my-bucket" => { :provider => "instance_profile", :region => "us-west-2" }, + "my-bucket" => { provider: "instance_profile", region: "us-west-2" }, } url = "s3://my-bucket/gems/specs.4.8.gz" @@ -876,7 +876,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== def test_fetch_s3_instance_profile_creds_with_token Gem.configuration[:s3_source] = { - "my-bucket" => { :provider => "instance_profile" }, + "my-bucket" => { provider: "instance_profile" }, } url = "s3://my-bucket/gems/specs.4.8.gz" @@ -906,7 +906,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== def test_fetch_s3_no_host Gem.configuration[:s3_source] = { - "my-bucket" => { :id => "testuser", :secret => "testpass" }, + "my-bucket" => { id: "testuser", secret: "testpass" }, } url = "s3://other-bucket/gems/specs.4.8.gz" @@ -916,7 +916,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== end def test_fetch_s3_no_id - Gem.configuration[:s3_source] = { "my-bucket" => { :secret => "testpass" } } + Gem.configuration[:s3_source] = { "my-bucket" => { secret: "testpass" } } url = "s3://my-bucket/gems/specs.4.8.gz" refute_fetch_s3 url, "s3_source for my-bucket missing id or secret" @@ -925,7 +925,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== end def test_fetch_s3_no_secret - Gem.configuration[:s3_source] = { "my-bucket" => { :id => "testuser" } } + Gem.configuration[:s3_source] = { "my-bucket" => { id: "testuser" } } url = "s3://my-bucket/gems/specs.4.8.gz" refute_fetch_s3 url, "s3_source for my-bucket missing id or secret" @@ -984,7 +984,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== def test_ssl_client_cert_auth_connection ssl_server = start_ssl_server( - { :SSLVerifyClient => OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT } + { SSLVerifyClient: OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT } ) temp_ca_cert = File.join(__dir__, "ca_cert.pem") @@ -1000,7 +1000,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== def test_do_not_allow_invalid_client_cert_auth_connection ssl_server = start_ssl_server( - { :SSLVerifyClient => OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT } + { SSLVerifyClient: OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT } ) temp_ca_cert = File.join(__dir__, "ca_cert.pem") @@ -1146,15 +1146,15 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== null_logger = NilLog.new server = WEBrick::HTTPServer.new({ - :Port => 0, - :Logger => null_logger, - :AccessLog => [], - :SSLEnable => true, - :SSLCACertificateFile => File.join(__dir__, "ca_cert.pem"), - :SSLCertificate => cert("ssl_cert.pem"), - :SSLPrivateKey => key("ssl_key.pem"), - :SSLVerifyClient => nil, - :SSLCertName => nil, + Port: 0, + Logger: null_logger, + AccessLog: [], + SSLEnable: true, + SSLCACertificateFile: File.join(__dir__, "ca_cert.pem"), + SSLCertificate: cert("ssl_cert.pem"), + SSLPrivateKey: key("ssl_key.pem"), + SSLVerifyClient: nil, + SSLCertName: nil, }.merge(config)) server.mount_proc("/yaml") do |_req, res| res.body = "--- true\n" @@ -1186,10 +1186,10 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== def start_server(data) null_logger = NilLog.new s = WEBrick::HTTPServer.new( - :Port => 0, - :DocumentRoot => nil, - :Logger => null_logger, - :AccessLog => null_logger + Port: 0, + DocumentRoot: nil, + Logger: null_logger, + AccessLog: null_logger ) s.mount_proc("/kill") {|_req, _res| s.shutdown } s.mount_proc("/yaml") do |req, res| diff --git a/test/rubygems/test_gem_request.rb b/test/rubygems/test_gem_request.rb index cfaa1cecbb..d39ea02543 100644 --- a/test/rubygems/test_gem_request.rb +++ b/test/rubygems/test_gem_request.rb @@ -192,7 +192,7 @@ class TestGemRequest < Gem::TestCase def test_fetch uri = Gem::Uri.new(URI.parse("#{@gem_repo}/specs.#{Gem.marshal_version}")) - response = util_stub_net_http(:body => :junk, :code => 200) do + response = util_stub_net_http(body: :junk, code: 200) do @request = make_request(uri, Net::HTTP::Get, nil, nil) @request.fetch @@ -205,7 +205,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}")) - conn = util_stub_net_http(:body => :junk, :code => 200) do |c| + conn = util_stub_net_http(body: :junk, code: 200) do |c| use_ui @ui do @request = make_request(uri, Net::HTTP::Get, nil, nil) @request.fetch @@ -222,7 +222,7 @@ class TestGemRequest < Gem::TestCase Gem.configuration.verbose = :really uri = Gem::Uri.new(URI.parse("https://user:%7BDEScede%7Dpass@example.rubygems/specs.#{Gem.marshal_version}")) - conn = util_stub_net_http(:body => :junk, :code => 200) do |c| + conn = util_stub_net_http(body: :junk, code: 200) do |c| use_ui @ui do @request = make_request(uri, Net::HTTP::Get, nil, nil) @request.fetch @@ -239,7 +239,7 @@ class TestGemRequest < Gem::TestCase Gem.configuration.verbose = :really uri = Gem::Uri.new(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| + conn = util_stub_net_http(body: :junk, code: 200) do |c| use_ui @ui do @request = make_request(uri, Net::HTTP::Get, nil, nil) @request.fetch @@ -254,7 +254,7 @@ class TestGemRequest < Gem::TestCase def test_fetch_head uri = Gem::Uri.new(URI.parse("#{@gem_repo}/specs.#{Gem.marshal_version}")) - response = util_stub_net_http(:body => "", :code => 200) do |_conn| + response = util_stub_net_http(body: "", code: 200) do |_conn| @request = make_request(uri, Net::HTTP::Get, nil, nil) @request.fetch end @@ -266,7 +266,7 @@ class TestGemRequest < Gem::TestCase def test_fetch_unmodified uri = Gem::Uri.new(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| + conn, response = util_stub_net_http(body: "", code: 304) do |c| @request = make_request(uri, Net::HTTP::Get, t, nil) [c, @request.fetch] end diff --git a/test/rubygems/test_gem_request_set.rb b/test/rubygems/test_gem_request_set.rb index c8197676da..9aa244892c 100644 --- a/test/rubygems/test_gem_request_set.rb +++ b/test/rubygems/test_gem_request_set.rb @@ -55,7 +55,7 @@ class TestGemRequestSet < Gem::TestCase io.puts 'gem "a"' io.flush - result = rs.install_from_gemdeps :gemdeps => io.path do |req, _installer| + result = rs.install_from_gemdeps gemdeps: io.path do |req, _installer| installed << req.full_name end @@ -87,7 +87,7 @@ Gems to install: EXPECTED actual, _ = capture_output do - rs.install_from_gemdeps :gemdeps => io.path, :explain => true + rs.install_from_gemdeps gemdeps: io.path, explain: true end assert_equal(expected, actual) end @@ -109,8 +109,8 @@ Gems to install: end options = { - :gemdeps => "gem.deps.rb", - :install_dir => "#{@gemhome}2", + gemdeps: "gem.deps.rb", + install_dir: "#{@gemhome}2", } rs.install_from_gemdeps options do |req, _installer| @@ -133,7 +133,7 @@ Gems to install: io.flush assert_raise Gem::UnsatisfiableDependencyError do - rs.install_from_gemdeps :gemdeps => io.path, :domain => :local + rs.install_from_gemdeps gemdeps: io.path, domain: :local end end @@ -171,7 +171,7 @@ DEPENDENCIES io.puts 'gem "b"' end - rs.install_from_gemdeps :gemdeps => "gem.deps.rb" do |req, _installer| + rs.install_from_gemdeps gemdeps: "gem.deps.rb" do |req, _installer| installed << req.full_name end @@ -225,7 +225,7 @@ end io.puts("gemspec") end - rs.install_from_gemdeps :gemdeps => "Gemfile" do |req, _installer| + rs.install_from_gemdeps gemdeps: "Gemfile" do |req, _installer| installed << req.full_name end @@ -250,7 +250,7 @@ ruby "0" io.flush - rs.install_from_gemdeps :gemdeps => io.path do |req, _installer| + rs.install_from_gemdeps gemdeps: io.path do |req, _installer| installed << req.full_name end end @@ -574,8 +574,8 @@ ruby "0" rs.resolve options = { - :development => true, - :development_shallow => true, + development: true, + development_shallow: true, } installed = rs.install_into @tempdir, true, options do 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 876d695c4e..af32005a16 100644 --- a/test/rubygems/test_gem_request_set_gem_dependency_api.rb +++ b/test/rubygems/test_gem_request_set_gem_dependency_api.rb @@ -90,7 +90,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase end def test_gem_git - @gda.gem "a", :git => "git/a" + @gda.gem "a", git: "git/a" assert_equal [dep("a")], @set.dependencies @@ -102,7 +102,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase end def test_gem_bitbucket - @gda.gem "a", :bitbucket => "example/repository" + @gda.gem "a", bitbucket: "example/repository" assert_equal [dep("a")], @set.dependencies @@ -115,7 +115,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase end def test_gem_bitbucket_expand_path - @gda.gem "a", :bitbucket => "example" + @gda.gem "a", bitbucket: "example" assert_equal [dep("a")], @set.dependencies @@ -129,7 +129,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase def test_gem_git_branch _, err = capture_output do - @gda.gem "a", :git => "git/a", :branch => "other", :tag => "v1" + @gda.gem "a", git: "git/a", branch: "other", tag: "v1" end expected = "Gem dependencies file gem.deps.rb includes git reference for both ref/branch and tag but only ref/branch is used." assert_match expected, err @@ -140,7 +140,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase end def test_gem_git_gist - @gda.gem "a", :gist => "a" + @gda.gem "a", gist: "a" assert_equal [dep("a")], @set.dependencies @@ -150,7 +150,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase def test_gem_git_ref _, err = capture_output do - @gda.gem "a", :git => "git/a", :ref => "abcd123", :branch => "other" + @gda.gem "a", git: "git/a", ref: "abcd123", branch: "other" end expected = "Gem dependencies file gem.deps.rb includes git reference for both ref and branch but only ref is used." assert_match expected, err @@ -161,7 +161,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase end def test_gem_git_submodules - @gda.gem "a", :git => "git/a", :submodules => true + @gda.gem "a", git: "git/a", submodules: true assert_equal [dep("a")], @set.dependencies @@ -170,7 +170,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase end def test_gem_git_tag - @gda.gem "a", :git => "git/a", :tag => "v1" + @gda.gem "a", git: "git/a", tag: "v1" assert_equal [dep("a")], @set.dependencies @@ -178,7 +178,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase end def test_gem_github - @gda.gem "a", :github => "example/repository" + @gda.gem "a", github: "example/repository" assert_equal [dep("a")], @set.dependencies @@ -191,7 +191,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase end def test_gem_github_expand_path - @gda.gem "a", :github => "example" + @gda.gem "a", github: "example" assert_equal [dep("a")], @set.dependencies @@ -204,7 +204,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase end def test_gem_group - @gda.gem "a", :group => :test + @gda.gem "a", group: :test assert_equal [dep("a")], @set.dependencies end @@ -212,7 +212,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase def test_gem_group_without @gda.without_groups << :test - @gda.gem "a", :group => :test + @gda.gem "a", group: :test assert_empty @set.dependencies @@ -222,7 +222,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase end def test_gem_groups - @gda.gem "a", :groups => [:test, :development] + @gda.gem "a", groups: [:test, :development] assert_equal [dep("a")], @set.dependencies end @@ -230,7 +230,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase def test_gem_path name, version, directory = vendor_gem - @gda.gem name, :path => directory + @gda.gem name, path: directory assert_equal [dep(name)], @set.dependencies @@ -248,7 +248,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase Gem.win_platform = false with_engine_version "ruby", "2.0.0" do - @gda.gem "a", :platforms => :ruby + @gda.gem "a", platforms: :ruby refute_empty @set.dependencies end @@ -263,7 +263,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase with_engine_version "ruby", "2.0.0" do set = Gem::RequestSet.new gda = Gem::RequestSet::GemDependencyAPI.new set, "gem.deps.rb" - gda.gem "a", :platforms => :ruby + gda.gem "a", platforms: :ruby refute_empty set.dependencies end @@ -271,7 +271,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase with_engine_version "rbx", "2.0.0" do set = Gem::RequestSet.new gda = Gem::RequestSet::GemDependencyAPI.new set, "gem.deps.rb" - gda.gem "a", :platforms => :ruby + gda.gem "a", platforms: :ruby refute_empty set.dependencies end @@ -279,7 +279,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase with_engine_version "truffleruby", "2.0.0" do set = Gem::RequestSet.new gda = Gem::RequestSet::GemDependencyAPI.new set, "gem.deps.rb" - gda.gem "a", :platforms => :ruby + gda.gem "a", platforms: :ruby refute_empty set.dependencies end @@ -287,7 +287,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase with_engine_version "jruby", "1.7.6" do set = Gem::RequestSet.new gda = Gem::RequestSet::GemDependencyAPI.new set, "gem.deps.rb" - gda.gem "a", :platforms => :ruby + gda.gem "a", platforms: :ruby assert_empty set.dependencies end @@ -297,7 +297,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase with_engine_version "ruby", "2.0.0" do set = Gem::RequestSet.new gda = Gem::RequestSet::GemDependencyAPI.new set, "gem.deps.rb" - gda.gem "a", :platforms => :ruby + gda.gem "a", platforms: :ruby assert_empty set.dependencies end @@ -307,13 +307,13 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase def test_gem_platforms_engine with_engine_version "jruby", "1.7.6" do - @gda.gem "a", :platforms => :mri + @gda.gem "a", platforms: :mri assert_empty @set.dependencies end with_engine_version "truffleruby", "1.2.3" do - @gda.gem "a", :platforms => :mri + @gda.gem "a", platforms: :mri assert_empty @set.dependencies end @@ -326,13 +326,13 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase with_engine_version "maglev", "1.0.0" do set = Gem::RequestSet.new gda = Gem::RequestSet::GemDependencyAPI.new set, "gem.deps.rb" - gda.gem "a", :platforms => :ruby + gda.gem "a", platforms: :ruby refute_empty set.dependencies set = Gem::RequestSet.new gda = Gem::RequestSet::GemDependencyAPI.new set, "gem.deps.rb" - gda.gem "a", :platforms => :maglev + gda.gem "a", platforms: :maglev refute_empty set.dependencies end @@ -344,13 +344,13 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase with_engine_version "truffleruby", "1.0.0" do set = Gem::RequestSet.new gda = Gem::RequestSet::GemDependencyAPI.new set, "gem.deps.rb" - gda.gem "a", :platforms => :truffleruby + gda.gem "a", platforms: :truffleruby refute_empty set.dependencies set = Gem::RequestSet.new gda = Gem::RequestSet::GemDependencyAPI.new set, "gem.deps.rb" - gda.gem "a", :platforms => :maglev + gda.gem "a", platforms: :maglev assert_empty set.dependencies end @@ -361,7 +361,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase Gem.win_platform = false with_engine_version "ruby", "2.0.0" do - @gda.gem "a", :platforms => [:mswin, :jruby] + @gda.gem "a", platforms: [:mswin, :jruby] assert_empty @set.dependencies end @@ -374,7 +374,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase Gem.win_platform = false with_engine_version "ruby", "2.0.0" do - @gda.gem "a", :platforms => :jruby, :platform => :ruby + @gda.gem "a", platforms: :jruby, platform: :ruby refute_empty @set.dependencies end @@ -384,7 +384,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase def test_gem_platforms_version with_engine_version "ruby", "2.0.0" do - @gda.gem "a", :platforms => :ruby_18 + @gda.gem "a", platforms: :ruby_18 assert_empty @set.dependencies end @@ -392,15 +392,15 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase def test_gem_platforms_unknown e = assert_raise ArgumentError do - @gda.gem "a", :platforms => :unknown + @gda.gem "a", platforms: :unknown end assert_equal "unknown platform :unknown", e.message end def test_gem_requires - @gda.gem "a", :require => %w[b c] - @gda.gem "d", :require => "e" + @gda.gem "a", require: %w[b c] + @gda.gem "d", require: "e" assert_equal [dep("a"), dep("d")], @set.dependencies @@ -409,7 +409,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase end def test_gem_requires_false - @gda.gem "a", :require => false + @gda.gem "a", require: false assert_equal [dep("a")], @set.dependencies @@ -419,7 +419,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase def test_gem_requires_without_group @gda.without_groups << :test - @gda.gem "a", :group => :test + @gda.gem "a", group: :test assert_empty @set.dependencies @@ -447,7 +447,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase end def test_gem_requirements_options - @gda.gem "c", :git => "https://example/c.git" + @gda.gem "c", git: "https://example/c.git" assert_equal [dep("c")], @set.dependencies end @@ -459,7 +459,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase gda.gem name e = assert_raise ArgumentError do - gda.gem name, :path => directory + gda.gem name, path: directory end assert_equal "duplicate source path: #{directory} for gem #{name}", @@ -467,7 +467,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase gda = Gem::RequestSet::GemDependencyAPI.new @set, nil gda.instance_variable_set :@vendor_set, @vendor_set - gda.gem name, :path => directory + gda.gem name, path: directory e = assert_raise ArgumentError do gda.gem name @@ -489,7 +489,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase groups = [] @gda.group :a do - groups = @gda.send :gem_group, "a", :group => :b, :groups => [:c, :d] + groups = @gda.send :gem_group, "a", group: :b, groups: [:c, :d] end assert_equal [:a, :b, :c, :d], groups.sort_by(&:to_s) @@ -537,7 +537,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase @gda.without_groups << :other - @gda.gemspec :development_group => :other + @gda.gemspec development_group: :other assert_equal [dep("a", "= 1"), dep("b", "= 2")], @set.dependencies @@ -569,7 +569,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase s.add_dependency "c", 3 end - @gda.gemspec :name => "b" + @gda.gemspec name: "b" assert_equal [dep("b", "= 2"), dep("c", "= 3")], @set.dependencies end @@ -599,7 +599,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase s.add_dependency "b", 2 end - @gda.gemspec :path => "other" + @gda.gemspec path: "other" assert_equal [dep("a", "= 1"), dep("b", "= 2")], @set.dependencies end @@ -621,7 +621,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase "git://example/#{repo_name}.git" end - @gda.gem "a", :example => "repo" + @gda.gem "a", example: "repo" assert_equal ["git://example/repo.git", nil], @git_set.repositories["a"] end @@ -762,19 +762,19 @@ end def test_ruby_engine with_engine_version "jruby", "1.7.6" do assert @gda.ruby RUBY_VERSION, - :engine => "jruby", :engine_version => "1.7.6" + engine: "jruby", engine_version: "1.7.6" end with_engine_version "truffleruby", "1.0.0-rc11" do assert @gda.ruby RUBY_VERSION, - :engine => "truffleruby", :engine_version => "1.0.0-rc11" + engine: "truffleruby", engine_version: "1.0.0-rc11" end end def test_ruby_engine_mismatch_engine with_engine_version "ruby", "2.0.0" do e = assert_raise Gem::RubyVersionMismatch do - @gda.ruby RUBY_VERSION, :engine => "jruby", :engine_version => "1.7.4" + @gda.ruby RUBY_VERSION, engine: "jruby", engine_version: "1.7.4" end assert_equal "Your Ruby engine is ruby, but your gem.deps.rb requires jruby", @@ -785,7 +785,7 @@ end def test_ruby_engine_mismatch_version with_engine_version "jruby", "1.7.6" do e = assert_raise Gem::RubyVersionMismatch do - @gda.ruby RUBY_VERSION, :engine => "jruby", :engine_version => "1.7.4" + @gda.ruby RUBY_VERSION, engine: "jruby", engine_version: "1.7.4" end assert_equal "Your Ruby engine version is jruby 1.7.6, but your gem.deps.rb requires jruby 1.7.4", @@ -795,7 +795,7 @@ end def test_ruby_engine_no_engine_version e = assert_raise ArgumentError do - @gda.ruby RUBY_VERSION, :engine => "jruby" + @gda.ruby RUBY_VERSION, engine: "jruby" end assert_equal "You must specify engine_version along with the Ruby engine", diff --git a/test/rubygems/test_gem_resolver_api_set.rb b/test/rubygems/test_gem_resolver_api_set.rb index b82f00a190..c0c6d82f19 100644 --- a/test/rubygems/test_gem_resolver_api_set.rb +++ b/test/rubygems/test_gem_resolver_api_set.rb @@ -36,10 +36,10 @@ class TestGemResolverAPISet < Gem::TestCase spec_fetcher data = [ - { :name => "a", - :number => "1", - :platform => "ruby", - :dependencies => [] }, + { name: "a", + number: "1", + platform: "ruby", + dependencies: [] }, ] @fetcher.data["#{@dep_uri}a"] = "---\n1 " @@ -59,14 +59,14 @@ class TestGemResolverAPISet < Gem::TestCase spec_fetcher data = [ - { :name => "a", - :number => "1", - :platform => "ruby", - :dependencies => [] }, - { :name => "a", - :number => "2.a", - :platform => "ruby", - :dependencies => [] }, + { name: "a", + number: "1", + platform: "ruby", + dependencies: [] }, + { name: "a", + number: "2.a", + platform: "ruby", + dependencies: [] }, ] @fetcher.data["#{@dep_uri}a"] = "---\n1\n2.a" @@ -88,10 +88,10 @@ class TestGemResolverAPISet < Gem::TestCase spec_fetcher data = [ - { :name => "a", - :number => "1", - :platform => "ruby", - :dependencies => [] }, + { name: "a", + number: "1", + platform: "ruby", + dependencies: [] }, ] @fetcher.data["#{@dep_uri}a"] = "---\n1 " diff --git a/test/rubygems/test_gem_resolver_api_specification.rb b/test/rubygems/test_gem_resolver_api_specification.rb index 6ec0aa48fa..49f3cc81d0 100644 --- a/test/rubygems/test_gem_resolver_api_specification.rb +++ b/test/rubygems/test_gem_resolver_api_specification.rb @@ -6,10 +6,10 @@ class TestGemResolverAPISpecification < Gem::TestCase def test_initialize set = Gem::Resolver::APISet.new data = { - :name => "rails", - :number => "3.0.3", - :platform => Gem::Platform.local.to_s, - :dependencies => [ + name: "rails", + number: "3.0.3", + platform: Gem::Platform.local.to_s, + dependencies: [ ["bundler", "~> 1.0"], ["railties", "= 3.0.3"], ], @@ -45,10 +45,10 @@ class TestGemResolverAPISpecification < Gem::TestCase set = Gem::Resolver::APISet.new repo data = { - :name => "rails", - :number => "3.0.3", - :platform => "ruby", - :dependencies => [ + name: "rails", + number: "3.0.3", + platform: "ruby", + dependencies: [ ["bundler", "~> 1.0"], ["railties", "= 3.0.3"], ], @@ -72,10 +72,10 @@ class TestGemResolverAPISpecification < Gem::TestCase def test_installable_platform_eh set = Gem::Resolver::APISet.new data = { - :name => "a", - :number => "1", - :platform => "ruby", - :dependencies => [], + name: "a", + number: "1", + platform: "ruby", + dependencies: [], } a_spec = Gem::Resolver::APISpecification.new set, data @@ -83,10 +83,10 @@ class TestGemResolverAPISpecification < Gem::TestCase assert a_spec.installable_platform? data = { - :name => "b", - :number => "1", - :platform => "cpu-other_platform-1", - :dependencies => [], + name: "b", + number: "1", + platform: "cpu-other_platform-1", + dependencies: [], } b_spec = Gem::Resolver::APISpecification.new set, data @@ -94,10 +94,10 @@ class TestGemResolverAPISpecification < Gem::TestCase refute b_spec.installable_platform? data = { - :name => "c", - :number => "1", - :platform => Gem::Platform.local.to_s, - :dependencies => [], + name: "c", + number: "1", + platform: Gem::Platform.local.to_s, + dependencies: [], } c_spec = Gem::Resolver::APISpecification.new set, data @@ -108,10 +108,10 @@ class TestGemResolverAPISpecification < Gem::TestCase def test_source set = Gem::Resolver::APISet.new data = { - :name => "a", - :number => "1", - :platform => "ruby", - :dependencies => [], + name: "a", + number: "1", + platform: "ruby", + dependencies: [], } api_spec = Gem::Resolver::APISpecification.new set, data @@ -127,10 +127,10 @@ class TestGemResolverAPISpecification < Gem::TestCase dep_uri = URI(@gem_repo) + "info" set = Gem::Resolver::APISet.new dep_uri data = { - :name => "a", - :number => "1", - :platform => "ruby", - :dependencies => [], + name: "a", + number: "1", + platform: "ruby", + dependencies: [], } api_spec = Gem::Resolver::APISpecification.new set, data @@ -151,10 +151,10 @@ class TestGemResolverAPISpecification < Gem::TestCase dep_uri = URI(@gem_repo) + "info" set = Gem::Resolver::APISet.new dep_uri data = { - :name => "j", - :number => "1", - :platform => "jruby", - :dependencies => [], + name: "j", + number: "1", + platform: "jruby", + dependencies: [], } api_spec = Gem::Resolver::APISpecification.new set, data diff --git a/test/rubygems/test_gem_resolver_specification.rb b/test/rubygems/test_gem_resolver_specification.rb index db7093e423..e2bbce0c0c 100644 --- a/test/rubygems/test_gem_resolver_specification.rb +++ b/test/rubygems/test_gem_resolver_specification.rb @@ -25,7 +25,7 @@ class TestGemResolverSpecification < Gem::TestCase a_spec = TestSpec.new a a_spec.source = Gem::Source.new @gem_repo - a_spec.install :install_dir => gemhome + a_spec.install install_dir: gemhome assert_path_exist File.join gemhome, "gems", a.full_name diff --git a/test/rubygems/test_gem_security_policy.rb b/test/rubygems/test_gem_security_policy.rb index 0c5c621485..2f4fb1ce28 100644 --- a/test/rubygems/test_gem_security_policy.rb +++ b/test/rubygems/test_gem_security_policy.rb @@ -43,22 +43,22 @@ class TestGemSecurityPolicy < Gem::TestCase @chain = Gem::Security::Policy.new( "Chain", - :verify_data => true, - :verify_signer => true, - :verify_chain => true, - :verify_root => false, - :only_trusted => false, - :only_signed => false + verify_data: true, + verify_signer: true, + verify_chain: true, + verify_root: false, + only_trusted: false, + only_signed: false ) @root = Gem::Security::Policy.new( "Root", - :verify_data => true, - :verify_signer => true, - :verify_chain => true, - :verify_root => true, - :only_trusted => false, - :only_signed => false + verify_data: true, + verify_signer: true, + verify_chain: true, + verify_root: true, + only_trusted: false, + only_signed: false ) end diff --git a/test/rubygems/test_gem_security_signer.rb b/test/rubygems/test_gem_security_signer.rb index 5265678d29..f4799cbd46 100644 --- a/test/rubygems/test_gem_security_signer.rb +++ b/test/rubygems/test_gem_security_signer.rb @@ -144,7 +144,7 @@ B8khkB8hDKC6moCzebmUxCBmTmXD0Wjzon+bf4MOriVE3a0ySGRvpr1mKR2+ def test_sign_expired_auto_update pend if Gem.java_platform? - FileUtils.mkdir_p File.join(Gem.user_home, ".gem"), :mode => 0o700 + FileUtils.mkdir_p File.join(Gem.user_home, ".gem"), mode: 0o700 private_key_path = File.join(Gem.user_home, ".gem", "gem-private_key.pem") Gem::Security.write PRIVATE_KEY, private_key_path @@ -171,7 +171,7 @@ B8khkB8hDKC6moCzebmUxCBmTmXD0Wjzon+bf4MOriVE3a0ySGRvpr1mKR2+ end def test_sign_expired_auto_update_exists - FileUtils.mkdir_p File.join(Gem.user_home, ".gem"), :mode => 0o700 + FileUtils.mkdir_p File.join(Gem.user_home, ".gem"), mode: 0o700 expiry = EXPIRED_CERT.not_after.strftime "%Y%m%d%H%M%S" expired_path = diff --git a/test/rubygems/test_gem_security_trust_dir.rb b/test/rubygems/test_gem_security_trust_dir.rb index b7c9a6feb0..cfde8e9d48 100644 --- a/test/rubygems/test_gem_security_trust_dir.rb +++ b/test/rubygems/test_gem_security_trust_dir.rb @@ -87,7 +87,7 @@ class TestGemSecurityTrustDir < Gem::TestCase end def test_verify_wrong_permissions - FileUtils.mkdir_p @dest_dir, :mode => 0o777 + FileUtils.mkdir_p @dest_dir, mode: 0o777 @trust_dir.verify diff --git a/test/rubygems/test_gem_uninstaller.rb b/test/rubygems/test_gem_uninstaller.rb index dfa01768bc..9e0c1aa3d8 100644 --- a/test/rubygems/test_gem_uninstaller.rb +++ b/test/rubygems/test_gem_uninstaller.rb @@ -25,7 +25,7 @@ class TestGemUninstaller < Gem::InstallerTestCase def test_initialize_expand_path FileUtils.mkdir_p "foo/bar" - uninstaller = Gem::Uninstaller.new nil, :install_dir => "foo//bar" + uninstaller = Gem::Uninstaller.new nil, install_dir: "foo//bar" assert_match %r{foo/bar$}, uninstaller.instance_variable_get(:@gem_home) end @@ -59,7 +59,7 @@ class TestGemUninstaller < Gem::InstallerTestCase end def test_remove_executables_force_keep - uninstaller = Gem::Uninstaller.new nil, :executables => false + uninstaller = Gem::Uninstaller.new nil, executables: false executable = File.join Gem.bindir(@user_spec.base_dir), "executable" assert File.exist?(executable), "executable not written" @@ -74,7 +74,7 @@ class TestGemUninstaller < Gem::InstallerTestCase end def test_remove_executables_force_remove - uninstaller = Gem::Uninstaller.new nil, :executables => true + uninstaller = Gem::Uninstaller.new nil, executables: true executable = File.join Gem.bindir(@user_spec.base_dir), "executable" assert File.exist?(executable), "executable not written" @@ -89,7 +89,7 @@ class TestGemUninstaller < Gem::InstallerTestCase end def test_remove_executables_user - uninstaller = Gem::Uninstaller.new nil, :executables => true + uninstaller = Gem::Uninstaller.new nil, executables: true use_ui @ui do uninstaller.remove_executables @user_spec @@ -104,7 +104,7 @@ class TestGemUninstaller < Gem::InstallerTestCase def test_remove_executables_user_format Gem::Installer.exec_format = "foo-%s-bar" - uninstaller = Gem::Uninstaller.new nil, :executables => true, :format_executable => true + uninstaller = Gem::Uninstaller.new nil, executables: true, format_executable: true use_ui @ui do uninstaller.remove_executables @user_spec @@ -121,7 +121,7 @@ class TestGemUninstaller < Gem::InstallerTestCase def test_remove_executables_user_format_disabled Gem::Installer.exec_format = "foo-%s-bar" - uninstaller = Gem::Uninstaller.new nil, :executables => true + uninstaller = Gem::Uninstaller.new nil, executables: true use_ui @ui do uninstaller.remove_executables @user_spec @@ -137,7 +137,7 @@ class TestGemUninstaller < Gem::InstallerTestCase def test_remove_not_in_home Dir.mkdir "#{@gemhome}2" - uninstaller = Gem::Uninstaller.new nil, :install_dir => "#{@gemhome}2" + uninstaller = Gem::Uninstaller.new nil, install_dir: "#{@gemhome}2" e = assert_raise Gem::GemNotInHomeException do use_ui ui do @@ -161,7 +161,7 @@ class TestGemUninstaller < Gem::InstallerTestCase FileUtils.ln_s(@gemhome, dir) - uninstaller = Gem::Uninstaller.new nil, :install_dir => symlinked_gem_home + uninstaller = Gem::Uninstaller.new nil, install_dir: symlinked_gem_home use_ui ui do uninstaller.remove @spec @@ -178,7 +178,7 @@ class TestGemUninstaller < Gem::InstallerTestCase @spec.files += %w[lib/rubygems_plugin.rb] - Gem::Installer.at(Gem::Package.build(@spec), :force => true).install + Gem::Installer.at(Gem::Package.build(@spec), force: true).install plugin_path = File.join Gem.plugindir, "a_plugin.rb" assert File.exist?(plugin_path), "plugin not written" @@ -195,13 +195,13 @@ class TestGemUninstaller < Gem::InstallerTestCase @spec.files += %w[lib/rubygems_plugin.rb] - Gem::Installer.at(Gem::Package.build(@spec), :force => true).install + Gem::Installer.at(Gem::Package.build(@spec), force: true).install plugin_path = File.join Gem.plugindir, "a_plugin.rb" assert File.exist?(plugin_path), "plugin not written" Dir.mkdir "#{@gemhome}2" - Gem::Uninstaller.new(nil, :install_dir => "#{@gemhome}2").remove_plugins @spec + Gem::Uninstaller.new(nil, install_dir: "#{@gemhome}2").remove_plugins @spec assert File.exist?(plugin_path), "plugin unintentionally removed" end @@ -213,7 +213,7 @@ class TestGemUninstaller < Gem::InstallerTestCase @spec.files += %w[lib/rubygems_plugin.rb] - Gem::Installer.at(Gem::Package.build(@spec), :force => true).install + Gem::Installer.at(Gem::Package.build(@spec), force: true).install plugin_path = File.join Gem.plugindir, "a_plugin.rb" assert File.exist?(plugin_path), "plugin not written" @@ -247,7 +247,7 @@ class TestGemUninstaller < Gem::InstallerTestCase end def test_uninstall - uninstaller = Gem::Uninstaller.new @spec.name, :executables => true + uninstaller = Gem::Uninstaller.new @spec.name, executables: true gem_dir = File.join @gemhome, "gems", @spec.full_name @@ -274,7 +274,7 @@ class TestGemUninstaller < Gem::InstallerTestCase install_default_gems spec - uninstaller = Gem::Uninstaller.new spec.name, :executables => true + uninstaller = Gem::Uninstaller.new spec.name, executables: true use_ui @ui do uninstaller.uninstall @@ -294,7 +294,7 @@ class TestGemUninstaller < Gem::InstallerTestCase Gem::Specification.reset - uninstaller = Gem::Uninstaller.new spec.name, :executables => true + uninstaller = Gem::Uninstaller.new spec.name, executables: true ui = Gem::MockGemUi.new "1\ny\n" use_ui ui do @@ -322,20 +322,20 @@ create_makefile '#{@spec.name}' use_ui @ui do path = Gem::Package.build @spec - installer = Gem::Installer.at path, :force => true + installer = Gem::Installer.at path, force: true installer.install end assert_path_exist @spec.extension_dir, "sanity check" - uninstaller = Gem::Uninstaller.new @spec.name, :executables => true + uninstaller = Gem::Uninstaller.new @spec.name, executables: true uninstaller.uninstall assert_path_not_exist @spec.extension_dir end def test_uninstall_nonexistent - uninstaller = Gem::Uninstaller.new "bogus", :executables => true + uninstaller = Gem::Uninstaller.new "bogus", executables: true e = assert_raise Gem::InstallError do uninstaller.uninstall @@ -373,8 +373,8 @@ create_makefile '#{@spec.name}' @user_spec = Gem::Specification.find_by_name "b" uninstaller = Gem::Uninstaller.new(@user_spec.name, - :executables => true, - :user_install => true) + executables: true, + user_install: true) gem_dir = File.join @user_spec.gem_dir @@ -398,7 +398,7 @@ create_makefile '#{@spec.name}' Dir.mkdir "#{@gemhome}2" Gem.use_paths "#{@gemhome}2", [@gemhome] - uninstaller = Gem::Uninstaller.new @spec.name, :executables => true + uninstaller = Gem::Uninstaller.new @spec.name, executables: true e = assert_raise Gem::InstallError do uninstaller.uninstall @@ -487,7 +487,7 @@ create_makefile '#{@spec.name}' quick_gem "q", "1.0" quick_gem "q", "1.1" - un = Gem::Uninstaller.new("q", :version => "1.0") + un = Gem::Uninstaller.new("q", version: "1.0") ui = Gem::MockGemUi.new("y\n") use_ui ui do @@ -513,7 +513,7 @@ create_makefile '#{@spec.name}' quick_gem "q", "1.0" quick_gem "q", "1.1" - un = Gem::Uninstaller.new("q", :version => "1.0") + un = Gem::Uninstaller.new("q", version: "1.0") ui = Gem::MockGemUi.new("y\n") use_ui ui do @@ -532,7 +532,7 @@ create_makefile '#{@spec.name}' quick_gem "q", "1.0" - un = Gem::Uninstaller.new("q", :version => "1.0") + un = Gem::Uninstaller.new("q", version: "1.0") ui = Gem::MockGemUi.new("y\n") use_ui ui do @@ -551,7 +551,7 @@ create_makefile '#{@spec.name}' quick_gem "q", "1" - un = Gem::Uninstaller.new("q", :abort_on_dependent => true) + un = Gem::Uninstaller.new("q", abort_on_dependent: true) ui = Gem::MockGemUi.new("y\n") assert_raise Gem::DependencyRemovalException do @@ -568,7 +568,7 @@ create_makefile '#{@spec.name}' quick_gem "q", "1" - un = Gem::Uninstaller.new("q", :check_dev => true) + un = Gem::Uninstaller.new("q", check_dev: true) ui = Gem::MockGemUi.new("y\n") use_ui ui do @@ -597,7 +597,7 @@ create_makefile '#{@spec.name}' quick_gem "q", "1" - un = Gem::Uninstaller.new("q", :check_dev => false) + un = Gem::Uninstaller.new("q", check_dev: false) ui = Gem::MockGemUi.new("y\n") use_ui ui do @@ -616,7 +616,7 @@ create_makefile '#{@spec.name}' end def test_uninstall_no_permission - uninstaller = Gem::Uninstaller.new @spec.name, :executables => true + uninstaller = Gem::Uninstaller.new @spec.name, executables: true stub_rm_r = lambda do |*args| _path = args.shift @@ -641,34 +641,34 @@ create_makefile '#{@spec.name}' plugin_path = File.join Gem.plugindir, "a_plugin.rb" @spec.version = "1" - Gem::Installer.at(Gem::Package.build(@spec), :force => true).install + Gem::Installer.at(Gem::Package.build(@spec), force: true).install refute File.exist?(plugin_path), "version without plugin installed, but plugin written" @spec.files += %w[lib/rubygems_plugin.rb] @spec.version = "2" - Gem::Installer.at(Gem::Package.build(@spec), :force => true).install + Gem::Installer.at(Gem::Package.build(@spec), force: true).install assert File.exist?(plugin_path), "version with plugin installed, but plugin not written" assert_match %r{\Arequire.*a-2/lib/rubygems_plugin\.rb}, File.read(plugin_path), "written plugin has incorrect content" @spec.version = "3" - Gem::Installer.at(Gem::Package.build(@spec), :force => true).install + Gem::Installer.at(Gem::Package.build(@spec), force: true).install assert File.exist?(plugin_path), "version with plugin installed, but plugin removed" assert_match %r{\Arequire.*a-3/lib/rubygems_plugin\.rb}, File.read(plugin_path), "old version installed, but plugin updated" - Gem::Uninstaller.new("a", :version => "1", :executables => true).uninstall + Gem::Uninstaller.new("a", version: "1", executables: true).uninstall assert File.exist?(plugin_path), "plugin removed when old version uninstalled" assert_match %r{\Arequire.*a-3/lib/rubygems_plugin\.rb}, File.read(plugin_path), "old version uninstalled, but plugin updated" - Gem::Uninstaller.new("a", version: "3", :executables => true).uninstall + Gem::Uninstaller.new("a", version: "3", executables: true).uninstall assert File.exist?(plugin_path), "plugin removed when old version uninstalled and another version with plugin still present" assert_match %r{\Arequire.*a-2/lib/rubygems_plugin\.rb}, File.read(plugin_path), "latest version uninstalled, but plugin not updated to previous version" - Gem::Uninstaller.new("a", version: "2", :executables => true).uninstall + Gem::Uninstaller.new("a", version: "2", executables: true).uninstall refute File.exist?(plugin_path), "last version uninstalled, but plugin still present" end diff --git a/test/rubygems/test_gem_version_option.rb b/test/rubygems/test_gem_version_option.rb index b837b794db..8b6e14fc42 100644 --- a/test/rubygems/test_gem_version_option.rb +++ b/test/rubygems/test_gem_version_option.rb @@ -82,10 +82,10 @@ class TestGemVersionOption < Gem::TestCase @cmd.handle_options %w[--version >1] expected = { - :args => [], - :explicit_prerelease => false, - :prerelease => false, - :version => Gem::Requirement.new("> 1"), + args: [], + explicit_prerelease: false, + prerelease: false, + version: Gem::Requirement.new("> 1"), } assert_equal expected, @cmd.options @@ -97,10 +97,10 @@ class TestGemVersionOption < Gem::TestCase @cmd.handle_options ["--version", "< 1, > 0.9"] expected = { - :args => [], - :explicit_prerelease => false, - :prerelease => false, - :version => Gem::Requirement.new("< 1", "> 0.9"), + args: [], + explicit_prerelease: false, + prerelease: false, + version: Gem::Requirement.new("< 1", "> 0.9"), } assert_equal expected, @cmd.options @@ -112,10 +112,10 @@ class TestGemVersionOption < Gem::TestCase @cmd.handle_options ["--version", "< 1", "--version", "> 0.9"] expected = { - :args => [], - :explicit_prerelease => false, - :prerelease => false, - :version => Gem::Requirement.new("< 1", "> 0.9"), + args: [], + explicit_prerelease: false, + prerelease: false, + version: Gem::Requirement.new("< 1", "> 0.9"), } assert_equal expected, @cmd.options @@ -128,10 +128,10 @@ class TestGemVersionOption < Gem::TestCase @cmd.handle_options %w[--pre --version >1] expected = { - :args => [], - :explicit_prerelease => true, - :prerelease => true, - :version => Gem::Requirement.new("> 1"), + args: [], + explicit_prerelease: true, + prerelease: true, + version: Gem::Requirement.new("> 1"), } assert_equal expected, @cmd.options @@ -143,10 +143,10 @@ class TestGemVersionOption < Gem::TestCase @cmd.handle_options %w[--version >1.a] expected = { - :args => [], - :explicit_prerelease => false, - :prerelease => true, - :version => Gem::Requirement.new("> 1.a"), + args: [], + explicit_prerelease: false, + prerelease: true, + version: Gem::Requirement.new("> 1.a"), } assert_equal expected, @cmd.options @@ -154,10 +154,10 @@ class TestGemVersionOption < Gem::TestCase @cmd.handle_options %w[--version >1] expected = { - :args => [], - :explicit_prerelease => false, - :prerelease => false, - :version => Gem::Requirement.new("> 1"), + args: [], + explicit_prerelease: false, + prerelease: false, + version: Gem::Requirement.new("> 1"), } assert_equal expected, @cmd.options diff --git a/test/rubygems/test_rubygems.rb b/test/rubygems/test_rubygems.rb index ae8959c4ed..25211cb0e9 100644 --- a/test/rubygems/test_rubygems.rb +++ b/test/rubygems/test_rubygems.rb @@ -4,7 +4,7 @@ require_relative "helper" class GemTest < Gem::TestCase def test_rubygems_normal_behaviour - _ = Gem::Util.popen(*ruby_with_rubygems_in_load_path, "-e", "'require \"rubygems\"'", { :err => [:child, :out] }).strip + _ = Gem::Util.popen(*ruby_with_rubygems_in_load_path, "-e", "'require \"rubygems\"'", { err: [:child, :out] }).strip assert $?.success? end @@ -15,7 +15,7 @@ class GemTest < Gem::TestCase intentionally_not_implemented_method RUBY - output = Gem::Util.popen(*ruby_with_rubygems_and_fake_operating_system_in_load_path(path), "-e", "'require \"rubygems\"'", { :err => [:child, :out] }).strip + output = Gem::Util.popen(*ruby_with_rubygems_and_fake_operating_system_in_load_path(path), "-e", "'require \"rubygems\"'", { err: [:child, :out] }).strip assert !$?.success? assert_includes output, "undefined local variable or method `intentionally_not_implemented_method'" assert_includes output, "Loading the #{operating_system_rb_at(path)} file caused an error. " \ @@ -42,7 +42,7 @@ class GemTest < Gem::TestCase *ruby_with_rubygems_and_fake_operating_system_in_load_path(path), "-e", "require \"rubygems\"; puts Gem::Specification.stubs.map(&:full_name)", - { :err => [:child, :out] } + { err: [:child, :out] } ).strip begin assert_empty output |