summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2022-04-01 20:36:59 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-04-28 19:08:49 +0900
commit678d58c8508ec46aa270e3c5d81fc09cd0fee175 (patch)
tree34cbc8bb12e609d7a73e35c513090264360ffb49 /test
parent479ba9a44b6beda1dce32842bcbc66b6f46a85a0 (diff)
Merge rubygems master 1e4eda741d732ca1bd7031aef0a16c7348adf7a5
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5669
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/helper.rb2
-rw-r--r--test/rubygems/test_gem.rb2
-rw-r--r--test/rubygems/test_gem_command_manager.rb2
-rw-r--r--test/rubygems/test_gem_commands_help_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb2
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb4
-rw-r--r--test/rubygems/test_gem_ext_builder.rb2
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder.rb6
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb6
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb6
-rw-r--r--test/rubygems/test_gem_specification.rb2
-rw-r--r--test/rubygems/test_project_sanity.rb2
-rw-r--r--test/rubygems/test_require.rb2
13 files changed, 20 insertions, 20 deletions
diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb
index 5ed51fec10..be9016b831 100644
--- a/test/rubygems/helper.rb
+++ b/test/rubygems/helper.rb
@@ -3,7 +3,7 @@
require 'rubygems'
# If bundler gemspec exists, add to stubs
-bundler_gemspec = File.expand_path("../../../bundler/bundler.gemspec", __FILE__)
+bundler_gemspec = File.expand_path('../../bundler/bundler.gemspec', __dir__)
if File.exist?(bundler_gemspec)
Gem::Specification.dirs.unshift File.dirname(bundler_gemspec)
Gem::Specification.class_variable_set :@@stubs, nil
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index cc4772a0c6..a8be078046 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -10,7 +10,7 @@ require 'rbconfig'
class TestGem < Gem::TestCase
PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant
- PROJECT_DIR = File.expand_path('../../..', __FILE__).tap(&Gem::UNTAINT)
+ PROJECT_DIR = File.expand_path('../..', __dir__).tap(&Gem::UNTAINT)
def setup
super
diff --git a/test/rubygems/test_gem_command_manager.rb b/test/rubygems/test_gem_command_manager.rb
index ff1f955c6c..bee635d67e 100644
--- a/test/rubygems/test_gem_command_manager.rb
+++ b/test/rubygems/test_gem_command_manager.rb
@@ -3,7 +3,7 @@ require_relative 'helper'
require 'rubygems/command_manager'
class TestGemCommandManager < Gem::TestCase
- PROJECT_DIR = File.expand_path('../../..', __FILE__).tap(&Gem::UNTAINT)
+ PROJECT_DIR = File.expand_path('../..', __dir__).tap(&Gem::UNTAINT)
def setup
super
diff --git a/test/rubygems/test_gem_commands_help_command.rb b/test/rubygems/test_gem_commands_help_command.rb
index a70dd770e1..98e5b62be0 100644
--- a/test/rubygems/test_gem_commands_help_command.rb
+++ b/test/rubygems/test_gem_commands_help_command.rb
@@ -11,7 +11,7 @@ class TestGemCommandsHelpCommand < Gem::TestCase
@cmd = Gem::Commands::HelpCommand.new
- load File.expand_path('../rubygems_plugin.rb', __FILE__) unless Gem::Commands.const_defined? :InterruptCommand
+ load File.expand_path('rubygems_plugin.rb', __dir__) unless Gem::Commands.const_defined? :InterruptCommand
end
def test_gem_help_bad
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
index 934c76b1d1..ab563b28ee 100644
--- a/test/rubygems/test_gem_commands_setup_command.rb
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -4,7 +4,7 @@ require_relative 'helper'
require 'rubygems/commands/setup_command'
class TestGemCommandsSetupCommand < Gem::TestCase
- bundler_gemspec = File.expand_path("../../../bundler/lib/bundler/version.rb", __FILE__)
+ bundler_gemspec = File.expand_path('../../bundler/lib/bundler/version.rb', __dir__)
if File.exist?(bundler_gemspec)
BUNDLER_VERS = File.read(bundler_gemspec).match(/VERSION = "(#{Gem::Version::VERSION_PATTERN})"/)[1]
else
diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb
index 9cbdcefea4..f2404d61c7 100644
--- a/test/rubygems/test_gem_dependency_installer.rb
+++ b/test/rubygems/test_gem_dependency_installer.rb
@@ -941,7 +941,7 @@ class TestGemDependencyInstaller < Gem::TestCase
end
def test_install_legacy_spec_with_nil_required_ruby_version
- path = File.expand_path "../data/null-required-ruby-version.gemspec.rz", __FILE__
+ path = File.expand_path 'data/null-required-ruby-version.gemspec.rz', __dir__
spec = Marshal.load Gem.read_binary(path)
def spec.validate(*args); end
@@ -966,7 +966,7 @@ class TestGemDependencyInstaller < Gem::TestCase
end
def test_install_legacy_spec_with_nil_required_rubygems_version
- path = File.expand_path "../data/null-required-rubygems-version.gemspec.rz", __FILE__
+ path = File.expand_path 'data/null-required-rubygems-version.gemspec.rz', __dir__
spec = Marshal.load Gem.read_binary(path)
def spec.validate(*args); end
diff --git a/test/rubygems/test_gem_ext_builder.rb b/test/rubygems/test_gem_ext_builder.rb
index 165194510e..7e19782e61 100644
--- a/test/rubygems/test_gem_ext_builder.rb
+++ b/test/rubygems/test_gem_ext_builder.rb
@@ -291,7 +291,7 @@ install:
File.open File.join(@spec.gem_dir, "extconf.rb"), "w" do |f|
f.write <<-'RUBY'
puts "IN EXTCONF"
- extconf_args = File.join File.dirname(__FILE__), 'extconf_args'
+ extconf_args = File.join __dir__, 'extconf_args'
File.open extconf_args, 'w' do |f|
f.puts ARGV.inspect
end
diff --git a/test/rubygems/test_gem_ext_cargo_builder.rb b/test/rubygems/test_gem_ext_cargo_builder.rb
index 5a1c035947..0c8de2ff6c 100644
--- a/test/rubygems/test_gem_ext_cargo_builder.rb
+++ b/test/rubygems/test_gem_ext_cargo_builder.rb
@@ -20,7 +20,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
def setup_rust_gem(name)
@ext = File.join(@tempdir, 'ext')
@dest_path = File.join(@tempdir, 'prefix')
- @fixture_dir = Pathname.new(File.expand_path("../test_gem_ext_cargo_builder/#{name}/", __FILE__))
+ @fixture_dir = Pathname.new(File.expand_path("test_gem_ext_cargo_builder/#{name}/", __dir__))
FileUtils.mkdir_p @dest_path
FileUtils.cp_r(@fixture_dir.to_s, @ext)
@@ -103,7 +103,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
Dir.chdir @ext do
require 'tmpdir'
- gem = [@rust_envs, *ruby_with_rubygems_in_load_path, File.expand_path("./../../../bin/gem", __FILE__)]
+ gem = [@rust_envs, *ruby_with_rubygems_in_load_path, File.expand_path('../../bin/gem', __dir__)]
Dir.mktmpdir("rust_ruby_example") do |dir|
built_gem = File.expand_path(File.join(dir, "rust_ruby_example.gem"))
@@ -125,7 +125,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
Dir.chdir @ext do
require 'tmpdir'
- gem = [@rust_envs, *ruby_with_rubygems_in_load_path, File.expand_path("./../../../bin/gem", __FILE__)]
+ gem = [@rust_envs, *ruby_with_rubygems_in_load_path, File.expand_path('../../bin/gem', __dir__)]
Dir.mktmpdir("custom_name") do |dir|
built_gem = File.expand_path(File.join(dir, "custom_name.gem"))
diff --git a/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb b/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb
index a521dceb4a..4d2f8488a4 100644
--- a/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb
+++ b/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb
@@ -9,9 +9,9 @@ end
require 'tmpdir'
-lp = File.expand_path("./../../../../../lib", __FILE__)
-gem = ["ruby", "-I#{lp}", File.expand_path("./../../../../../bin/gem", __FILE__)]
-gemspec = File.expand_path("./../custom_name.gemspec", __FILE__)
+lp = File.expand_path('../../../../lib', __dir__)
+gem = ["ruby", "-I#{lp}", File.expand_path('../../../../bin/gem', __dir__)]
+gemspec = File.expand_path('custom_name.gemspec', __dir__)
Dir.mktmpdir("custom_name") do |dir|
built_gem = File.expand_path(File.join(dir, "custom_name.gem"))
diff --git a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb
index 468274c9a7..da9e82315e 100644
--- a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb
+++ b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb
@@ -9,9 +9,9 @@ end
require 'tmpdir'
-lp = File.expand_path("./../../../../../lib", __FILE__)
-gem = ["ruby", "-I#{lp}", File.expand_path("./../../../../../bin/gem", __FILE__)]
-gemspec = File.expand_path("./../rust_ruby_example.gemspec", __FILE__)
+lp = File.expand_path('../../../../lib', __dir__)
+gem = ["ruby", "-I#{lp}", File.expand_path('../../../../bin/gem', __dir__)]
+gemspec = File.expand_path('rust_ruby_example.gemspec', __dir__)
Dir.mktmpdir("rust_ruby_example") do |dir|
built_gem = File.expand_path(File.join(dir, "rust_ruby_example.gem"))
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 8b4a07d23b..55dd7f0ff2 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -1068,7 +1068,7 @@ dependencies: []
end
def test_handles_private_null_type
- path = File.expand_path "../data/null-type.gemspec.rz", __FILE__
+ path = File.expand_path 'data/null-type.gemspec.rz', __dir__
data = Marshal.load Gem::Util.inflate(Gem.read_binary(path))
diff --git a/test/rubygems/test_project_sanity.rb b/test/rubygems/test_project_sanity.rb
index 38c2541df6..27b1f11d62 100644
--- a/test/rubygems/test_project_sanity.rb
+++ b/test/rubygems/test_project_sanity.rb
@@ -5,7 +5,7 @@ require "open3"
class TestProjectSanity < Gem::TestCase
def test_manifest_is_up_to_date
- pend unless File.exist?(File.expand_path("../../../Rakefile", __FILE__))
+ pend unless File.exist?(File.expand_path('../../Rakefile', __dir__))
_, status = Open3.capture2e("rake check_manifest")
diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb
index 5b826d052b..90b943dff3 100644
--- a/test/rubygems/test_require.rb
+++ b/test/rubygems/test_require.rb
@@ -230,7 +230,7 @@ class TestGemRequire < Gem::TestCase
pend "not installed yet" unless RbConfig::TOPDIR
- lib_dir = File.expand_path("../../lib", File.dirname(__FILE__))
+ lib_dir = File.expand_path("../lib", __dir__)
rubylibdir = File.realdirpath(RbConfig::CONFIG["rubylibdir"])
if rubylibdir == lib_dir
# testing in the ruby repository where RubyGems' lib/ == stdlib lib/