1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib
David Rodríguez ef481c120c Fix ruby-head failing tests
In `ruby-head` (where system rubygems already has the `XDG` standard
implementation), some tests currently depend on the presence of a
`~/.gem` folder in the home of the user that runs the tests. If that
file is present, tests pass, otherwise they don't.

For example, the following passes if you have a `~/.gem` folder but
fails otherwise with:

```
$ rake TESTOPTS="--name=/TestGemCommandsGenerateIndexCommand#test_execute$\|TestGemCommandsUpdateCommand#test_execute_user_install/ -v"
Run options: "--name=/TestGemCommandsGenerateIndexCommand#test_execute$|TestGemCommandsUpdateCommand#test_execute_user_install/" -v --seed 17318

# Running:

TestGemCommandsGenerateIndexCommand#test_execute = 0.02 s = .
TestGemCommandsUpdateCommand#test_execute_user_install = /rubygems/test/rubygems/test_gem_commands_update_command.rb:412: warning: instance variable @user_install not initialized
0.04 s = F

Finished in 0.095337s, 20.9783 runs/s, 20.9783 assertions/s.

  1) Failure:
TestGemCommandsUpdateCommand#test_execute_user_install [/rubygems/test/rubygems/test_gem_commands_update_command.rb:414]:
user_install must be set on the installer

2 runs, 2 assertions, 1 failures, 0 errors, 0 skips
rake aborted!
Command failed with status (1)

Tasks: TOP => default => test
(See full trace by running task with --trace)

```

This is because the very initial `require` of the default `did_you_mean`
gem that ruby does on startup runs _before_  the global `setup` hook of
our tests run. During this require `Gem.data_home` and its value is
memoized to a path in the real users home (not the fake user's home that
our tests setup, since that code hasn't run yet). Then that memoized
value is used when looking for the default folders to look for gems, and
since there's no `~/.gem` folder, its value is actually used as part of
the `Gem.user_dir` folder in `Gem::Specification.dirs` (this is how
we've approached backwards compatibility for the `XDG` feature). That
means dummy test gems with the `--user-install` flag are installed to
global, real locations and everything is messed up.

This commit fixes the issue by resetting the `Gem.data_home` value in
case it has already been memoized.
2020-06-15 19:48:25 +09:00
..
benchmark Add workaround for test-bundler failure 2020-03-12 19:17:08 +09:00
bundler [rubygems/rubygems] Remove multiline gem specifications correctly 2020-06-05 07:32:42 +09:00
cgi Add workaround for test-bundler failure 2020-03-12 19:17:08 +09:00
csv
delegate [ruby/delegate] Fixed superclass missmatch 2020-06-11 12:24:57 +09:00
did_you_mean Remove experimental feaures and related code completely 2020-06-06 14:13:19 -04:00
drb lib/drb/drb.rb: Use ruby2_keywords for keyword separation 2020-02-15 16:27:03 +09:00
forwardable [ruby/forwardable] Bump version to 1.3.1 2019-12-11 20:23:53 +09:00
getoptlong Add workaround for test-bundler failure 2020-03-12 19:17:08 +09:00
irb [ruby/irb] Version 1.2.4 2020-05-17 19:26:53 +09:00
logger Suppress security alerts 2020-02-28 21:05:08 -08:00
matrix [ruby/matrix] Drop to Ruby 2.4 and 2.5 2020-06-11 13:48:17 +09:00
net Drop to Ruby 2.4 2020-06-11 13:06:59 +09:00
observer Add workaround for test-bundler failure 2020-03-12 19:17:08 +09:00
open3 Add workaround for test-bundler failure 2020-03-12 19:17:08 +09:00
optparse
ostruct [ruby/ostruct] Bump version 2019-12-22 21:48:54 -05:00
pstore Add workaround for test-bundler failure 2020-03-12 19:17:08 +09:00
racc Fixed typos in racc 2020-04-27 15:28:06 +09:00
rdoc [ruby/rdoc] Add frozen string literal support 2020-05-24 23:47:24 +09:00
reline [ruby/reline] Remove unnecessary TODO commnet 2020-05-17 19:26:53 +09:00
rinda
rubygems Fix ruby-head failing tests 2020-06-15 19:48:25 +09:00
singleton Add workaround for test-bundler failure 2020-03-12 19:17:08 +09:00
timeout Add workaround for test-bundler failure 2020-03-12 19:17:08 +09:00
tracer [ruby/tracer] Use Gemfile instead of Gem::Specification#add_development_dependency. 2019-10-25 09:29:10 +09:00
unicode_normalize
uri [ruby/uri] Check if DN exists 2020-05-05 23:29:39 +09:00
weakref [ruby/weakref] Update TODO on README 2020-04-08 18:33:00 +09:00
webrick Use filesystem encoding in do_GET of filehandler 2020-06-15 11:25:33 +09:00
yaml Add workaround for test-bundler failure 2020-03-12 19:17:08 +09:00
.document Bundler is not documented in RDoc, but something different 2020-04-07 13:01:19 +09:00
abbrev.rb
base64.rb base64.rb: improve performance of Base64.urlsafe_encode64 2019-12-10 14:32:35 +09:00
benchmark.rb
bundler.rb Update the bundler version with master branch 2020-05-13 07:54:37 +09:00
cgi.rb
csv.rb
debug.rb debug.rb: expand filenames in breakpoints 2019-12-05 13:28:34 +09:00
delegate.rb Support obj.clone(freeze: true) for freezing clone 2020-03-22 09:30:07 -07:00
did_you_mean.rb Sync did_you_mean 2020-06-06 13:02:08 -04:00
drb.rb
English.gemspec Update the version of published gemspec. 2020-04-08 14:21:14 +09:00
English.rb
erb.rb Warn on access/modify of $SAFE, and remove effects of modifying $SAFE 2019-11-18 01:00:25 +02:00
fileutils.gemspec Move gemspec of fileutils under the toplevel of lib directory. 2019-11-30 17:32:38 +09:00
fileutils.rb Revert "[ruby/fileutils] Make verbose output go to stdout instead of stderr" 2020-06-12 19:02:50 +09:00
find.rb Deprecate taint/trust and related methods, and make the methods no-ops 2019-11-18 01:00:25 +02:00
forwardable.rb [ruby/forwardable] Make def_*_delegator return name of method defined (Fixes #10) 2019-12-11 20:23:53 +09:00
getoptlong.rb
ipaddr.gemspec Suppress security alerts 2020-02-28 21:05:08 -08:00
ipaddr.rb
irb.rb [DOC] get rid of parsing as TIDYLINK unintentionally 2020-04-07 13:59:38 +09:00
logger.rb [ruby/logger] Mention File::Null in Logger#new document 2020-06-11 14:22:32 +09:00
matrix.rb [ruby/matrix] Add Matrix#adjoint [#14] 2020-05-01 03:25:15 -04:00
mkmf.rb Added tooldir variable 2020-04-05 09:26:57 +09:00
mutex_m.gemspec
mutex_m.rb
observer.rb
open-uri.rb [DOC] get rid of parsing as TIDYLINK unintentionally 2020-04-07 13:59:38 +09:00
open3.rb lib/open3.rb: make sure that pipes are closed 2020-05-27 00:20:14 +09:00
optionparser.rb
optparse.rb Revert "Method reference operator" 2019-11-12 17:24:48 +09:00
ostruct.rb Fix OpenStructDocumentation 2020-01-05 14:35:14 +09:00
pp.rb Fix pp when passed a empty ruby2_keywords-flagged hash as array element 2020-01-22 10:27:02 -08:00
prettyprint.rb Fix articles. 2020-04-11 02:32:23 +09:00
prime.gemspec Update the latest gemspec of prime. 2020-04-08 14:33:22 +09:00
prime.rb Improve docs for Prime.{prime_division,int_from_prime_division} (#8) 2020-03-06 20:55:22 +09:00
pstore.rb
racc.rb
rdoc.rb Skip the initialization of XDG_DATA_HOME with Permission denied 2020-04-23 21:11:21 +09:00
readline.gemspec [ruby/readline] Version 0.0.2 2019-12-25 10:57:44 +09:00
readline.rb Suppress duplicated "require 'reline'" 2019-10-23 23:59:53 +09:00
reline.rb Reline callbacks can take nil 2020-05-14 12:27:33 +09:00
resolv-replace.rb
resolv.rb Convert ip addresses to canonical form in Resolv::DNS::Requester::UnconnectedUDP#sender 2020-05-29 15:59:27 -07:00
rubygems.rb [rubygems/rubygems] Respect files loaded from default gems before rubygems 2020-06-05 07:32:42 +09:00
securerandom.rb
set.rb Make mutating the result of SortedSet#to_a not affect the set 2020-06-11 14:02:00 -07:00
shellwords.rb
singleton.rb [ruby/singleton] Remove unnecessaray space 2020-06-09 10:07:10 +09:00
tempfile.gemspec The current tempfile.rb is only works with Ruby 2.5+ 2020-04-08 15:20:44 +09:00
tempfile.rb Warn on access/modify of $SAFE, and remove effects of modifying $SAFE 2019-11-18 01:00:25 +02:00
time.rb Time.xmlschema: Clarify error and docs 2020-05-23 09:43:05 +09:00
timeout.rb
tmpdir.gemspec Add workaround for test-bundler failure 2020-03-12 19:17:08 +09:00
tmpdir.rb Correctly remove temporary directory if path yielded is mutated 2020-05-29 07:06:46 -07:00
tracer.rb Fixed misspellings 2019-12-20 12:19:45 +09:00
tsort.rb
un.rb DocumentRoot is optional 2020-01-21 18:13:54 +09:00
uri.rb [ruby/uri] Remove RCS keywords 2020-03-26 18:06:14 +09:00
weakref.rb
webrick.rb
yaml.rb