зеркало из https://github.com/github/ruby.git
Port test_warn_bundled_gems.rb to RSpec example
This commit is contained in:
Родитель
31bdffb5b9
Коммит
b44272fcb4
|
@ -52,7 +52,11 @@ module Gem::BUNDLED_GEMS
|
|||
WARNED = {} # unfrozen
|
||||
|
||||
conf = ::RbConfig::CONFIG
|
||||
LIBDIR = (conf["rubylibdir"] + "/").freeze
|
||||
if !File.exist?(conf["rubylibdir"])
|
||||
LIBDIR = (File.expand_path(File.join(__dir__, "..", "lib")) + "/").freeze
|
||||
else
|
||||
LIBDIR = (conf["rubylibdir"] + "/").freeze
|
||||
end
|
||||
ARCHDIR = (conf["rubyarchdir"] + "/").freeze
|
||||
dlext = [conf["DLEXT"], "so"].uniq
|
||||
DLEXT = /\.#{Regexp.union(dlext)}\z/
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
require "bundled_gems"
|
||||
|
||||
RSpec.describe "bundled_gems.rb" do
|
||||
def script(code, options = {})
|
||||
options[:artifice] ||= "compact_index"
|
||||
ruby("require 'bundler/inline'\n\n" + code, options)
|
||||
end
|
||||
|
||||
it "Show warning require and LoadError" do
|
||||
script <<-RUBY
|
||||
gemfile do
|
||||
source "https://rubygems.org"
|
||||
end
|
||||
|
||||
begin
|
||||
require "csv"
|
||||
rescue LoadError
|
||||
end
|
||||
require "ostruct"
|
||||
RUBY
|
||||
|
||||
expect(err).to include(/csv was loaded from (.*) from Ruby 3.4.0/)
|
||||
expect(err).to include(/ostruct was loaded from (.*) from Ruby 3.5.0/)
|
||||
end
|
||||
end
|
|
@ -1,9 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "* Show warning require and LoadError"
|
||||
ruby test_warn_bundled_gems.rb
|
||||
echo
|
||||
|
||||
echo "* Show warning when bundled gems called as dependency"
|
||||
ruby test_warn_dependency.rb
|
||||
echo
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
require "bundler"
|
||||
Bundler::Definition.no_lock = true
|
||||
|
||||
require "bundler/inline"
|
||||
|
||||
gemfile do
|
||||
source "https://rubygems.org"
|
||||
end
|
||||
|
||||
Object.send(:remove_const, :Bundler)
|
||||
|
||||
require "mutex_m"
|
||||
require "rss"
|
Загрузка…
Ссылка в новой задаче