ruby / ruby/rubygems

RubyGems test suite does not play well with defaults overrides

Open
#7,119 1 comment 0 reactions 1 assignee View on GitHub

@hsbt is already working on this.

Since Oct 28, 2025.

RubyGems
Dominant language
Ruby
Stars
4k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
81

Description

RubyGems provides a way to customize their configuration via:

https://github.com/rubygems/rubygems/blob/1a1948424aca90013b37cb8a78f5d1d5576023f1/lib/rubygems.rb#L1325

or

https://github.com/rubygems/rubygems/blob/1a1948424aca90013b37cb8a78f5d1d5576023f1/lib/rubygems.rb#L1342

Since Fedora ships own operating_system.rb file, I was always struggling a bit with executing the test suite. But since it was probably just me and there was relative simple workaround:

$ mkdir lib/rubygems/defaults/
$ touch lib/rubygems/defaults/operating_system.rb

I was not bothered to find better solution.

Nevertheless, I have prepared this Ruby proposal + POC PR and because this includes some custom configuration in rubygems/defaults/ruby.rb, the test suite fails. I have tried to improve the situation a bit, but then it fails on different places differently.

Now I wonder what would be the best way to fix this.

The workaround is valid, but I believe that Ruby executes RubyGems test suite in a slightly different way than Ruby itself. So that would probably needed fix in Ruby as well as in RubyGems (and as you can see, I was locally always executing test suite in a yet another way 😆, which does not make this too attractive to me).

I have tried to modify test/rubygems/helper.rb to provide fake directory structure with such files, but it loads RubyGems as a first step, which does not make this very viable.

Or maybe all the tests which fails with the operating_system.rb should be made more robust? Maybe this kind of failure is really caused just by some wrong assumptions:

    7) Failure:
  TestGem#test_default_path [/home/runner/work/ruby/ruby/src/test/rubygems/test_gem.rb:582]:
  <["/home/runner/work/ruby/ruby/build/tmp/test_rubygems_20231026-59729-7r82or/gemhome"]> expected but was
  <["/home/runner/work/ruby/ruby/build/tmp/test_rubygems_20231026-59729-7r82or/gemhome",
   "/usr/local/lib/ruby/bundled_gems/3.3.0+0",
   "/usr/local/lib/ruby/default_gems/3.3.0+0"]>.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.