зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Don't add duplicated specs to unresolved specs
This could happen when a regular gem shadows a default gem. https://github.com/rubygems/rubygems/commit/9ef70dd1f7
This commit is contained in:
Родитель
73d60df6e0
Коммит
d4ac5c573b
|
@ -1412,7 +1412,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
end
|
||||
|
||||
begin
|
||||
specs = spec_dep.to_specs
|
||||
specs = spec_dep.to_specs.uniq(&:full_name)
|
||||
rescue Gem::MissingSpecError => e
|
||||
raise Gem::MissingSpecError.new(e.name, e.requirement, "at: #{spec_file}")
|
||||
end
|
||||
|
|
|
@ -182,6 +182,22 @@ class TestGemRequire < Gem::TestCase
|
|||
assert_equal %w[a-1 b-1], loaded_spec_names
|
||||
end
|
||||
|
||||
def test_require_is_not_lazy_with_shadowed_default_gem
|
||||
b1_default = new_default_spec("b", "1", nil, "foo.rb")
|
||||
install_default_gems b1_default
|
||||
|
||||
a1 = util_spec "a", "1", { "b" => ">= 1" }, "lib/test_gem_require_a.rb"
|
||||
b1 = util_spec("b", "1", nil, "lib/foo.rb")
|
||||
install_specs b1, a1
|
||||
|
||||
# Load default ruby gems fresh as if we've just started a ruby script.
|
||||
Gem::Specification.reset
|
||||
|
||||
assert_require "test_gem_require_a"
|
||||
assert_equal %w[a-1 b-1], loaded_spec_names
|
||||
assert_equal unresolved_names, []
|
||||
end
|
||||
|
||||
def test_require_is_lazy_with_inexact_req
|
||||
a1 = util_spec "a", "1", { "b" => ">= 1" }, "lib/test_gem_require_a.rb"
|
||||
b1 = util_spec "b", "1", nil, "lib/b/c.rb"
|
||||
|
|
Загрузка…
Ссылка в новой задаче