summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_installer.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-05-25 21:05:45 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-05-12 17:24:43 +0900
commit3948be350312b908ea3ecf32ecf1adf420fe74ca (patch)
tree8f01de8e25e201e16a4f15b1124f7251a892d0a4 /test/rubygems/test_gem_installer.rb
parent81d793a9216303f70143b13a88c924c22ce4af6d (diff)
[rubygems/rubygems] Use assert_path_exist and assert_path_not_exist instead of assert_path_exists and refute_path_exists
https://github.com/rubygems/rubygems/commit/a7c93558c3
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4491
Diffstat (limited to 'test/rubygems/test_gem_installer.rb')
-rw-r--r--test/rubygems/test_gem_installer.rb144
1 files changed, 72 insertions, 72 deletions
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 0d1f2c4102..d90154f01d 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -76,7 +76,7 @@ end
installer.generate_bin
installed_exec = File.join util_inst_bindir, 'executable'
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
wrapper = File.read installed_exec
assert_match %r{generated by RubyGems}, wrapper
@@ -134,7 +134,7 @@ gem 'other', version
installer.generate_bin # should not raise
installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
wrapper = File.read installed_exec
assert_match %r{generated by RubyGems}, wrapper
@@ -169,7 +169,7 @@ gem 'other', version
installer.generate_bin
installed_exec = File.join util_inst_bindir, 'executable'
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
wrapper = File.read installed_exec
assert_match %r{generated by RubyGems}, wrapper
@@ -184,7 +184,7 @@ gem 'other', version
installer.generate_bin
installed_exec = File.join util_inst_bindir, 'executable'
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
wrapper = File.read installed_exec
assert_match %r{generated by RubyGems}, wrapper
@@ -306,7 +306,7 @@ gem 'other', version
installer.extract_files
- assert_path_exists File.join @spec.gem_dir, 'bin/executable'
+ assert_path_exist File.join @spec.gem_dir, 'bin/executable'
end
def test_generate_bin_bindir
@@ -329,7 +329,7 @@ gem 'other', version
assert_directory_exists util_inst_bindir
installed_exec = File.join(util_inst_bindir, 'executable')
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
wrapper = File.read installed_exec
@@ -372,7 +372,7 @@ gem 'other', version
installer.generate_bin
assert_directory_exists util_inst_bindir
installed_exec = File.join util_inst_bindir, 'executable'
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
wrapper = File.read installed_exec
@@ -391,7 +391,7 @@ gem 'other', version
installer.generate_bin
assert_directory_exists util_inst_bindir
installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
ensure
Gem::Installer.exec_format = nil
end
@@ -407,7 +407,7 @@ gem 'other', version
installer.generate_bin
assert_directory_exists util_inst_bindir
installed_exec = File.join util_inst_bindir, 'executable'
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
ensure
Gem::Installer.exec_format = nil
end
@@ -431,7 +431,7 @@ gem 'other', version
installer.generate_bin
installed_exec = File.join("#{@gemhome}2", "bin", 'executable')
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
wrapper = File.read installed_exec
@@ -446,7 +446,7 @@ gem 'other', version
installer.wrappers = true
installer.generate_bin
- refute_path_exists util_inst_bindir, 'bin dir was created when not needed'
+ assert_path_not_exist util_inst_bindir, 'bin dir was created when not needed'
end
def test_generate_bin_script_no_perms
@@ -488,7 +488,7 @@ gem 'other', version
installer.generate_bin
installed_exec = File.join @gemhome, 'bin', 'executable'
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
wrapper = File.read installed_exec
@@ -515,7 +515,7 @@ gem 'other', version
installer.generate_bin
assert_directory_exists util_inst_bindir
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
assert_match %r{generated by RubyGems}, File.read(installed_exec)
@@ -549,7 +549,7 @@ gem 'other', version
installer.wrappers = false
installer.generate_bin
- refute_path_exists util_inst_bindir
+ assert_path_not_exist util_inst_bindir
end
def test_generate_bin_symlink_no_perms
@@ -658,7 +658,7 @@ gem 'other', version
installer.generate_bin
installed_exec = File.join util_inst_bindir, 'executable'
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
@spec = Gem::Specification.new do |s|
s.files = ['lib/code.rb']
@@ -701,7 +701,7 @@ gem 'other', version
assert_directory_exists util_inst_bindir
installed_exec = File.join(util_inst_bindir, 'executable')
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
if symlink_supported?
assert File.symlink?(installed_exec)
@@ -946,22 +946,22 @@ gem 'other', version
spec_file = File.join @gemhome, 'specifications', @spec.spec_name
Gem.pre_install do
- refute_path_exists cache_file, 'cache file must not exist yet'
- refute_path_exists spec_file, 'spec file must not exist yet'
+ assert_path_not_exist cache_file, 'cache file must not exist yet'
+ assert_path_not_exist spec_file, 'spec file must not exist yet'
true
end
Gem.post_build do
- assert_path_exists gemdir, 'gem install dir must exist'
- assert_path_exists rakefile, 'gem executable must exist'
- refute_path_exists stub_exe, 'gem executable must not exist'
- refute_path_exists spec_file, 'spec file must not exist yet'
+ assert_path_exist gemdir, 'gem install dir must exist'
+ assert_path_exist rakefile, 'gem executable must exist'
+ assert_path_not_exist stub_exe, 'gem executable must not exist'
+ assert_path_not_exist spec_file, 'spec file must not exist yet'
true
end
Gem.post_install do
- assert_path_exists cache_file, 'cache file must exist'
- assert_path_exists spec_file, 'spec file must exist'
+ assert_path_exist cache_file, 'cache file must exist'
+ assert_path_exist spec_file, 'spec file must exist'
end
@newspec = nil
@@ -972,21 +972,21 @@ gem 'other', version
end
assert_equal @spec, @newspec
- assert_path_exists gemdir
- assert_path_exists stub_exe, 'gem executable must exist'
+ assert_path_exist gemdir
+ assert_path_exist stub_exe, 'gem executable must exist'
exe = File.join gemdir, 'bin', 'executable'
- assert_path_exists exe
+ assert_path_exist exe
exe_mode = File.stat(exe).mode & 0111
assert_equal 0111, exe_mode, "0%o" % exe_mode unless win_platform?
- assert_path_exists File.join gemdir, 'lib', 'code.rb'
+ assert_path_exist File.join gemdir, 'lib', 'code.rb'
- assert_path_exists rakefile
+ assert_path_exist rakefile
assert_equal spec_file, @newspec.loaded_from
- assert_path_exists spec_file
+ assert_path_exist spec_file
assert_same installer, @post_build_hook_arg
assert_same installer, @post_install_hook_arg
@@ -1100,7 +1100,7 @@ gem 'other', version
exe = File.join @gemhome, 'bin', 'executable'
- assert_path_exists exe, "default gem's executable not installed"
+ assert_path_exist exe, "default gem's executable not installed"
installer = util_setup_installer do |spec|
spec.name = 'default'
@@ -1165,7 +1165,7 @@ gem 'other', version
end
gemdir = File.join(@gemhome, 'gems', @spec.full_name)
- assert_path_exists File.join gemdir, 'lib', 'code.rb'
+ assert_path_exist File.join gemdir, 'lib', 'code.rb'
installer = util_setup_installer
@@ -1188,8 +1188,8 @@ gem 'other', version
end
end
- assert_path_exists File.join gemdir, 'lib', 'other.rb'
- refute_path_exists File.join gemdir, 'lib', 'code.rb',
+ assert_path_exist File.join gemdir, 'lib', 'other.rb'
+ assert_path_not_exist File.join gemdir, 'lib', 'code.rb',
"code.rb from prior install of same gem shouldn't remain here"
end
@@ -1204,7 +1204,7 @@ gem 'other', version
end
gem_dir = File.join(@gemhome, 'gems', 'missing_dep-1')
- assert_path_exists gem_dir
+ assert_path_exist gem_dir
end
def test_install_build_root
@@ -1231,8 +1231,8 @@ gem 'other', version
assert_directory_exists File.join(Gem.dir, 'doc')
assert_directory_exists File.join(Gem.dir, 'specifications')
- assert_path_exists File.join @gemhome, 'cache', @spec.file_name
- assert_path_exists File.join @gemhome, 'specifications', @spec.spec_name
+ assert_path_exist File.join @gemhome, 'cache', @spec.file_name
+ assert_path_exist File.join @gemhome, 'specifications', @spec.spec_name
end
def test_install_post_build_false
@@ -1253,10 +1253,10 @@ gem 'other', version
end
spec_file = File.join @gemhome, 'specifications', @spec.spec_name
- refute_path_exists spec_file
+ assert_path_not_exist spec_file
gem_dir = File.join @gemhome, 'gems', @spec.full_name
- refute_path_exists gem_dir
+ assert_path_not_exist gem_dir
end
def test_install_post_build_nil
@@ -1271,10 +1271,10 @@ gem 'other', version
end
spec_file = File.join @gemhome, 'specifications', @spec.spec_name
- assert_path_exists spec_file
+ assert_path_exist spec_file
gem_dir = File.join @gemhome, 'gems', @spec.full_name
- assert_path_exists gem_dir
+ assert_path_exist gem_dir
end
def test_install_pre_install_false
@@ -1295,7 +1295,7 @@ gem 'other', version
end
spec_file = File.join @gemhome, 'specifications', @spec.spec_name
- refute_path_exists spec_file
+ assert_path_not_exist spec_file
end
def test_install_pre_install_nil
@@ -1310,7 +1310,7 @@ gem 'other', version
end
spec_file = File.join @gemhome, 'specifications', @spec.spec_name
- assert_path_exists spec_file
+ assert_path_exist spec_file
end
def test_install_with_message
@@ -1364,7 +1364,7 @@ gem 'other', version
expected_makefile = File.join gemhome2, 'gems', @spec.full_name, 'Makefile'
- assert_path_exists expected_makefile
+ assert_path_exist expected_makefile
end
def test_install_extension_dir_is_removed_on_reinstall
@@ -1393,7 +1393,7 @@ gem 'other', version
write_file should_be_removed do |io|
io.write "DELETE ME ON REINSTALL"
end
- assert_path_exists should_be_removed
+ assert_path_exist should_be_removed
# reinstall the gem, this is also the same as pristine
use_ui @ui do
@@ -1401,7 +1401,7 @@ gem 'other', version
installer.install
end
- refute_path_exists should_be_removed
+ assert_path_not_exist should_be_removed
end
def test_install_user_extension_dir
@@ -1429,9 +1429,9 @@ gem 'other', version
expected_makefile = File.join Gem.user_dir, 'gems', @spec.full_name, 'Makefile'
- assert_path_exists expected_makefile
- assert_path_exists expected_extension_dir
- refute_path_exists File.join expected_extension_dir, 'gem_make.out'
+ assert_path_exist expected_makefile
+ assert_path_exist expected_extension_dir
+ assert_path_not_exist File.join expected_extension_dir, 'gem_make.out'
end
def test_find_lib_file_after_install
@@ -1510,16 +1510,16 @@ gem 'other', version
RUBY
end
- refute_path_exists File.join @spec.gem_dir, rb
- refute_path_exists File.join @spec.gem_dir, rb2
+ assert_path_not_exist File.join @spec.gem_dir, rb
+ assert_path_not_exist File.join @spec.gem_dir, rb2
use_ui @ui do
path = Gem::Package.build @spec
installer = Gem::Installer.at path
installer.install
end
- assert_path_exists File.join @spec.gem_dir, rb
- assert_path_exists File.join @spec.gem_dir, rb2
+ assert_path_exist File.join @spec.gem_dir, rb
+ assert_path_exist File.join @spec.gem_dir, rb2
end
def test_install_extension_flat
@@ -1548,14 +1548,14 @@ gem 'other', version
end
so = File.join(@spec.gem_dir, "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}")
- refute_path_exists so
+ assert_path_not_exist so
use_ui @ui do
path = Gem::Package.build @spec
installer = Gem::Installer.at path
installer.install
end
- assert_path_exists so
+ assert_path_exist so
rescue
puts '-' * 78
puts File.read File.join(@gemhome, 'gems', 'a-2', 'Makefile')
@@ -1992,14 +1992,14 @@ gem 'other', version
installer.unpack dest
end
- assert_path_exists File.join dest, 'lib', 'code.rb'
- assert_path_exists File.join dest, 'bin', 'executable'
+ assert_path_exist File.join dest, 'lib', 'code.rb'
+ assert_path_exist File.join dest, 'bin', 'executable'
end
def test_write_build_info_file
installer = setup_base_installer
- refute_path_exists @spec.build_info_file
+ assert_path_not_exist @spec.build_info_file
installer.build_args = %w[
--with-libyaml-dir /usr/local/Cellar/libyaml/0.1.4
@@ -2007,7 +2007,7 @@ gem 'other', version
installer.write_build_info_file
- assert_path_exists @spec.build_info_file
+ assert_path_exist @spec.build_info_file
expected = "--with-libyaml-dir\n/usr/local/Cellar/libyaml/0.1.4\n"
@@ -2017,11 +2017,11 @@ gem 'other', version
def test_write_build_info_file_empty
installer = setup_base_installer
- refute_path_exists @spec.build_info_file
+ assert_path_not_exist @spec.build_info_file
installer.write_build_info_file
- refute_path_exists @spec.build_info_file
+ assert_path_not_exist @spec.build_info_file
end
def test_write_build_info_file_install_dir
@@ -2034,8 +2034,8 @@ gem 'other', version
installer.write_build_info_file
- refute_path_exists @spec.build_info_file
- assert_path_exists \
+ assert_path_not_exist @spec.build_info_file
+ assert_path_exist \
File.join("#{@gemhome}2", 'build_info', "#{@spec.full_name}.info")
end
@@ -2045,27 +2045,27 @@ gem 'other', version
gem = File.join @gemhome, @spec.file_name
FileUtils.mv cache_file, gem
- refute_path_exists cache_file
+ assert_path_not_exist cache_file
installer = Gem::Installer.at gem
installer.gem_home = @gemhome
installer.write_cache_file
- assert_path_exists cache_file
+ assert_path_exist cache_file
end
def test_write_spec
@spec = setup_base_spec
FileUtils.rm @spec.spec_file
- refute_path_exists @spec.spec_file
+ assert_path_not_exist @spec.spec_file
installer = Gem::Installer.for_spec @spec
installer.gem_home = @gemhome
installer.write_spec
- assert_path_exists @spec.spec_file
+ assert_path_exist @spec.spec_file
loaded = Gem::Specification.load @spec.spec_file
@@ -2077,7 +2077,7 @@ gem 'other', version
def test_write_spec_writes_cached_spec
@spec = setup_base_spec
FileUtils.rm @spec.spec_file
- refute_path_exists @spec.spec_file
+ assert_path_not_exist @spec.spec_file
@spec.files = %w[a.rb b.rb c.rb]
@@ -2120,7 +2120,7 @@ gem 'other', version
assert_directory_exists File.join(@spec.gem_dir, 'bin')
installed_exec = File.join @spec.gem_dir, 'bin', 'executable'
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
assert_directory_exists File.join(Gem.default_dir, 'specifications')
assert_directory_exists File.join(Gem.default_dir, 'specifications', 'default')
@@ -2132,7 +2132,7 @@ gem 'other', version
assert_directory_exists util_inst_bindir
installed_exec = File.join util_inst_bindir, 'executable'
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
wrapper = File.read installed_exec
@@ -2158,7 +2158,7 @@ gem 'other', version
assert_directory_exists util_inst_bindir
installed_exec = File.join util_inst_bindir, 'executable'
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
wrapper = File.read installed_exec
assert_match %r{generated by RubyGems}, wrapper
@@ -2184,7 +2184,7 @@ gem 'other', version
assert_directory_exists File.join(@spec.gem_dir, 'exe')
installed_exec = File.join @spec.gem_dir, 'exe', 'executable'
- assert_path_exists installed_exec
+ assert_path_exist installed_exec
assert_directory_exists File.join(Gem.default_dir, 'specifications')
assert_directory_exists File.join(Gem.default_dir, 'specifications', 'default')