Port test_warn_sub_feature.rb to RSpec example

This commit is contained in:
Hiroshi SHIBATA 2024-11-15 11:49:30 +09:00
parent c5637f940a
commit 52e867268e
Notes: git 2024-11-15 05:04:38 +00:00
4 changed files with 15 additions and 16 deletions

View File

@ -55,10 +55,11 @@ module Gem::BUNDLED_GEMS
conf = ::RbConfig::CONFIG
if ENV["TEST_BUNDLED_GEMS"]
LIBDIR = (File.expand_path(File.join(__dir__, "..", "lib")) + "/").freeze
ARCHDIR = (File.expand_path(File.join(__dir__, "..", ".ext/common")) + "/").freeze
else
LIBDIR = (conf["rubylibdir"] + "/").freeze
ARCHDIR = (conf["rubyarchdir"] + "/").freeze
end
ARCHDIR = (conf["rubyarchdir"] + "/").freeze
dlext = [conf["DLEXT"], "so"].uniq
DLEXT = /\.#{Regexp.union(dlext)}\z/
LIBEXT = /\.#{Regexp.union("rb", *dlext)}\z/
@ -122,7 +123,7 @@ module Gem::BUNDLED_GEMS
if !path
return
elsif path.start_with?(ARCHDIR)
n = path.delete_prefix(ARCHDIR).sub(DLEXT, "")
n = path.delete_prefix(ARCHDIR).sub(DLEXT, "").chomp(".rb")
elsif path.start_with?(LIBDIR)
n = path.delete_prefix(LIBDIR).chomp(".rb")
else

View File

@ -62,6 +62,18 @@ RSpec.describe "bundled_gems.rb" do
expect(err).to include("You can add net-smtp")
end
it "Show warning sub-feature like fiddle/import" do
script <<-RUBY
gemfile do
source "https://rubygems.org"
end
require "fiddle/import"
RUBY
expect(err).to include(/fiddle was loaded from (.*) from Ruby 3.5.0/)
end
it "Show warning when bundle exec with ruby and script" do
code = <<-RUBY
require "ostruct"

View File

@ -1,9 +1,5 @@
#!/bin/bash
echo "* Show warning sub-feature like bigdecimal/util"
ruby test_warn_sub_feature.rb
echo
echo "* Show warning with bootsnap"
ruby test_warn_bootsnap.rb
echo

View File

@ -1,10 +0,0 @@
require "bundler"
Bundler::Definition.no_lock = true
require "bundler/inline"
gemfile do
source "https://rubygems.org"
end
require "bigdecimal/util"