summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2024-08-16 20:19:22 +0900
committergit <svn-admin@ruby-lang.org>2024-09-06 14:46:43 +0000
commit30176e3f238f198ae835bf1c593d2ad2dce2df49 (patch)
tree793332c61026fdbd0732daac253175c380b3a576 /test
parent6dd917bd01f204e76d65137f2218d6305652f179 (diff)
[rubygems/rubygems] Ensure that the lock file will be removed
https://github.com/rubygems/rubygems/commit/2706acb271
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/test_gem_installer.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 2f4ff7349d..b83a01c73b 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -1234,6 +1234,34 @@ end
assert_path_not_exist(File.join(installer.bin_dir, "executable.lock"))
end
+ def test_install_does_not_leave_lockfile_for_binstub
+ installer = util_setup_installer
+
+ installer.wrappers = true
+
+ File.class_eval do
+ alias_method :original_chmod, :chmod
+ define_method(:chmod) do |mode|
+ original_chmod(mode)
+ raise Gem::Ext::BuildError if path.end_with?("/executable")
+ end
+ end
+
+ assert_raise(Gem::Ext::BuildError) do
+ installer.install
+ end
+
+ assert_path_not_exist(File.join(installer.bin_dir, "executable.lock"))
+ # TODO: remove already copied files at failures.
+ # assert_path_not_exist(File.join(installer.bin_dir, "executable"))
+ ensure
+ File.class_eval do
+ remove_method :chmod
+ alias_method :chmod, :original_chmod
+ remove_method :original_chmod
+ end
+ end
+
def test_install_with_no_prior_files
installer = util_setup_installer