[rubygems/rubygems] Use assert_path_exist and assert_path_not_exist instead of assert_path_exists and refute_path_exists

a7c93558c3
This commit is contained in:
Hiroshi SHIBATA 2020-05-25 21:05:45 +09:00
parent 81d793a921
commit 3948be3503
Notes: git 2021-05-12 17:25:22 +09:00
36 changed files with 302 additions and 302 deletions

View file

@ -141,7 +141,7 @@ class Gem::TestCase < Test::Unit::TestCase
def assert_directory_exists(path, msg = nil) def assert_directory_exists(path, msg = nil)
msg = build_message(msg, "Expected path '#{path}' to be a directory") msg = build_message(msg, "Expected path '#{path}' to be a directory")
assert_path_exists path assert_path_exist path
assert File.directory?(path), msg assert File.directory?(path), msg
end end

View file

@ -106,7 +106,7 @@ class TestGem < Gem::TestCase
assert_equal %w[a-1], installed.map {|spec| spec.full_name } assert_equal %w[a-1], installed.map {|spec| spec.full_name }
assert_path_exists File.join(gemhome2, 'gems', 'a-1') assert_path_exist File.join(gemhome2, 'gems', 'a-1')
end end
def test_self_install_in_rescue def test_self_install_in_rescue
@ -692,12 +692,12 @@ class TestGem < Gem::TestCase
Gem.ensure_gem_subdirectories @gemhome Gem.ensure_gem_subdirectories @gemhome
assert_path_exists File.join @gemhome, 'build_info' assert_path_exist File.join @gemhome, 'build_info'
assert_path_exists File.join @gemhome, 'cache' assert_path_exist File.join @gemhome, 'cache'
assert_path_exists File.join @gemhome, 'doc' assert_path_exist File.join @gemhome, 'doc'
assert_path_exists File.join @gemhome, 'extensions' assert_path_exist File.join @gemhome, 'extensions'
assert_path_exists File.join @gemhome, 'gems' assert_path_exist File.join @gemhome, 'gems'
assert_path_exists File.join @gemhome, 'specifications' assert_path_exist File.join @gemhome, 'specifications'
end end
def test_self_ensure_gem_directories_permissions def test_self_ensure_gem_directories_permissions

View file

@ -83,7 +83,7 @@ class TestGemCommandsCertCommand < Gem::TestCase
cert_path = @trust_dir.cert_path PUBLIC_CERT cert_path = @trust_dir.cert_path PUBLIC_CERT
assert_path_exists cert_path assert_path_exist cert_path
assert_equal "Added '/CN=nobody/DC=example'\n", @ui.output assert_equal "Added '/CN=nobody/DC=example'\n", @ui.output
assert_empty @ui.error assert_empty @ui.error
@ -138,8 +138,8 @@ Added '/CN=alternate/DC=example'
assert_empty output assert_empty output
assert_empty @build_ui.error assert_empty @build_ui.error
assert_path_exists File.join(@tempdir, 'gem-private_key.pem') assert_path_exist File.join(@tempdir, 'gem-private_key.pem')
assert_path_exists File.join(@tempdir, 'gem-public_cert.pem') assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
end end
def test_execute_build_bad_email_address def test_execute_build_bad_email_address
@ -159,8 +159,8 @@ Added '/CN=alternate/DC=example'
assert_equal "Invalid email address #{email}", assert_equal "Invalid email address #{email}",
e.message e.message
refute_path_exists File.join(@tempdir, 'gem-private_key.pem') assert_path_not_exist File.join(@tempdir, 'gem-private_key.pem')
refute_path_exists File.join(@tempdir, 'gem-public_cert.pem') assert_path_not_exist File.join(@tempdir, 'gem-public_cert.pem')
end end
end end
@ -195,8 +195,8 @@ Added '/CN=alternate/DC=example'
assert_empty output assert_empty output
assert_empty @build_ui.error assert_empty @build_ui.error
assert_path_exists File.join(@tempdir, 'gem-private_key.pem') assert_path_exist File.join(@tempdir, 'gem-private_key.pem')
assert_path_exists File.join(@tempdir, 'gem-public_cert.pem') assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
pem = File.read("#{@tempdir}/gem-public_cert.pem") pem = File.read("#{@tempdir}/gem-public_cert.pem")
cert = OpenSSL::X509::Certificate.new(pem) cert = OpenSSL::X509::Certificate.new(pem)
@ -232,8 +232,8 @@ Added '/CN=alternate/DC=example'
end end
refute_path_exists File.join(@tempdir, 'gem-private_key.pem') assert_path_not_exist File.join(@tempdir, 'gem-private_key.pem')
refute_path_exists File.join(@tempdir, 'gem-public_cert.pem') assert_path_not_exist File.join(@tempdir, 'gem-public_cert.pem')
end end
def test_execute_build_key def test_execute_build_key
@ -254,8 +254,8 @@ Added '/CN=alternate/DC=example'
assert_empty output assert_empty output
assert_empty @ui.error assert_empty @ui.error
assert_path_exists File.join(@tempdir, 'gem-public_cert.pem') assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
refute_path_exists File.join(@tempdir, 'gem-private_key.pem') assert_path_not_exist File.join(@tempdir, 'gem-private_key.pem')
end end
def test_execute_build_encrypted_key def test_execute_build_encrypted_key
@ -276,7 +276,7 @@ Added '/CN=alternate/DC=example'
assert_empty output assert_empty output
assert_empty @ui.error assert_empty @ui.error
assert_path_exists File.join(@tempdir, 'gem-public_cert.pem') assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
end end
def test_execute_certificate def test_execute_certificate
@ -346,7 +346,7 @@ Added '/CN=alternate/DC=example'
cert_path = @trust_dir.cert_path PUBLIC_CERT cert_path = @trust_dir.cert_path PUBLIC_CERT
assert_path_exists cert_path assert_path_exist cert_path
@cmd.handle_options %W[--remove nobody] @cmd.handle_options %W[--remove nobody]
@ -357,7 +357,7 @@ Added '/CN=alternate/DC=example'
assert_equal "Removed '/CN=nobody/DC=example'\n", @ui.output assert_equal "Removed '/CN=nobody/DC=example'\n", @ui.output
assert_equal '', @ui.error assert_equal '', @ui.error
refute_path_exists cert_path assert_path_not_exist cert_path
end end
def test_execute_remove_multiple def test_execute_remove_multiple
@ -367,8 +367,8 @@ Added '/CN=alternate/DC=example'
public_path = @trust_dir.cert_path PUBLIC_CERT public_path = @trust_dir.cert_path PUBLIC_CERT
alternate_path = @trust_dir.cert_path ALTERNATE_CERT alternate_path = @trust_dir.cert_path ALTERNATE_CERT
assert_path_exists public_path assert_path_exist public_path
assert_path_exists alternate_path assert_path_exist alternate_path
@cmd.handle_options %W[--remove example] @cmd.handle_options %W[--remove example]
@ -384,8 +384,8 @@ Removed '/CN=nobody/DC=example'
assert_equal expected, @ui.output assert_equal expected, @ui.output
assert_equal '', @ui.error assert_equal '', @ui.error
refute_path_exists public_path assert_path_not_exist public_path
refute_path_exists alternate_path assert_path_not_exist alternate_path
end end
def test_execute_remove_twice def test_execute_remove_twice
@ -395,8 +395,8 @@ Removed '/CN=nobody/DC=example'
public_path = @trust_dir.cert_path PUBLIC_CERT public_path = @trust_dir.cert_path PUBLIC_CERT
alternate_path = @trust_dir.cert_path ALTERNATE_CERT alternate_path = @trust_dir.cert_path ALTERNATE_CERT
assert_path_exists public_path assert_path_exist public_path
assert_path_exists alternate_path assert_path_exist alternate_path
@cmd.handle_options %W[--remove nobody --remove alternate] @cmd.handle_options %W[--remove nobody --remove alternate]
@ -412,8 +412,8 @@ Removed '/CN=alternate/DC=example'
assert_equal expected, @ui.output assert_equal expected, @ui.output
assert_equal '', @ui.error assert_equal '', @ui.error
refute_path_exists public_path assert_path_not_exist public_path
refute_path_exists alternate_path assert_path_not_exist alternate_path
end end
def test_execute_sign def test_execute_sign

View file

@ -50,8 +50,8 @@ class TestGemCommandsCheckCommand < Gem::TestCase
FileUtils.rm b.spec_file FileUtils.rm b.spec_file
assert_path_exists b.gem_dir assert_path_exist b.gem_dir
refute_path_exists b.spec_file assert_path_not_exist b.spec_file
Gem.use_paths @gemhome Gem.use_paths @gemhome
@ -61,7 +61,7 @@ class TestGemCommandsCheckCommand < Gem::TestCase
end end
end end
refute_path_exists b.gem_dir assert_path_not_exist b.gem_dir
refute_path_exists b.spec_file assert_path_not_exist b.spec_file
end end
end end

View file

@ -62,7 +62,7 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
@cmd.execute @cmd.execute
refute_path_exists @a_1.gem_dir assert_path_not_exist @a_1.gem_dir
end end
def test_execute_all_dependencies def test_execute_all_dependencies
@ -81,8 +81,8 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
@cmd.execute @cmd.execute
refute_path_exists @a_1.gem_dir assert_path_not_exist @a_1.gem_dir
refute_path_exists @b_1.gem_dir assert_path_not_exist @b_1.gem_dir
end end
def test_execute_dev_dependencies def test_execute_dev_dependencies
@ -101,7 +101,7 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
@cmd.execute @cmd.execute
assert_path_exists @a_1.gem_dir assert_path_exist @a_1.gem_dir
end end
def test_execute_without_dev_dependencies def test_execute_without_dev_dependencies
@ -120,7 +120,7 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
@cmd.execute @cmd.execute
refute_path_exists @a_1.gem_dir assert_path_not_exist @a_1.gem_dir
end end
def test_execute_all def test_execute_all
@ -143,8 +143,8 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
assert_equal @gemhome, Gem.dir, 'GEM_HOME' assert_equal @gemhome, Gem.dir, 'GEM_HOME'
assert_equal [@gemhome, gemhome2], Gem.path.sort, 'GEM_PATH' assert_equal [@gemhome, gemhome2], Gem.path.sort, 'GEM_PATH'
refute_path_exists @a_1.gem_dir assert_path_not_exist @a_1.gem_dir
refute_path_exists @b_1.gem_dir assert_path_not_exist @b_1.gem_dir
end end
def test_execute_all_user def test_execute_all_user
@ -153,15 +153,15 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
Gem::Specification.dirs = [Gem.dir, Gem.user_dir] Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
assert_path_exists @a_1.gem_dir assert_path_exist @a_1.gem_dir
assert_path_exists @a_1_1.gem_dir assert_path_exist @a_1_1.gem_dir
@cmd.options[:args] = %w[a] @cmd.options[:args] = %w[a]
@cmd.execute @cmd.execute
refute_path_exists @a_1.gem_dir assert_path_not_exist @a_1.gem_dir
refute_path_exists @a_1_1.gem_dir assert_path_not_exist @a_1_1.gem_dir
end end
def test_execute_all_user_no_sudo def test_execute_all_user_no_sudo
@ -172,15 +172,15 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
Gem::Specification.dirs = [Gem.dir, Gem.user_dir] Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
assert_path_exists @a_1.gem_dir assert_path_exist @a_1.gem_dir
assert_path_exists @a_1_1.gem_dir assert_path_exist @a_1_1.gem_dir
@cmd.options[:args] = %w[a] @cmd.options[:args] = %w[a]
@cmd.execute @cmd.execute
assert_path_exists @a_1.gem_dir assert_path_exist @a_1.gem_dir
assert_path_exists @a_1_1.gem_dir assert_path_exist @a_1_1.gem_dir
ensure ensure
FileUtils.chmod 0755, @gemhome FileUtils.chmod 0755, @gemhome
end unless win_platform? || Process.uid.zero? end unless win_platform? || Process.uid.zero?
@ -191,7 +191,7 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
@cmd.execute @cmd.execute
assert_path_exists @a_1.gem_dir assert_path_exist @a_1.gem_dir
end end
def test_execute_keeps_older_versions_with_deps def test_execute_keeps_older_versions_with_deps
@ -210,7 +210,7 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
@cmd.execute @cmd.execute
assert_path_exists @b_1.gem_dir assert_path_exist @b_1.gem_dir
end end
def test_execute_ignore_default_gem_verbose def test_execute_ignore_default_gem_verbose
@ -257,9 +257,9 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
@cmd.execute @cmd.execute
assert_path_exists c_1.gem_dir assert_path_exist c_1.gem_dir
refute_path_exists d_1.gem_dir assert_path_not_exist d_1.gem_dir
refute_path_exists e_1.gem_dir assert_path_not_exist e_1.gem_dir
end end
def test_execute_user_install def test_execute_user_install
@ -282,10 +282,10 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
@cmd.execute @cmd.execute
refute_path_exists c_1.gem_dir assert_path_not_exist c_1.gem_dir
assert_path_exists c_2.gem_dir assert_path_exist c_2.gem_dir
assert_path_exists d_1.gem_dir assert_path_exist d_1.gem_dir
assert_path_exists d_2.gem_dir assert_path_exist d_2.gem_dir
end end
end end

View file

@ -16,7 +16,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
fetcher.gem 'a', 2 fetcher.gem 'a', 2
end end
refute_path_exists File.join(@tempdir, 'cache'), 'sanity check' assert_path_not_exist File.join(@tempdir, 'cache'), 'sanity check'
@cmd.options[:args] = %w[a] @cmd.options[:args] = %w[a]
@ -28,9 +28,9 @@ class TestGemCommandsFetchCommand < Gem::TestCase
a2 = specs['a-2'] a2 = specs['a-2']
assert_path_exists(File.join(@tempdir, a2.file_name), assert_path_exist(File.join(@tempdir, a2.file_name),
"#{a2.full_name} not fetched") "#{a2.full_name} not fetched")
refute_path_exists File.join(@tempdir, 'cache'), assert_path_not_exist File.join(@tempdir, 'cache'),
'gem repository directories must not be created' 'gem repository directories must not be created'
end end
@ -40,7 +40,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
fetcher.gem 'a', 2 fetcher.gem 'a', 2
end end
refute_path_exists File.join(@tempdir, 'cache'), 'sanity check' assert_path_not_exist File.join(@tempdir, 'cache'), 'sanity check'
@cmd.options[:args] = %w[a] @cmd.options[:args] = %w[a]
@cmd.options[:version] = req('>= 0.1') @cmd.options[:version] = req('>= 0.1')
@ -52,9 +52,9 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end end
a2 = specs['a-2'] a2 = specs['a-2']
assert_path_exists(File.join(@tempdir, a2.file_name), assert_path_exist(File.join(@tempdir, a2.file_name),
"#{a2.full_name} not fetched") "#{a2.full_name} not fetched")
refute_path_exists File.join(@tempdir, 'cache'), assert_path_not_exist File.join(@tempdir, 'cache'),
'gem repository directories must not be created' 'gem repository directories must not be created'
end end
@ -75,7 +75,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
a2 = specs['a-2'] a2 = specs['a-2']
assert_path_exists(File.join(@tempdir, a2.file_name), assert_path_exist(File.join(@tempdir, a2.file_name),
"#{a2.full_name} not fetched") "#{a2.full_name} not fetched")
end end
@ -97,7 +97,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
a2_pre = specs['a-2.a'] a2_pre = specs['a-2.a']
assert_path_exists(File.join(@tempdir, a2_pre.file_name), assert_path_exist(File.join(@tempdir, a2_pre.file_name),
"#{a2_pre.full_name} not fetched") "#{a2_pre.full_name} not fetched")
end end
@ -118,7 +118,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
a1 = specs['a-1'] a1 = specs['a-1']
assert_path_exists(File.join(@tempdir, a1.file_name), assert_path_exist(File.join(@tempdir, a1.file_name),
"#{a1.full_name} not fetched") "#{a1.full_name} not fetched")
end end
end end

View file

@ -667,8 +667,8 @@ ERROR: Possible alternatives: non_existent_with_hint
wait_for_child_process_to_exit wait_for_child_process_to_exit
assert_path_exists File.join(a2.doc_dir, 'ri') assert_path_exist File.join(a2.doc_dir, 'ri')
assert_path_exists File.join(a2.doc_dir, 'rdoc') assert_path_exist File.join(a2.doc_dir, 'rdoc')
end end
def test_execute_rdoc_with_path def test_execute_rdoc_with_path
@ -704,7 +704,7 @@ ERROR: Possible alternatives: non_existent_with_hint
wait_for_child_process_to_exit wait_for_child_process_to_exit
assert_path_exists 'whatever/doc/a-2', 'documentation not installed' assert_path_exist 'whatever/doc/a-2', 'documentation not installed'
end end
def test_execute_saves_build_args def test_execute_saves_build_args
@ -739,7 +739,7 @@ ERROR: Possible alternatives: non_existent_with_hint
end end
path = a2.build_info_file path = a2.build_info_file
assert_path_exists path assert_path_exist path
assert_equal args, a2.build_args assert_equal args, a2.build_args
end end

View file

@ -155,7 +155,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
@cmd.execute @cmd.execute
end end
assert_path_exists gem_exec assert_path_exist gem_exec
ruby_exec = sprintf Gem.default_exec_format, 'ruby' ruby_exec = sprintf Gem.default_exec_format, 'ruby'
@ -356,10 +356,10 @@ class TestGemCommandsPristineCommand < Gem::TestCase
assert_equal "Restored #{b.full_name}", out.shift assert_equal "Restored #{b.full_name}", out.shift
assert_empty out, out.inspect assert_empty out, out.inspect
assert_path_exists File.join(@gemhome, "gems", 'a-2') assert_path_exist File.join(@gemhome, "gems", 'a-2')
refute_path_exists File.join(gemhome2, "gems", 'a-2') assert_path_not_exist File.join(gemhome2, "gems", 'a-2')
assert_path_exists File.join(gemhome2, "gems", 'b-2') assert_path_exist File.join(gemhome2, "gems", 'b-2')
refute_path_exists File.join(@gemhome, "gems", 'b-2') assert_path_not_exist File.join(@gemhome, "gems", 'b-2')
end end
def test_execute_missing_cache_gem def test_execute_missing_cache_gem
@ -434,15 +434,15 @@ class TestGemCommandsPristineCommand < Gem::TestCase
assert_empty out, out.inspect assert_empty out, out.inspect
assert_empty @ui.error assert_empty @ui.error
assert_path_exists File.join(@gemhome, "cache", 'a-1.gem') assert_path_exist File.join(@gemhome, "cache", 'a-1.gem')
refute_path_exists File.join(gemhome2, "cache", 'a-2.gem') assert_path_not_exist File.join(gemhome2, "cache", 'a-2.gem')
assert_path_exists File.join(@gemhome, "gems", 'a-1') assert_path_exist File.join(@gemhome, "gems", 'a-1')
refute_path_exists File.join(gemhome2, "gems", 'a-1') assert_path_not_exist File.join(gemhome2, "gems", 'a-1')
assert_path_exists File.join(gemhome2, "cache", 'b-1.gem') assert_path_exist File.join(gemhome2, "cache", 'b-1.gem')
refute_path_exists File.join(@gemhome, "cache", 'b-2.gem') assert_path_not_exist File.join(@gemhome, "cache", 'b-2.gem')
assert_path_exists File.join(gemhome2, "gems", 'b-1') assert_path_exist File.join(gemhome2, "gems", 'b-1')
refute_path_exists File.join(@gemhome, "gems", 'b-1') assert_path_not_exist File.join(@gemhome, "gems", 'b-1')
end end
def test_execute_no_gem def test_execute_no_gem

View file

@ -169,14 +169,14 @@ class TestGemCommandsSetupCommand < Gem::TestCase
Dir.mktmpdir 'lib' do |dir| Dir.mktmpdir 'lib' do |dir|
@cmd.install_lib dir @cmd.install_lib dir
assert_path_exists File.join(dir, 'rubygems.rb') assert_path_exist File.join(dir, 'rubygems.rb')
assert_path_exists File.join(dir, 'rubygems/ssl_certs/rubygems.org/foo.pem') assert_path_exist File.join(dir, 'rubygems/ssl_certs/rubygems.org/foo.pem')
assert_path_exists File.join(dir, 'bundler.rb') assert_path_exist File.join(dir, 'bundler.rb')
assert_path_exists File.join(dir, 'bundler/b.rb') assert_path_exist File.join(dir, 'bundler/b.rb')
assert_path_exists File.join(dir, 'bundler/templates/.circleci/config.yml') unless RUBY_ENGINE == "truffleruby" # https://github.com/oracle/truffleruby/issues/2116 assert_path_exist File.join(dir, 'bundler/templates/.circleci/config.yml') unless RUBY_ENGINE == "truffleruby" # https://github.com/oracle/truffleruby/issues/2116
assert_path_exists File.join(dir, 'bundler/templates/.travis.yml') assert_path_exist File.join(dir, 'bundler/templates/.travis.yml')
end end
end end
@ -192,27 +192,27 @@ class TestGemCommandsSetupCommand < Gem::TestCase
spec.executables.each do |e| spec.executables.each do |e|
if Gem.win_platform? if Gem.win_platform?
assert_path_exists File.join(bin_dir, "#{e}.bat") assert_path_exist File.join(bin_dir, "#{e}.bat")
end end
assert_path_exists File.join bin_dir, e assert_path_exist File.join bin_dir, e
end end
default_dir = Gem.default_specifications_dir default_dir = Gem.default_specifications_dir
# expect to remove other versions of bundler gemspecs on default specification directory. # expect to remove other versions of bundler gemspecs on default specification directory.
refute_path_exists File.join(default_dir, "bundler-1.15.4.gemspec") assert_path_not_exist File.join(default_dir, "bundler-1.15.4.gemspec")
assert_path_exists File.join(default_dir, "bundler-#{BUNDLER_VERS}.gemspec") assert_path_exist File.join(default_dir, "bundler-#{BUNDLER_VERS}.gemspec")
# expect to not remove bundler-* gemspecs. # expect to not remove bundler-* gemspecs.
assert_path_exists File.join(Gem.dir, "specifications", "bundler-audit-1.0.0.gemspec") assert_path_exist File.join(Gem.dir, "specifications", "bundler-audit-1.0.0.gemspec")
# expect to remove normal gem that was same version. because it's promoted default gems. # expect to remove normal gem that was same version. because it's promoted default gems.
refute_path_exists File.join(Gem.dir, "specifications", "bundler-#{BUNDLER_VERS}.gemspec") assert_path_not_exist File.join(Gem.dir, "specifications", "bundler-#{BUNDLER_VERS}.gemspec")
assert_path_exists "#{Gem.dir}/gems/bundler-#{BUNDLER_VERS}" assert_path_exist "#{Gem.dir}/gems/bundler-#{BUNDLER_VERS}"
assert_path_exists "#{Gem.dir}/gems/bundler-1.15.4" assert_path_exist "#{Gem.dir}/gems/bundler-1.15.4"
assert_path_exists "#{Gem.dir}/gems/bundler-audit-1.0.0" assert_path_exist "#{Gem.dir}/gems/bundler-audit-1.0.0"
end end
def test_install_default_bundler_gem_with_force_flag def test_install_default_bundler_gem_with_force_flag
@ -238,10 +238,10 @@ class TestGemCommandsSetupCommand < Gem::TestCase
spec.executables.each do |e| spec.executables.each do |e|
if Gem.win_platform? if Gem.win_platform?
assert_path_exists File.join(bin_dir, "#{e}.bat") assert_path_exist File.join(bin_dir, "#{e}.bat")
end end
assert_path_exists File.join bin_dir, e assert_path_exist File.join bin_dir, e
end end
end end
end end
@ -272,9 +272,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
@cmd.remove_old_lib_files lib @cmd.remove_old_lib_files lib
files_that_go.each {|file| refute_path_exists(file) unless file == old_bundler_ci && RUBY_ENGINE == "truffleruby" } # https://github.com/oracle/truffleruby/issues/2116 files_that_go.each {|file| assert_path_not_exist(file) unless file == old_bundler_ci && RUBY_ENGINE == "truffleruby" } # https://github.com/oracle/truffleruby/issues/2116
files_that_stay.each {|file| assert_path_exists file } files_that_stay.each {|file| assert_path_exist file }
end end
def test_remove_old_man_files def test_remove_old_man_files
@ -295,9 +295,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
@cmd.remove_old_man_files man @cmd.remove_old_man_files man
files_that_go.each {|file| refute_path_exists file } files_that_go.each {|file| assert_path_not_exist file }
files_that_stay.each {|file| assert_path_exists file } files_that_stay.each {|file| assert_path_exist file }
end end
def test_show_release_notes def test_show_release_notes

View file

@ -210,7 +210,7 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end end
end end
assert_path_exists File.join(@tempdir, foo_spec.full_name) assert_path_exist File.join(@tempdir, foo_spec.full_name)
end end
def test_handle_options_metadata def test_handle_options_metadata

View file

@ -211,7 +211,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
@cmd.execute @cmd.execute
refute_path_exists Gem.plugindir, "Plugins folder not removed when updating rubygems to pre-3.2" assert_path_not_exist Gem.plugindir, "Plugins folder not removed when updating rubygems to pre-3.2"
end end
def test_execute_system_specific_newer_than_or_equal_to_3_2_leaves_plugins_dir_alone def test_execute_system_specific_newer_than_or_equal_to_3_2_leaves_plugins_dir_alone
@ -239,8 +239,8 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
@cmd.execute @cmd.execute
assert_path_exists Gem.plugindir, "Plugin folder removed when updating rubygems to post-3.2" assert_path_exist Gem.plugindir, "Plugin folder removed when updating rubygems to post-3.2"
assert_path_exists plugin_file, "Plugin removed when updating rubygems to post-3.2" assert_path_exist plugin_file, "Plugin removed when updating rubygems to post-3.2"
end end
def test_execute_system_specifically_to_latest_version def test_execute_system_specifically_to_latest_version
@ -384,7 +384,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
a2 = @specs['a-2'] a2 = @specs['a-2']
assert_path_exists File.join(a2.doc_dir, 'rdoc') assert_path_exist File.join(a2.doc_dir, 'rdoc')
end end
def test_execute_named def test_execute_named

View file

@ -392,7 +392,7 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal %w[f-1], inst.installed_gems.map {|s| s.full_name } assert_equal %w[f-1], inst.installed_gems.map {|s| s.full_name }
assert_path_exists e1.extension_dir assert_path_exist e1.extension_dir
end end
def test_install_dependency_old def test_install_dependency_old

View file

@ -27,14 +27,14 @@ class TestGemDoctor < Gem::TestCase
io.write 'this will raise an exception when evaluated.' io.write 'this will raise an exception when evaluated.'
end end
assert_path_exists File.join(a.gem_dir, 'Rakefile') assert_path_exist File.join(a.gem_dir, 'Rakefile')
assert_path_exists File.join(a.gem_dir, 'lib', 'a.rb') assert_path_exist File.join(a.gem_dir, 'lib', 'a.rb')
assert_path_exists b.gem_dir assert_path_exist b.gem_dir
refute_path_exists b.spec_file assert_path_not_exist b.spec_file
assert_path_exists c.gem_dir assert_path_exist c.gem_dir
assert_path_exists c.spec_file assert_path_exist c.spec_file
doctor = Gem::Doctor.new @gemhome doctor = Gem::Doctor.new @gemhome
@ -44,14 +44,14 @@ class TestGemDoctor < Gem::TestCase
end end
end end
assert_path_exists File.join(a.gem_dir, 'Rakefile') assert_path_exist File.join(a.gem_dir, 'Rakefile')
assert_path_exists File.join(a.gem_dir, 'lib', 'a.rb') assert_path_exist File.join(a.gem_dir, 'lib', 'a.rb')
refute_path_exists b.gem_dir assert_path_not_exist b.gem_dir
refute_path_exists b.spec_file assert_path_not_exist b.spec_file
refute_path_exists c.gem_dir assert_path_not_exist c.gem_dir
refute_path_exists c.spec_file assert_path_not_exist c.spec_file
expected = <<-OUTPUT expected = <<-OUTPUT
Checking #{@gemhome} Checking #{@gemhome}
@ -80,14 +80,14 @@ Removed directory gems/c-2
io.write 'this will raise an exception when evaluated.' io.write 'this will raise an exception when evaluated.'
end end
assert_path_exists File.join(a.gem_dir, 'Rakefile') assert_path_exist File.join(a.gem_dir, 'Rakefile')
assert_path_exists File.join(a.gem_dir, 'lib', 'a.rb') assert_path_exist File.join(a.gem_dir, 'lib', 'a.rb')
assert_path_exists b.gem_dir assert_path_exist b.gem_dir
refute_path_exists b.spec_file assert_path_not_exist b.spec_file
assert_path_exists c.gem_dir assert_path_exist c.gem_dir
assert_path_exists c.spec_file assert_path_exist c.spec_file
doctor = Gem::Doctor.new @gemhome, true doctor = Gem::Doctor.new @gemhome, true
@ -97,14 +97,14 @@ Removed directory gems/c-2
end end
end end
assert_path_exists File.join(a.gem_dir, 'Rakefile') assert_path_exist File.join(a.gem_dir, 'Rakefile')
assert_path_exists File.join(a.gem_dir, 'lib', 'a.rb') assert_path_exist File.join(a.gem_dir, 'lib', 'a.rb')
assert_path_exists b.gem_dir assert_path_exist b.gem_dir
refute_path_exists b.spec_file assert_path_not_exist b.spec_file
assert_path_exists c.gem_dir assert_path_exist c.gem_dir
assert_path_exists c.spec_file assert_path_exist c.spec_file
expected = <<-OUTPUT expected = <<-OUTPUT
Checking #{@gemhome} Checking #{@gemhome}
@ -133,7 +133,7 @@ Extra directory gems/c-2
end end
end end
assert_path_exists other_dir assert_path_exist other_dir
expected = <<-OUTPUT expected = <<-OUTPUT
Checking #{@tempdir} Checking #{@tempdir}
@ -169,7 +169,7 @@ This directory does not appear to be a RubyGems repository, skipping
end end
end end
# refute_path_exists bad_plugin # assert_path_not_exist bad_plugin
expected = <<-OUTPUT expected = <<-OUTPUT
Checking #{@gemhome} Checking #{@gemhome}

View file

@ -133,12 +133,12 @@ install:
@builder.build_extensions @builder.build_extensions
end end
assert_path_exists @spec.extension_dir assert_path_exist @spec.extension_dir
assert_path_exists @spec.gem_build_complete_path assert_path_exist @spec.gem_build_complete_path
assert_path_exists File.join @spec.extension_dir, 'gem_make.out' assert_path_exist File.join @spec.extension_dir, 'gem_make.out'
assert_path_exists File.join @spec.extension_dir, 'a.rb' assert_path_exist File.join @spec.extension_dir, 'a.rb'
assert_path_exists File.join @spec.gem_dir, 'lib', 'a.rb' assert_path_exist File.join @spec.gem_dir, 'lib', 'a.rb'
assert_path_exists File.join @spec.gem_dir, 'lib', 'a', 'b.rb' assert_path_exist File.join @spec.gem_dir, 'lib', 'a', 'b.rb'
end end
def test_build_extensions_with_gemhome_with_space def test_build_extensions_with_gemhome_with_space
@ -191,12 +191,12 @@ install:
@builder.build_extensions @builder.build_extensions
end end
assert_path_exists @spec.extension_dir assert_path_exist @spec.extension_dir
assert_path_exists @spec.gem_build_complete_path assert_path_exist @spec.gem_build_complete_path
assert_path_exists File.join @spec.extension_dir, 'gem_make.out' assert_path_exist File.join @spec.extension_dir, 'gem_make.out'
assert_path_exists File.join @spec.extension_dir, 'a.rb' assert_path_exist File.join @spec.extension_dir, 'a.rb'
refute_path_exists File.join @spec.gem_dir, 'lib', 'a.rb' assert_path_not_exist File.join @spec.gem_dir, 'lib', 'a.rb'
refute_path_exists File.join @spec.gem_dir, 'lib', 'a', 'b.rb' assert_path_not_exist File.join @spec.gem_dir, 'lib', 'a', 'b.rb'
ensure ensure
class << Gem class << Gem
remove_method :install_extension_in_lib remove_method :install_extension_in_lib
@ -213,7 +213,7 @@ install:
assert_equal '', @ui.output assert_equal '', @ui.output
assert_equal '', @ui.error assert_equal '', @ui.error
refute_path_exists File.join @spec.extension_dir, 'gem_make.out' assert_path_not_exist File.join @spec.extension_dir, 'gem_make.out'
end end
def test_build_extensions_rebuild_failure def test_build_extensions_rebuild_failure
@ -228,7 +228,7 @@ install:
end end
end end
refute_path_exists @spec.gem_build_complete_path assert_path_not_exist @spec.gem_build_complete_path
end end
def test_build_extensions_extconf_bad def test_build_extensions_extconf_bad
@ -254,7 +254,7 @@ install:
assert_match %r{#{Regexp.escape Gem.ruby} .* extconf\.rb}, cmd_make_out assert_match %r{#{Regexp.escape Gem.ruby} .* extconf\.rb}, cmd_make_out
assert_match %r{: No such file}, cmd_make_out assert_match %r{: No such file}, cmd_make_out
refute_path_exists @spec.gem_build_complete_path assert_path_not_exist @spec.gem_build_complete_path
assert_equal cwd, Dir.pwd assert_equal cwd, Dir.pwd
end end
@ -276,7 +276,7 @@ install:
assert_equal "No builder for extension ''\n", File.read(gem_make_out) assert_equal "No builder for extension ''\n", File.read(gem_make_out)
refute_path_exists @spec.gem_build_complete_path assert_path_not_exist @spec.gem_build_complete_path
ensure ensure
FileUtils.rm_f gem_make_out FileUtils.rm_f gem_make_out
end end
@ -311,7 +311,7 @@ install:
path = File.join @spec.gem_dir, "extconf_args" path = File.join @spec.gem_dir, "extconf_args"
assert_equal args.inspect, File.read(path).strip assert_equal args.inspect, File.read(path).strip
assert_path_exists @spec.extension_dir assert_path_exist @spec.extension_dir
end end
def test_initialize def test_initialize

View file

@ -114,7 +114,7 @@ class TestGemExtExtConfBuilder < Gem::TestCase
assert_match(File.join(@dest_path, 'mkmf.log'), output[4]) assert_match(File.join(@dest_path, 'mkmf.log'), output[4])
assert_includes(output, "To see why this extension failed to compile, please check the mkmf.log which can be found here:\n") assert_includes(output, "To see why this extension failed to compile, please check the mkmf.log which can be found here:\n")
assert_path_exists File.join @dest_path, 'mkmf.log' assert_path_exist File.join @dest_path, 'mkmf.log'
end end
def test_class_build_extconf_success_without_warning def test_class_build_extconf_success_without_warning
@ -134,7 +134,7 @@ class TestGemExtExtConfBuilder < Gem::TestCase
refute_includes(output, "To see why this extension failed to compile, please check the mkmf.log which can be found here:\n") refute_includes(output, "To see why this extension failed to compile, please check the mkmf.log which can be found here:\n")
assert_path_exists File.join @dest_path, 'mkmf.log' assert_path_exist File.join @dest_path, 'mkmf.log'
end end
def test_class_build_unconventional def test_class_build_unconventional

View file

@ -124,8 +124,8 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
@installer = Gem::Installer.at @gem, @cmd.options @installer = Gem::Installer.at @gem, @cmd.options
@installer.install @installer.install
assert_path_exists File.join(Gem.user_dir, 'gems') assert_path_exist File.join(Gem.user_dir, 'gems')
assert_path_exists File.join(Gem.user_dir, 'gems', @spec.full_name) assert_path_exist File.join(Gem.user_dir, 'gems', @spec.full_name)
end end
def test_user_install_disabled_read_only def test_user_install_disabled_read_only

View file

@ -76,7 +76,7 @@ end
installer.generate_bin installer.generate_bin
installed_exec = File.join util_inst_bindir, 'executable' installed_exec = File.join util_inst_bindir, 'executable'
assert_path_exists installed_exec assert_path_exist installed_exec
wrapper = File.read installed_exec wrapper = File.read installed_exec
assert_match %r{generated by RubyGems}, wrapper assert_match %r{generated by RubyGems}, wrapper
@ -134,7 +134,7 @@ gem 'other', version
installer.generate_bin # should not raise installer.generate_bin # should not raise
installed_exec = File.join util_inst_bindir, 'foo-executable-bar' 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 wrapper = File.read installed_exec
assert_match %r{generated by RubyGems}, wrapper assert_match %r{generated by RubyGems}, wrapper
@ -169,7 +169,7 @@ gem 'other', version
installer.generate_bin installer.generate_bin
installed_exec = File.join util_inst_bindir, 'executable' installed_exec = File.join util_inst_bindir, 'executable'
assert_path_exists installed_exec assert_path_exist installed_exec
wrapper = File.read installed_exec wrapper = File.read installed_exec
assert_match %r{generated by RubyGems}, wrapper assert_match %r{generated by RubyGems}, wrapper
@ -184,7 +184,7 @@ gem 'other', version
installer.generate_bin installer.generate_bin
installed_exec = File.join util_inst_bindir, 'executable' installed_exec = File.join util_inst_bindir, 'executable'
assert_path_exists installed_exec assert_path_exist installed_exec
wrapper = File.read installed_exec wrapper = File.read installed_exec
assert_match %r{generated by RubyGems}, wrapper assert_match %r{generated by RubyGems}, wrapper
@ -306,7 +306,7 @@ gem 'other', version
installer.extract_files installer.extract_files
assert_path_exists File.join @spec.gem_dir, 'bin/executable' assert_path_exist File.join @spec.gem_dir, 'bin/executable'
end end
def test_generate_bin_bindir def test_generate_bin_bindir
@ -329,7 +329,7 @@ gem 'other', version
assert_directory_exists util_inst_bindir assert_directory_exists util_inst_bindir
installed_exec = File.join(util_inst_bindir, 'executable') 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? assert_equal mask, File.stat(installed_exec).mode unless win_platform?
wrapper = File.read installed_exec wrapper = File.read installed_exec
@ -372,7 +372,7 @@ gem 'other', version
installer.generate_bin installer.generate_bin
assert_directory_exists util_inst_bindir assert_directory_exists util_inst_bindir
installed_exec = File.join util_inst_bindir, 'executable' 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? assert_equal mask, File.stat(installed_exec).mode unless win_platform?
wrapper = File.read installed_exec wrapper = File.read installed_exec
@ -391,7 +391,7 @@ gem 'other', version
installer.generate_bin installer.generate_bin
assert_directory_exists util_inst_bindir assert_directory_exists util_inst_bindir
installed_exec = File.join util_inst_bindir, 'foo-executable-bar' installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
assert_path_exists installed_exec assert_path_exist installed_exec
ensure ensure
Gem::Installer.exec_format = nil Gem::Installer.exec_format = nil
end end
@ -407,7 +407,7 @@ gem 'other', version
installer.generate_bin installer.generate_bin
assert_directory_exists util_inst_bindir assert_directory_exists util_inst_bindir
installed_exec = File.join util_inst_bindir, 'executable' installed_exec = File.join util_inst_bindir, 'executable'
assert_path_exists installed_exec assert_path_exist installed_exec
ensure ensure
Gem::Installer.exec_format = nil Gem::Installer.exec_format = nil
end end
@ -431,7 +431,7 @@ gem 'other', version
installer.generate_bin installer.generate_bin
installed_exec = File.join("#{@gemhome}2", "bin", 'executable') 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? assert_equal mask, File.stat(installed_exec).mode unless win_platform?
wrapper = File.read installed_exec wrapper = File.read installed_exec
@ -446,7 +446,7 @@ gem 'other', version
installer.wrappers = true installer.wrappers = true
installer.generate_bin 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 end
def test_generate_bin_script_no_perms def test_generate_bin_script_no_perms
@ -488,7 +488,7 @@ gem 'other', version
installer.generate_bin installer.generate_bin
installed_exec = File.join @gemhome, 'bin', 'executable' 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? assert_equal mask, File.stat(installed_exec).mode unless win_platform?
wrapper = File.read installed_exec wrapper = File.read installed_exec
@ -515,7 +515,7 @@ gem 'other', version
installer.generate_bin installer.generate_bin
assert_directory_exists util_inst_bindir 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_equal mask, File.stat(installed_exec).mode unless win_platform?
assert_match %r{generated by RubyGems}, File.read(installed_exec) assert_match %r{generated by RubyGems}, File.read(installed_exec)
@ -549,7 +549,7 @@ gem 'other', version
installer.wrappers = false installer.wrappers = false
installer.generate_bin installer.generate_bin
refute_path_exists util_inst_bindir assert_path_not_exist util_inst_bindir
end end
def test_generate_bin_symlink_no_perms def test_generate_bin_symlink_no_perms
@ -658,7 +658,7 @@ gem 'other', version
installer.generate_bin installer.generate_bin
installed_exec = File.join util_inst_bindir, 'executable' installed_exec = File.join util_inst_bindir, 'executable'
assert_path_exists installed_exec assert_path_exist installed_exec
@spec = Gem::Specification.new do |s| @spec = Gem::Specification.new do |s|
s.files = ['lib/code.rb'] s.files = ['lib/code.rb']
@ -701,7 +701,7 @@ gem 'other', version
assert_directory_exists util_inst_bindir assert_directory_exists util_inst_bindir
installed_exec = File.join(util_inst_bindir, 'executable') installed_exec = File.join(util_inst_bindir, 'executable')
assert_path_exists installed_exec assert_path_exist installed_exec
if symlink_supported? if symlink_supported?
assert File.symlink?(installed_exec) assert File.symlink?(installed_exec)
@ -946,22 +946,22 @@ gem 'other', version
spec_file = File.join @gemhome, 'specifications', @spec.spec_name spec_file = File.join @gemhome, 'specifications', @spec.spec_name
Gem.pre_install do Gem.pre_install do
refute_path_exists cache_file, 'cache file must not exist yet' assert_path_not_exist cache_file, 'cache file must not exist yet'
refute_path_exists spec_file, 'spec file must not exist yet' assert_path_not_exist spec_file, 'spec file must not exist yet'
true true
end end
Gem.post_build do Gem.post_build do
assert_path_exists gemdir, 'gem install dir must exist' assert_path_exist gemdir, 'gem install dir must exist'
assert_path_exists rakefile, 'gem executable must exist' assert_path_exist rakefile, 'gem executable must exist'
refute_path_exists stub_exe, 'gem executable must not exist' assert_path_not_exist stub_exe, 'gem executable must not exist'
refute_path_exists spec_file, 'spec file must not exist yet' assert_path_not_exist spec_file, 'spec file must not exist yet'
true true
end end
Gem.post_install do Gem.post_install do
assert_path_exists cache_file, 'cache file must exist' assert_path_exist cache_file, 'cache file must exist'
assert_path_exists spec_file, 'spec file must exist' assert_path_exist spec_file, 'spec file must exist'
end end
@newspec = nil @newspec = nil
@ -972,21 +972,21 @@ gem 'other', version
end end
assert_equal @spec, @newspec assert_equal @spec, @newspec
assert_path_exists gemdir assert_path_exist gemdir
assert_path_exists stub_exe, 'gem executable must exist' assert_path_exist stub_exe, 'gem executable must exist'
exe = File.join gemdir, 'bin', 'executable' exe = File.join gemdir, 'bin', 'executable'
assert_path_exists exe assert_path_exist exe
exe_mode = File.stat(exe).mode & 0111 exe_mode = File.stat(exe).mode & 0111
assert_equal 0111, exe_mode, "0%o" % exe_mode unless win_platform? 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_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_build_hook_arg
assert_same installer, @post_install_hook_arg assert_same installer, @post_install_hook_arg
@ -1100,7 +1100,7 @@ gem 'other', version
exe = File.join @gemhome, 'bin', 'executable' 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| installer = util_setup_installer do |spec|
spec.name = 'default' spec.name = 'default'
@ -1165,7 +1165,7 @@ gem 'other', version
end end
gemdir = File.join(@gemhome, 'gems', @spec.full_name) 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 installer = util_setup_installer
@ -1188,8 +1188,8 @@ gem 'other', version
end end
end end
assert_path_exists File.join gemdir, 'lib', 'other.rb' assert_path_exist File.join gemdir, 'lib', 'other.rb'
refute_path_exists File.join gemdir, 'lib', 'code.rb', assert_path_not_exist File.join gemdir, 'lib', 'code.rb',
"code.rb from prior install of same gem shouldn't remain here" "code.rb from prior install of same gem shouldn't remain here"
end end
@ -1204,7 +1204,7 @@ gem 'other', version
end end
gem_dir = File.join(@gemhome, 'gems', 'missing_dep-1') gem_dir = File.join(@gemhome, 'gems', 'missing_dep-1')
assert_path_exists gem_dir assert_path_exist gem_dir
end end
def test_install_build_root 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, 'doc')
assert_directory_exists File.join(Gem.dir, 'specifications') assert_directory_exists File.join(Gem.dir, 'specifications')
assert_path_exists File.join @gemhome, 'cache', @spec.file_name assert_path_exist File.join @gemhome, 'cache', @spec.file_name
assert_path_exists File.join @gemhome, 'specifications', @spec.spec_name assert_path_exist File.join @gemhome, 'specifications', @spec.spec_name
end end
def test_install_post_build_false def test_install_post_build_false
@ -1253,10 +1253,10 @@ gem 'other', version
end end
spec_file = File.join @gemhome, 'specifications', @spec.spec_name 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 gem_dir = File.join @gemhome, 'gems', @spec.full_name
refute_path_exists gem_dir assert_path_not_exist gem_dir
end end
def test_install_post_build_nil def test_install_post_build_nil
@ -1271,10 +1271,10 @@ gem 'other', version
end end
spec_file = File.join @gemhome, 'specifications', @spec.spec_name 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 gem_dir = File.join @gemhome, 'gems', @spec.full_name
assert_path_exists gem_dir assert_path_exist gem_dir
end end
def test_install_pre_install_false def test_install_pre_install_false
@ -1295,7 +1295,7 @@ gem 'other', version
end end
spec_file = File.join @gemhome, 'specifications', @spec.spec_name spec_file = File.join @gemhome, 'specifications', @spec.spec_name
refute_path_exists spec_file assert_path_not_exist spec_file
end end
def test_install_pre_install_nil def test_install_pre_install_nil
@ -1310,7 +1310,7 @@ gem 'other', version
end end
spec_file = File.join @gemhome, 'specifications', @spec.spec_name spec_file = File.join @gemhome, 'specifications', @spec.spec_name
assert_path_exists spec_file assert_path_exist spec_file
end end
def test_install_with_message def test_install_with_message
@ -1364,7 +1364,7 @@ gem 'other', version
expected_makefile = File.join gemhome2, 'gems', @spec.full_name, 'Makefile' expected_makefile = File.join gemhome2, 'gems', @spec.full_name, 'Makefile'
assert_path_exists expected_makefile assert_path_exist expected_makefile
end end
def test_install_extension_dir_is_removed_on_reinstall def test_install_extension_dir_is_removed_on_reinstall
@ -1393,7 +1393,7 @@ gem 'other', version
write_file should_be_removed do |io| write_file should_be_removed do |io|
io.write "DELETE ME ON REINSTALL" io.write "DELETE ME ON REINSTALL"
end end
assert_path_exists should_be_removed assert_path_exist should_be_removed
# reinstall the gem, this is also the same as pristine # reinstall the gem, this is also the same as pristine
use_ui @ui do use_ui @ui do
@ -1401,7 +1401,7 @@ gem 'other', version
installer.install installer.install
end end
refute_path_exists should_be_removed assert_path_not_exist should_be_removed
end end
def test_install_user_extension_dir 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' expected_makefile = File.join Gem.user_dir, 'gems', @spec.full_name, 'Makefile'
assert_path_exists expected_makefile assert_path_exist expected_makefile
assert_path_exists expected_extension_dir assert_path_exist expected_extension_dir
refute_path_exists File.join expected_extension_dir, 'gem_make.out' assert_path_not_exist File.join expected_extension_dir, 'gem_make.out'
end end
def test_find_lib_file_after_install def test_find_lib_file_after_install
@ -1510,16 +1510,16 @@ gem 'other', version
RUBY RUBY
end end
refute_path_exists File.join @spec.gem_dir, rb assert_path_not_exist File.join @spec.gem_dir, rb
refute_path_exists File.join @spec.gem_dir, rb2 assert_path_not_exist File.join @spec.gem_dir, rb2
use_ui @ui do use_ui @ui do
path = Gem::Package.build @spec path = Gem::Package.build @spec
installer = Gem::Installer.at path installer = Gem::Installer.at path
installer.install installer.install
end end
assert_path_exists File.join @spec.gem_dir, rb assert_path_exist File.join @spec.gem_dir, rb
assert_path_exists File.join @spec.gem_dir, rb2 assert_path_exist File.join @spec.gem_dir, rb2
end end
def test_install_extension_flat def test_install_extension_flat
@ -1548,14 +1548,14 @@ gem 'other', version
end end
so = File.join(@spec.gem_dir, "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}") so = File.join(@spec.gem_dir, "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}")
refute_path_exists so assert_path_not_exist so
use_ui @ui do use_ui @ui do
path = Gem::Package.build @spec path = Gem::Package.build @spec
installer = Gem::Installer.at path installer = Gem::Installer.at path
installer.install installer.install
end end
assert_path_exists so assert_path_exist so
rescue rescue
puts '-' * 78 puts '-' * 78
puts File.read File.join(@gemhome, 'gems', 'a-2', 'Makefile') puts File.read File.join(@gemhome, 'gems', 'a-2', 'Makefile')
@ -1992,14 +1992,14 @@ gem 'other', version
installer.unpack dest installer.unpack dest
end end
assert_path_exists File.join dest, 'lib', 'code.rb' assert_path_exist File.join dest, 'lib', 'code.rb'
assert_path_exists File.join dest, 'bin', 'executable' assert_path_exist File.join dest, 'bin', 'executable'
end end
def test_write_build_info_file def test_write_build_info_file
installer = setup_base_installer installer = setup_base_installer
refute_path_exists @spec.build_info_file assert_path_not_exist @spec.build_info_file
installer.build_args = %w[ installer.build_args = %w[
--with-libyaml-dir /usr/local/Cellar/libyaml/0.1.4 --with-libyaml-dir /usr/local/Cellar/libyaml/0.1.4
@ -2007,7 +2007,7 @@ gem 'other', version
installer.write_build_info_file 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" 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 def test_write_build_info_file_empty
installer = setup_base_installer installer = setup_base_installer
refute_path_exists @spec.build_info_file assert_path_not_exist @spec.build_info_file
installer.write_build_info_file installer.write_build_info_file
refute_path_exists @spec.build_info_file assert_path_not_exist @spec.build_info_file
end end
def test_write_build_info_file_install_dir def test_write_build_info_file_install_dir
@ -2034,8 +2034,8 @@ gem 'other', version
installer.write_build_info_file installer.write_build_info_file
refute_path_exists @spec.build_info_file assert_path_not_exist @spec.build_info_file
assert_path_exists \ assert_path_exist \
File.join("#{@gemhome}2", 'build_info', "#{@spec.full_name}.info") File.join("#{@gemhome}2", 'build_info', "#{@spec.full_name}.info")
end end
@ -2045,27 +2045,27 @@ gem 'other', version
gem = File.join @gemhome, @spec.file_name gem = File.join @gemhome, @spec.file_name
FileUtils.mv cache_file, gem FileUtils.mv cache_file, gem
refute_path_exists cache_file assert_path_not_exist cache_file
installer = Gem::Installer.at gem installer = Gem::Installer.at gem
installer.gem_home = @gemhome installer.gem_home = @gemhome
installer.write_cache_file installer.write_cache_file
assert_path_exists cache_file assert_path_exist cache_file
end end
def test_write_spec def test_write_spec
@spec = setup_base_spec @spec = setup_base_spec
FileUtils.rm @spec.spec_file 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::Installer.for_spec @spec
installer.gem_home = @gemhome installer.gem_home = @gemhome
installer.write_spec installer.write_spec
assert_path_exists @spec.spec_file assert_path_exist @spec.spec_file
loaded = Gem::Specification.load @spec.spec_file loaded = Gem::Specification.load @spec.spec_file
@ -2077,7 +2077,7 @@ gem 'other', version
def test_write_spec_writes_cached_spec def test_write_spec_writes_cached_spec
@spec = setup_base_spec @spec = setup_base_spec
FileUtils.rm @spec.spec_file 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] @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') assert_directory_exists File.join(@spec.gem_dir, 'bin')
installed_exec = File.join @spec.gem_dir, 'bin', 'executable' 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')
assert_directory_exists File.join(Gem.default_dir, 'specifications', 'default') assert_directory_exists File.join(Gem.default_dir, 'specifications', 'default')
@ -2132,7 +2132,7 @@ gem 'other', version
assert_directory_exists util_inst_bindir assert_directory_exists util_inst_bindir
installed_exec = File.join util_inst_bindir, 'executable' installed_exec = File.join util_inst_bindir, 'executable'
assert_path_exists installed_exec assert_path_exist installed_exec
wrapper = File.read installed_exec wrapper = File.read installed_exec
@ -2158,7 +2158,7 @@ gem 'other', version
assert_directory_exists util_inst_bindir assert_directory_exists util_inst_bindir
installed_exec = File.join util_inst_bindir, 'executable' installed_exec = File.join util_inst_bindir, 'executable'
assert_path_exists installed_exec assert_path_exist installed_exec
wrapper = File.read installed_exec wrapper = File.read installed_exec
assert_match %r{generated by RubyGems}, wrapper assert_match %r{generated by RubyGems}, wrapper
@ -2184,7 +2184,7 @@ gem 'other', version
assert_directory_exists File.join(@spec.gem_dir, 'exe') assert_directory_exists File.join(@spec.gem_dir, 'exe')
installed_exec = File.join @spec.gem_dir, 'exe', 'executable' 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')
assert_directory_exists File.join(Gem.default_dir, 'specifications', 'default') assert_directory_exists File.join(Gem.default_dir, 'specifications', 'default')

View file

@ -240,7 +240,7 @@ class TestGemPackage < Gem::Package::TarTestCase
package.build package.build
assert_equal Gem::VERSION, spec.rubygems_version assert_equal Gem::VERSION, spec.rubygems_version
assert_path_exists spec.file_name assert_path_exist spec.file_name
reader = Gem::Package.new spec.file_name reader = Gem::Package.new spec.file_name
assert_equal spec, reader.spec assert_equal spec, reader.spec
@ -279,7 +279,7 @@ class TestGemPackage < Gem::Package::TarTestCase
package.build package.build
assert_equal Gem::VERSION, spec.rubygems_version assert_equal Gem::VERSION, spec.rubygems_version
assert_path_exists spec.file_name assert_path_exist spec.file_name
reader = Gem::Package.new spec.file_name reader = Gem::Package.new spec.file_name
assert reader.verify assert reader.verify
@ -322,7 +322,7 @@ class TestGemPackage < Gem::Package::TarTestCase
package.build package.build
assert_equal Gem::VERSION, spec.rubygems_version assert_equal Gem::VERSION, spec.rubygems_version
assert_path_exists spec.file_name assert_path_exist spec.file_name
reader = Gem::Package.new spec.file_name reader = Gem::Package.new spec.file_name
assert reader.verify assert reader.verify
@ -385,7 +385,7 @@ class TestGemPackage < Gem::Package::TarTestCase
package.build package.build
assert_equal Gem::VERSION, spec.rubygems_version assert_equal Gem::VERSION, spec.rubygems_version
assert_path_exists spec.file_name assert_path_exist spec.file_name
reader = Gem::Package.new spec.file_name reader = Gem::Package.new spec.file_name
assert reader.verify assert reader.verify
@ -422,7 +422,7 @@ class TestGemPackage < Gem::Package::TarTestCase
package.build package.build
assert_equal Gem::VERSION, spec.rubygems_version assert_equal Gem::VERSION, spec.rubygems_version
assert_path_exists spec.file_name assert_path_exist spec.file_name
reader = Gem::Package.new spec.file_name reader = Gem::Package.new spec.file_name
assert reader.verify assert reader.verify
@ -476,7 +476,7 @@ class TestGemPackage < Gem::Package::TarTestCase
package.extract_files @destination package.extract_files @destination
extracted = File.join @destination, 'lib/code.rb' extracted = File.join @destination, 'lib/code.rb'
assert_path_exists extracted assert_path_exist extracted
mask = 0100666 & (~File.umask) mask = 0100666 & (~File.umask)
@ -507,7 +507,7 @@ class TestGemPackage < Gem::Package::TarTestCase
package.extract_files @destination package.extract_files @destination
assert_path_exists @destination assert_path_exist @destination
end end
def test_extract_tar_gz_absolute def test_extract_tar_gz_absolute
@ -550,7 +550,7 @@ class TestGemPackage < Gem::Package::TarTestCase
end end
extracted = File.join @destination, 'lib/foo.rb' extracted = File.join @destination, 'lib/foo.rb'
assert_path_exists extracted assert_path_exist extracted
assert_equal '../relative.rb', assert_equal '../relative.rb',
File.readlink(extracted) File.readlink(extracted)
assert_equal 'hi', assert_equal 'hi',
@ -612,7 +612,7 @@ class TestGemPackage < Gem::Package::TarTestCase
package.extract_tar_gz tgz_io, destination_subdir package.extract_tar_gz tgz_io, destination_subdir
end end
assert_path_exists destination_user_subdir assert_path_exist destination_user_subdir
if Gem::Package::PathError === e if Gem::Package::PathError === e
assert_equal("installing into parent path #{destination_user_subdir} of " + assert_equal("installing into parent path #{destination_user_subdir} of " +
@ -638,10 +638,10 @@ class TestGemPackage < Gem::Package::TarTestCase
package.extract_tar_gz tgz_io, @destination package.extract_tar_gz tgz_io, @destination
extracted = File.join @destination, 'lib/foo.rb' extracted = File.join @destination, 'lib/foo.rb'
assert_path_exists extracted assert_path_exist extracted
extracted = File.join @destination, 'lib/foo' extracted = File.join @destination, 'lib/foo'
assert_path_exists extracted assert_path_exist extracted
end end
def test_extract_tar_gz_dot_slash def test_extract_tar_gz_dot_slash
@ -656,7 +656,7 @@ class TestGemPackage < Gem::Package::TarTestCase
package.extract_tar_gz tgz_io, @destination package.extract_tar_gz tgz_io, @destination
extracted = File.join @destination, 'dot_slash.rb' extracted = File.join @destination, 'dot_slash.rb'
assert_path_exists extracted assert_path_exist extracted
end end
def test_extract_tar_gz_dot_file def test_extract_tar_gz_dot_file
@ -671,7 +671,7 @@ class TestGemPackage < Gem::Package::TarTestCase
package.extract_tar_gz tgz_io, @destination package.extract_tar_gz tgz_io, @destination
extracted = File.join @destination, '.dot_file.rb' extracted = File.join @destination, '.dot_file.rb'
assert_path_exists extracted assert_path_exist extracted
end end
if Gem.win_platform? if Gem.win_platform?
@ -687,7 +687,7 @@ class TestGemPackage < Gem::Package::TarTestCase
package.extract_tar_gz tgz_io, @destination.upcase package.extract_tar_gz tgz_io, @destination.upcase
extracted = File.join @destination, 'foo/file.rb' extracted = File.join @destination, 'foo/file.rb'
assert_path_exists extracted assert_path_exist extracted
end end
end end

View file

@ -36,7 +36,7 @@ unless Gem.java_platform? # jruby can't require the simple_gem file
@package.extract_files @destination @package.extract_files @destination
extracted = File.join @destination, 'lib/foo.rb' extracted = File.join @destination, 'lib/foo.rb'
assert_path_exists extracted assert_path_exist extracted
mask = 0100644 & (~File.umask) mask = 0100644 & (~File.umask)

View file

@ -40,7 +40,7 @@ class TestGemPackageTask < Gem::TestCase
Rake.application['package'].invoke Rake.application['package'].invoke
assert_path_exists 'pkg/pkgr-1.2.3.gem' assert_path_exist 'pkg/pkgr-1.2.3.gem'
end end
ensure ensure
RakeFileUtils.verbose_flag = original_rake_fileutils_verbosity RakeFileUtils.verbose_flag = original_rake_fileutils_verbosity

View file

@ -84,7 +84,7 @@ class TestGemRDoc < Gem::TestCase
refute @hook.rdoc_installed? refute @hook.rdoc_installed?
refute @hook.ri_installed? refute @hook.ri_installed?
assert_path_exists @a.doc_dir assert_path_exist @a.doc_dir
end end
def test_remove_unwritable def test_remove_unwritable
@ -113,7 +113,7 @@ class TestGemRDoc < Gem::TestCase
def test_setup def test_setup
@hook.setup @hook.setup
assert_path_exists @a.doc_dir assert_path_exist @a.doc_dir
end end
def test_setup_unwritable def test_setup_unwritable

View file

@ -184,7 +184,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
assert_equal 'hello', data assert_equal 'hello', data
refute_path_exists path assert_path_not_exist path
end end
def util_fuck_with_fetcher(data, blow = false) def util_fuck_with_fetcher(data, blow = false)

View file

@ -64,8 +64,8 @@ class TestGemRequestSet < Gem::TestCase
end end
assert_includes installed, 'a-2' assert_includes installed, 'a-2'
assert_path_exists File.join @gemhome, 'gems', 'a-2' assert_path_exist File.join @gemhome, 'gems', 'a-2'
assert_path_exists 'gem.deps.rb.lock' assert_path_exist 'gem.deps.rb.lock'
assert rs.remote assert rs.remote
refute done_installing_ran refute done_installing_ran
@ -100,7 +100,7 @@ Gems to install:
end end
util_clear_gems util_clear_gems
refute_path_exists File.join Gem.dir, 'gems', 'a-2' assert_path_not_exist File.join Gem.dir, 'gems', 'a-2'
rs = Gem::RequestSet.new rs = Gem::RequestSet.new
installed = [] installed = []
@ -119,7 +119,7 @@ Gems to install:
end end
assert_includes installed, 'a-2' assert_includes installed, 'a-2'
refute_path_exists File.join Gem.dir, 'gems', 'a-2' assert_path_not_exist File.join Gem.dir, 'gems', 'a-2'
end end
def test_install_from_gemdeps_local def test_install_from_gemdeps_local
@ -179,8 +179,8 @@ DEPENDENCIES
assert_includes installed, 'b-1' assert_includes installed, 'b-1'
assert_includes installed, 'a-1' assert_includes installed, 'a-1'
assert_path_exists File.join @gemhome, 'specifications', 'a-1.gemspec' assert_path_exist File.join @gemhome, 'specifications', 'a-1.gemspec'
assert_path_exists File.join @gemhome, 'specifications', 'b-1.gemspec' assert_path_exist File.join @gemhome, 'specifications', 'b-1.gemspec'
end end
def test_install_from_gemdeps_complex_dependencies def test_install_from_gemdeps_complex_dependencies
@ -232,7 +232,7 @@ end
assert_includes installed, 'z-1.0.3' assert_includes installed, 'z-1.0.3'
assert_path_exists File.join @gemhome, 'specifications', 'z-1.0.3.gemspec' assert_path_exist File.join @gemhome, 'specifications', 'z-1.0.3.gemspec'
end end
def test_install_from_gemdeps_version_mismatch def test_install_from_gemdeps_version_mismatch
@ -525,8 +525,8 @@ ruby "0"
assert_equal %w[b-1 a-1], assert_equal %w[b-1 a-1],
installers.map {|installer| installer.spec.full_name } installers.map {|installer| installer.spec.full_name }
assert_path_exists File.join @gemhome, 'specifications', 'a-1.gemspec' assert_path_exist File.join @gemhome, 'specifications', 'a-1.gemspec'
assert_path_exists File.join @gemhome, 'specifications', 'b-1.gemspec' assert_path_exist File.join @gemhome, 'specifications', 'b-1.gemspec'
assert_equal %w[b-1 a-1], installed.map {|s| s.full_name } assert_equal %w[b-1 a-1], installed.map {|s| s.full_name }
@ -548,8 +548,8 @@ ruby "0"
assert_equal @tempdir, ENV['GEM_HOME'] assert_equal @tempdir, ENV['GEM_HOME']
end end
assert_path_exists File.join @tempdir, 'specifications', 'a-1.gemspec' assert_path_exist File.join @tempdir, 'specifications', 'a-1.gemspec'
assert_path_exists File.join @tempdir, 'specifications', 'b-1.gemspec' assert_path_exist File.join @tempdir, 'specifications', 'b-1.gemspec'
assert_equal %w[b-1 a-1], installed.map {|s| s.full_name } assert_equal %w[b-1 a-1], installed.map {|s| s.full_name }
end end

View file

@ -443,7 +443,7 @@ DEPENDENCIES
gem_deps_lock_file = "#{@gem_deps_file}.lock" gem_deps_lock_file = "#{@gem_deps_file}.lock"
assert_path_exists gem_deps_lock_file assert_path_exist gem_deps_lock_file
refute_empty File.read gem_deps_lock_file refute_empty File.read gem_deps_lock_file
end end
@ -461,7 +461,7 @@ DEPENDENCIES
lockfile.write lockfile.write
end end
assert_path_exists gem_deps_lock_file assert_path_exist gem_deps_lock_file
assert_equal 'hello', File.read(gem_deps_lock_file) assert_equal 'hello', File.read(gem_deps_lock_file)
end end

View file

@ -51,7 +51,7 @@ class TestGemResolverGitSet < Gem::TestCase
assert @set.need_submodules[repository] assert @set.need_submodules[repository]
refute_path_exists spec.source.repo_cache_dir assert_path_not_exist spec.source.repo_cache_dir
end end
def test_find_all def test_find_all

View file

@ -92,7 +92,7 @@ class TestGemResolverGitSpecification < Gem::TestCase
git_spec.install({}) git_spec.install({})
assert_path_exists File.join git_spec.spec.extension_dir, 'b.rb' assert_path_exist File.join git_spec.spec.extension_dir, 'b.rb'
end end
def test_install_installed def test_install_installed

View file

@ -46,7 +46,7 @@ class TestGemResolverIndexSpecification < Gem::TestCase
called = installer called = installer
end end
assert_path_exists File.join @gemhome, 'specifications', 'a-2.gemspec' assert_path_exist File.join @gemhome, 'specifications', 'a-2.gemspec'
assert_kind_of Gem::Installer, called assert_kind_of Gem::Installer, called
end end

View file

@ -24,7 +24,7 @@ class TestGemResolverLocalSpecification < Gem::TestCase
called = installer called = installer
end end
assert_path_exists File.join @gemhome, 'specifications', 'a-2.gemspec' assert_path_exist File.join @gemhome, 'specifications', 'a-2.gemspec'
assert_kind_of Gem::Installer, called assert_kind_of Gem::Installer, called
end end

View file

@ -26,7 +26,7 @@ class TestGemResolverSpecification < Gem::TestCase
a_spec.install :install_dir => gemhome a_spec.install :install_dir => gemhome
assert_path_exists File.join gemhome, 'gems', a.full_name assert_path_exist File.join gemhome, 'gems', a.full_name
expected = File.join gemhome, 'specifications', a.spec_name expected = File.join gemhome, 'specifications', a.spec_name

View file

@ -265,7 +265,7 @@ class TestGemSecurity < Gem::TestCase
@SEC.write key, path @SEC.write key, path
assert_path_exists path assert_path_exist path
key_from_file = File.read path key_from_file = File.read path
@ -281,7 +281,7 @@ class TestGemSecurity < Gem::TestCase
@SEC.write key, path, 0600, passphrase @SEC.write key, path, 0600, passphrase
assert_path_exists path assert_path_exist path
key_from_file = OpenSSL::PKey::RSA.new File.read(path), passphrase key_from_file = OpenSSL::PKey::RSA.new File.read(path), passphrase
@ -299,7 +299,7 @@ class TestGemSecurity < Gem::TestCase
@SEC.write key, path, 0600, passphrase, cipher @SEC.write key, path, 0600, passphrase, cipher
assert_path_exists path assert_path_exist path
key_file_contents = File.read(path) key_file_contents = File.read(path)

View file

@ -165,7 +165,7 @@ toqvglr0kdbknSRRjBVLK6tsgr07aLT9gNP7mTW2PA==
expired_path = expired_path =
File.join Gem.user_home, '.gem', "gem-public_cert.pem.expired.#{expiry}" File.join Gem.user_home, '.gem', "gem-public_cert.pem.expired.#{expiry}"
assert_path_exists expired_path assert_path_exist expired_path
assert_equal EXPIRED_CERT.to_pem, File.read(expired_path) assert_equal EXPIRED_CERT.to_pem, File.read(expired_path)
end end

View file

@ -53,7 +53,7 @@ class TestGemSecurityTrustDir < Gem::TestCase
trusted = @trust_dir.cert_path PUBLIC_CERT trusted = @trust_dir.cert_path PUBLIC_CERT
assert_path_exists trusted assert_path_exist trusted
mask = 0100600 & (~File.umask) mask = 0100600 & (~File.umask)
@ -63,11 +63,11 @@ class TestGemSecurityTrustDir < Gem::TestCase
end end
def test_verify def test_verify
refute_path_exists @dest_dir assert_path_not_exist @dest_dir
@trust_dir.verify @trust_dir.verify
assert_path_exists @dest_dir assert_path_exist @dest_dir
mask = 040700 & (~File.umask) mask = 040700 & (~File.umask)
mask |= 0200000 if /aix/ =~ RUBY_PLATFORM mask |= 0200000 if /aix/ =~ RUBY_PLATFORM

View file

@ -24,7 +24,7 @@ class TestGemSourceGit < Gem::TestCase
def test_checkout def test_checkout
@source.checkout @source.checkout
assert_path_exists File.join @source.install_dir, 'a.gemspec' assert_path_exist File.join @source.install_dir, 'a.gemspec'
end end
def test_checkout_master def test_checkout_master
@ -39,7 +39,7 @@ class TestGemSourceGit < Gem::TestCase
@source.checkout @source.checkout
assert_path_exists File.join @source.install_dir, 'b.gemspec' assert_path_exist File.join @source.install_dir, 'b.gemspec'
end end
def test_checkout_local def test_checkout_local
@ -49,7 +49,7 @@ class TestGemSourceGit < Gem::TestCase
install_dir = File.join Gem.dir, 'bundler', 'gems', "a-#{@head[0..11]}" install_dir = File.join Gem.dir, 'bundler', 'gems', "a-#{@head[0..11]}"
refute_path_exists File.join install_dir, 'a.gemspec' assert_path_not_exist File.join install_dir, 'a.gemspec'
end end
def test_checkout_local_cached def test_checkout_local_cached
@ -59,7 +59,7 @@ class TestGemSourceGit < Gem::TestCase
@source.checkout @source.checkout
assert_path_exists File.join @source.install_dir, 'a.gemspec' assert_path_exist File.join @source.install_dir, 'a.gemspec'
end end
def test_checkout_submodules def test_checkout_submodules
@ -76,14 +76,14 @@ class TestGemSourceGit < Gem::TestCase
source.checkout source.checkout
assert_path_exists File.join source.install_dir, 'a.gemspec' assert_path_exist File.join source.install_dir, 'a.gemspec'
assert_path_exists File.join source.install_dir, 'b/b.gemspec' assert_path_exist File.join source.install_dir, 'b/b.gemspec'
end end
def test_cache def test_cache
assert @source.cache assert @source.cache
assert_path_exists @source.repo_cache_dir assert_path_exist @source.repo_cache_dir
Dir.chdir @source.repo_cache_dir do Dir.chdir @source.repo_cache_dir do
assert_equal @head, Gem::Util.popen(@git, 'rev-parse', 'master').strip assert_equal @head, Gem::Util.popen(@git, 'rev-parse', 'master').strip
@ -95,7 +95,7 @@ class TestGemSourceGit < Gem::TestCase
@source.cache @source.cache
refute_path_exists @source.repo_cache_dir assert_path_not_exist @source.repo_cache_dir
end end
def test_dir_shortref def test_dir_shortref

View file

@ -1473,7 +1473,7 @@ dependencies: []
skip "extensions don't quite work on jruby" if Gem.java_platform? skip "extensions don't quite work on jruby" if Gem.java_platform?
ext_spec ext_spec
refute_path_exists @ext.extension_dir, 'sanity check' assert_path_not_exist @ext.extension_dir, 'sanity check'
refute_empty @ext.extensions, 'sanity check' refute_empty @ext.extensions, 'sanity check'
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
@ -1491,7 +1491,7 @@ dependencies: []
@ext.build_extensions @ext.build_extensions
assert_path_exists @ext.extension_dir assert_path_exist @ext.extension_dir
end end
def test_default_spec_stub_is_marked_default def test_default_spec_stub_is_marked_default
@ -1520,7 +1520,7 @@ dependencies: []
@ext.build_extensions @ext.build_extensions
gem_make_out = File.join @ext.extension_dir, 'gem_make.out' gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
refute_path_exists gem_make_out assert_path_not_exist gem_make_out
end end
def test_build_extensions_default_gem def test_build_extensions_default_gem
@ -1541,7 +1541,7 @@ dependencies: []
spec.build_extensions spec.build_extensions
refute_path_exists spec.extension_dir assert_path_not_exist spec.extension_dir
end end
def test_build_extensions_error def test_build_extensions_error
@ -1582,7 +1582,7 @@ dependencies: []
FileUtils.chmod 0555, File.join(@ext.base_dir, 'extensions') FileUtils.chmod 0555, File.join(@ext.base_dir, 'extensions')
@ext.build_extensions @ext.build_extensions
refute_path_exists @ext.extension_dir assert_path_not_exist @ext.extension_dir
ensure ensure
unless ($DEBUG or win_platform? or Process.uid.zero? or Gem.java_platform?) unless ($DEBUG or win_platform? or Process.uid.zero? or Gem.java_platform?)
FileUtils.chmod 0755, File.join(@ext.base_dir, 'extensions') FileUtils.chmod 0755, File.join(@ext.base_dir, 'extensions')
@ -1616,18 +1616,18 @@ dependencies: []
@ext.build_extensions @ext.build_extensions
gem_make_out = File.join @ext.extension_dir, 'gem_make.out' gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
refute_path_exists gem_make_out assert_path_not_exist gem_make_out
ensure ensure
FileUtils.chmod 0755, @gemhome FileUtils.chmod 0755, @gemhome
end end
def test_build_extensions_none def test_build_extensions_none
refute_path_exists @a1.extension_dir, 'sanity check' assert_path_not_exist @a1.extension_dir, 'sanity check'
assert_empty @a1.extensions, 'sanity check' assert_empty @a1.extensions, 'sanity check'
@a1.build_extensions @a1.build_extensions
refute_path_exists @a1.extension_dir assert_path_not_exist @a1.extension_dir
end end
def test_build_extensions_preview def test_build_extensions_preview
@ -1654,7 +1654,7 @@ dependencies: []
@ext.build_extensions @ext.build_extensions
gem_make_out = File.join @ext.extension_dir, 'gem_make.out' gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
assert_path_exists gem_make_out assert_path_exist gem_make_out
end end
def test_contains_requirable_file_eh def test_contains_requirable_file_eh

View file

@ -54,7 +54,7 @@ class TestGemUninstaller < Gem::InstallerTestCase
uninstaller.remove_all [@spec] uninstaller.remove_all [@spec]
end end
refute_path_exists @spec.gem_dir assert_path_not_exist @spec.gem_dir
end end
def test_remove_executables_force_keep def test_remove_executables_force_keep
@ -149,7 +149,7 @@ class TestGemUninstaller < Gem::InstallerTestCase
assert_equal expected, e.message assert_equal expected, e.message
assert_path_exists @spec.gem_dir assert_path_exist @spec.gem_dir
end end
def test_remove_symlinked_gem_home def test_remove_symlinked_gem_home
@ -166,7 +166,7 @@ class TestGemUninstaller < Gem::InstallerTestCase
uninstaller.remove @spec uninstaller.remove @spec
end end
refute_path_exists @spec.gem_dir assert_path_not_exist @spec.gem_dir
end end
end end
@ -297,7 +297,7 @@ class TestGemUninstaller < Gem::InstallerTestCase
uninstaller.uninstall uninstaller.uninstall
refute_path_exists spec.gem_dir assert_path_not_exist spec.gem_dir
end end
def test_uninstall_extension def test_uninstall_extension
@ -318,12 +318,12 @@ create_makefile '#{@spec.name}'
installer.install installer.install
end end
assert_path_exists @spec.extension_dir, 'sanity check' 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 uninstaller.uninstall
refute_path_exists @spec.extension_dir assert_path_not_exist @spec.extension_dir
end end
def test_uninstall_nonexistent def test_uninstall_nonexistent
@ -371,16 +371,16 @@ create_makefile '#{@spec.name}'
gem_dir = File.join @user_spec.gem_dir gem_dir = File.join @user_spec.gem_dir
Gem.pre_uninstall do Gem.pre_uninstall do
assert_path_exists gem_dir assert_path_exist gem_dir
end end
Gem.post_uninstall do Gem.post_uninstall do
refute_path_exists gem_dir assert_path_not_exist gem_dir
end end
uninstaller.uninstall uninstaller.uninstall
refute_path_exists gem_dir assert_path_not_exist gem_dir
assert_same uninstaller, @pre_uninstall_hook_arg assert_same uninstaller, @pre_uninstall_hook_arg
assert_same uninstaller, @post_uninstall_hook_arg assert_same uninstaller, @post_uninstall_hook_arg

View file

@ -753,12 +753,12 @@ class TestGemRequire < Gem::TestCase
spec.files += ["extconf.rb", "depend", "#{name}.c"] spec.files += ["extconf.rb", "depend", "#{name}.c"]
so = File.join(spec.gem_dir, "#{name}.#{RbConfig::CONFIG["DLEXT"]}") so = File.join(spec.gem_dir, "#{name}.#{RbConfig::CONFIG["DLEXT"]}")
refute_path_exists so assert_path_not_exist so
path = Gem::Package.build spec path = Gem::Package.build spec
installer = Gem::Installer.at path installer = Gem::Installer.at path
installer.install installer.install
assert_path_exists so assert_path_exist so
spec.gem_dir spec.gem_dir
end end