mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parent
43daf4d288
commit
1039c32de6
Notes:
git
2020-05-08 14:14:28 +09:00
2 changed files with 20 additions and 2 deletions
|
@ -156,8 +156,7 @@ module Kernel
|
||||||
RUBYGEMS_ACTIVATION_MONITOR.enter
|
RUBYGEMS_ACTIVATION_MONITOR.enter
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if load_error.message.start_with?("Could not find") or
|
if load_error.message.end_with?(path) and Gem.try_activate(path)
|
||||||
(load_error.message.end_with?(path) and Gem.try_activate(path))
|
|
||||||
require_again = true
|
require_again = true
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
|
|
|
@ -91,6 +91,25 @@ class TestKernel < Gem::TestCase
|
||||||
refute $:.any? { |p| %r{a-1/bin} =~ p }
|
refute $:.any? { |p| %r{a-1/bin} =~ p }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_gem_failing_inside_require_doesnt_cause_double_exceptions
|
||||||
|
File.write("activate.rb", "gem('a', '= 999')\n")
|
||||||
|
|
||||||
|
require "open3"
|
||||||
|
|
||||||
|
output, _ = Open3.capture2e(
|
||||||
|
{ "GEM_HOME" => Gem.paths.home },
|
||||||
|
Gem.ruby,
|
||||||
|
"-I",
|
||||||
|
File.expand_path("../../lib", __dir__),
|
||||||
|
"-r",
|
||||||
|
"./activate.rb"
|
||||||
|
)
|
||||||
|
|
||||||
|
load_errors = output.split("\n").select { |line| line.include?("Could not find")}
|
||||||
|
|
||||||
|
assert_equal 1, load_errors.size
|
||||||
|
end
|
||||||
|
|
||||||
def test_gem_bundler
|
def test_gem_bundler
|
||||||
quick_gem 'bundler', '1'
|
quick_gem 'bundler', '1'
|
||||||
quick_gem 'bundler', '2.a'
|
quick_gem 'bundler', '2.a'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue