diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-07-28 14:26:47 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-07-30 01:36:23 +0000 |
commit | 0d86cc4caf1495507b2937654d3ed868278b9ddc (patch) | |
tree | 1d2fc052ac5e3c67aa766b8a43ff984ab73f82f0 /spec | |
parent | bde4080b3989b4f097371b5cadb82bf6cb7c45b1 (diff) | |
download | ruby-0d86cc4caf1495507b2937654d3ed868278b9ddc.tar.gz |
[rubygems/rubygems] Use the dedicated method to convert file path
The dedicated method `File.path` to deal with pathname-like objects
has been provided since ruby 1.9.0.
Also adds a test for rubygems/rubygems#6837.
https://github.com/rubygems/rubygems/commit/258c6eda80
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/runtime/setup_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb index e98d462ee6..09f179c517 100644 --- a/spec/bundler/runtime/setup_spec.rb +++ b/spec/bundler/runtime/setup_spec.rb @@ -1650,4 +1650,34 @@ end expect(err).to include("net-imap is not part of the default gems") end + + it "calls #to_path on the name to require" do + build_repo4 do + build_gem "net-imap" do |s| + s.write "lib/net/imap.rb", "NET_IMAP = '0.0.1'" + end + build_gem "csv" + end + + install_gemfile <<-G + source "#{file_uri_for(gem_repo4)}" + gem "csv" + G + + ruby <<-R + Gem.send(:remove_const, :BUNDLED_GEMS) if defined?(Gem::BUNDLED_GEMS) + module Gem::BUNDLED_GEMS + SINCE = { "csv" => "1.0.0", "net-imap" => "0.0.1" } + end + path = BasicObject.new + def path.to_path; 'net/imap'; end + require 'bundler/setup' + begin + require path + rescue LoadError + end + R + + expect(err).to include("net-imap is not part of the default gems") + end end |