зеркало из https://github.com/github/ruby.git
Port test_warn_bootsnap_and_gem.rb to RSpec example
This commit is contained in:
Родитель
5395afd422
Коммит
5bd0dfbf2e
|
@ -193,6 +193,36 @@ RSpec.describe "bundled_gems.rb" do
|
|||
# test_warn_bootsnap_rubyarchdir_gem.rb:14: warning: ...
|
||||
end
|
||||
|
||||
it "Show warning with bootsnap and some gem in Gemfile" do
|
||||
build_lib "childprocess", "5.0.0" do |s|
|
||||
# bootsnap expand required feature to full path
|
||||
# require 'logger'
|
||||
rubylibpath = File.expand_path(File.join(__dir__, "..", "..", "lib"))
|
||||
s.write "lib/childprocess.rb", "require '#{rubylibpath}/logger'"
|
||||
end
|
||||
|
||||
script <<-RUBY
|
||||
gemfile do
|
||||
source "https://rubygems.org"
|
||||
# gem "bootsnap", require: false
|
||||
path "#{lib_path}" do
|
||||
gem "childprocess", "5.0.0"
|
||||
end
|
||||
end
|
||||
|
||||
# require 'bootsnap'
|
||||
# Bootsnap.setup(cache_dir: 'tmp/cache')
|
||||
|
||||
# bootsnap expand required feature to full path
|
||||
# require 'childprocess'
|
||||
require Gem.loaded_specs["childprocess"].full_gem_path + '/lib/childprocess'
|
||||
RUBY
|
||||
|
||||
expect(err).to include(/logger was loaded from (.*) from Ruby 3.5.0/)
|
||||
# TODO: We should assert caller location like below:
|
||||
# $GEM_HOME/gems/childprocess-5.0.0/lib/childprocess.rb:7: warning:
|
||||
end
|
||||
|
||||
it "Don't show warning fiddle/import when fiddle on Gemfile" do
|
||||
build_lib "fiddle", "1.0.0" do |s|
|
||||
s.write "lib/fiddle.rb", "puts 'fiddle'"
|
||||
|
|
|
@ -3,7 +3,3 @@
|
|||
echo "* Show warning with zeitwerk"
|
||||
ruby test_warn_zeitwerk.rb
|
||||
echo
|
||||
|
||||
echo "* Show warning with bootsnap and some gem in Gemfile"
|
||||
ruby test_warn_bootsnap_and_gem.rb
|
||||
echo
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
require "bundler"
|
||||
Bundler::Definition.no_lock = true
|
||||
|
||||
require "bundler/inline"
|
||||
|
||||
gemfile do
|
||||
source "https://rubygems.org"
|
||||
gem "bootsnap", require: false
|
||||
gem "childprocess", "5.0.0", require: false # Has undeclared logger dependency
|
||||
end
|
||||
|
||||
ENV["BOOTSNAP_CACHE_DIR"] ||= "tmp/cache/bootsnap"
|
||||
require "bootsnap/setup"
|
||||
require "childprocess"
|
Загрузка…
Ссылка в новой задаче