Skip to content

Commit fd318f7

Browse files
committed
Fix remaining JRuby + Windows rubygems test failures
assert_self_install_permissions' ensure block calls File.chmod with a splatted Dir.glob result; when the omit short-circuits the body, the glob is empty and JRuby (unlike CRuby) rejects a chmod with no paths. Guard the ensure to skip when no files were created. test_generate_bin_symlink_win32 and test_generate_bin_with_dangling_symlink fall into the "Unable to use symlinks" wrapper branch only when symlink_supported? is false, but the installer on JRuby/Windows still manages to create the symlink, so the expected warning never appears. Omit them on the combo.
1 parent 321782d commit fd318f7

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

test/rubygems/test_gem.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ def assert_self_install_permissions(format_executable: false, data_mode: 0o640)
201201
end
202202
assert_equal(expected, result)
203203
ensure
204-
File.chmod(0o755, *Dir.glob(@gemhome + "/gems/**/"))
204+
files = Dir.glob(@gemhome + "/gems/**/")
205+
File.chmod(0o755, *files) unless files.empty?
205206
end
206207

207208
def test_require_missing

test/rubygems/test_gem_installer.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,8 +689,11 @@ def test_generate_bin_symlink_update_remove_wrapper
689689

690690
def test_generate_bin_symlink_win32
691691
old_win_platform = Gem.win_platform?
692-
Gem.win_platform = true
693692
old_alt_separator = File::ALT_SEPARATOR
693+
694+
omit "JRuby on Windows still creates the symlink so the wrapper branch is not exercised" if Gem.win_platform? && Gem.java_platform?
695+
696+
Gem.win_platform = true
694697
File.__send__(:remove_const, :ALT_SEPARATOR)
695698
File.const_set(:ALT_SEPARATOR, "\\")
696699

@@ -743,6 +746,8 @@ def test_generate_bin_uses_default_shebang
743746
end
744747

745748
def test_generate_bin_with_dangling_symlink
749+
omit "JRuby on Windows still creates the symlink so the wrapper branch is not exercised" if Gem.win_platform? && Gem.java_platform?
750+
746751
gem_with_dangling_symlink = File.expand_path("packages/ascii_binder-0.1.10.1.gem", __dir__)
747752

748753
installer = Gem::Installer.at(

0 commit comments

Comments
 (0)