mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[rubygems/rubygems] Fix gem list
regression when a regular gem shadows a default one
Previously, if you have bundler installed both as a regular gem and a
default gem, the default gem would be displayed by `gem list`.
10a6b1736e
This commit is contained in:
parent
3d248b2eb3
commit
1164b6a7ba
2 changed files with 28 additions and 3 deletions
|
@ -132,7 +132,7 @@ module Gem::QueryUtils
|
||||||
version_matches = show_prereleases? || !s.version.prerelease?
|
version_matches = show_prereleases? || !s.version.prerelease?
|
||||||
|
|
||||||
name_matches && version_matches
|
name_matches && version_matches
|
||||||
end
|
end.uniq(&:full_name)
|
||||||
|
|
||||||
spec_tuples = specs.map do |spec|
|
spec_tuples = specs.map do |spec|
|
||||||
[spec.name_tuple, spec]
|
[spec.name_tuple, spec]
|
||||||
|
|
|
@ -8,7 +8,9 @@ class TestGemCommandsListCommand < Gem::TestCase
|
||||||
super
|
super
|
||||||
|
|
||||||
@cmd = Gem::Commands::ListCommand.new
|
@cmd = Gem::Commands::ListCommand.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_execute_installed
|
||||||
spec_fetcher do |fetcher|
|
spec_fetcher do |fetcher|
|
||||||
fetcher.spec "c", 1
|
fetcher.spec "c", 1
|
||||||
end
|
end
|
||||||
|
@ -16,9 +18,7 @@ class TestGemCommandsListCommand < Gem::TestCase
|
||||||
@fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do
|
@fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do
|
||||||
raise Gem::RemoteFetcher::FetchError
|
raise Gem::RemoteFetcher::FetchError
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def test_execute_installed
|
|
||||||
@cmd.handle_options %w[c --installed]
|
@cmd.handle_options %w[c --installed]
|
||||||
|
|
||||||
assert_raise Gem::MockGemUi::SystemExitException do
|
assert_raise Gem::MockGemUi::SystemExitException do
|
||||||
|
@ -30,4 +30,29 @@ class TestGemCommandsListCommand < Gem::TestCase
|
||||||
assert_equal "true\n", @ui.output
|
assert_equal "true\n", @ui.output
|
||||||
assert_equal "", @ui.error
|
assert_equal "", @ui.error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_execute_normal_gem_shadowing_default_gem
|
||||||
|
c1_default = new_default_spec "c", 1
|
||||||
|
install_default_gems c1_default
|
||||||
|
|
||||||
|
c1 = util_spec("c", 1) {|s| s.date = "2024-01-01" }
|
||||||
|
install_gem c1
|
||||||
|
|
||||||
|
Gem::Specification.reset
|
||||||
|
|
||||||
|
@cmd.handle_options %w[c]
|
||||||
|
|
||||||
|
use_ui @ui do
|
||||||
|
@cmd.execute
|
||||||
|
end
|
||||||
|
|
||||||
|
expected = <<-EOF
|
||||||
|
|
||||||
|
*** LOCAL GEMS ***
|
||||||
|
|
||||||
|
c (1)
|
||||||
|
EOF
|
||||||
|
|
||||||
|
assert_equal expected, @ui.output
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue