summaryrefslogtreecommitdiff
path: root/test/json/json_encoding_test.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2025-05-16 19:51:12 +0200
committerHiroshi SHIBATA <[email protected]>2025-05-19 11:19:17 +0900
commit57e4176649f056966d860505694570d23200b44a (patch)
tree3d5961e80c5ca0d185a0a82ef991bf70b02bed94 /test/json/json_encoding_test.rb
parent0f867d97ab96fd663f8bd0627276bf93119d892e (diff)
[rubygems/rubygems] Fix test warnings introduced by recent CGI changes
They read like this: ``` /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/util.rb:13: warning: method redefined; discarding old rfc1123_date /opt/hostedtoolcache/Ruby/3.4.3/x64/lib/ruby/3.4.0/cgi/util.rb:225: warning: previous definition of rfc1123_date was here /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/util.rb:34: warning: method redefined; discarding old pretty /opt/hostedtoolcache/Ruby/3.4.3/x64/lib/ruby/3.4.0/cgi/util.rb:246: warning: previous definition of pretty was here /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/escape.rb:16: warning: method redefined; discarding old escape /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/escape.rb:29: warning: method redefined; discarding old unescape /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/util.rb:13: warning: method redefined; discarding old rfc1123_date /opt/hostedtoolcache/Ruby/3.4.3/x64/lib/ruby/3.4.0/cgi/util.rb:225: warning: previous definition of rfc1123_date was here /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/util.rb:34: warning: method redefined; discarding old pretty /opt/hostedtoolcache/Ruby/3.4.3/x64/lib/ruby/3.4.0/cgi/util.rb:246: warning: previous definition of pretty was here /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/escape.rb:16: warning: method redefined; discarding old escape /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/escape.rb:29: warning: method redefined; discarding old unescape ``` The problem is that `rspec` loads `erb` for its configuration, which loads `cgi/util` from system gems. Then our tests change the `$LOAD_PATH` to make test gems installed in tmp visible to `require`, and then they all require `cgi` as a transitive dependency of `rack-test`, this time from `tmp` gems. This causes system and test specific copies to be mixed together and these warnings to be printed, but we have also observed failures in some tests with errors like > class variable @@accept_charset of CGI::Util is overtaken by CGI::Escape This changes should also fix those failures. The fix is to require all of `rack-test` (including `cgi`) before we have changed the `$LOAD_PATH`. Because the `$LOAD_PATH` is unchanged, RubyGems respects the version of `cgi` activated by RSpec, avoiding the double loads. https://github.com/rubygems/rubygems/commit/34e75465c6
Diffstat (limited to 'test/json/json_encoding_test.rb')
0 files changed, 0 insertions, 0 deletions