mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Fix: Gem info bug with version flag
https://github.com/rubygems/rubygems/commit/e4cee1f975
This commit is contained in:
parent
87ef90909b
commit
4c1f6750f2
2 changed files with 28 additions and 2 deletions
|
@ -151,7 +151,7 @@ module Gem::QueryUtils
|
|||
fetcher.detect(specs_type) { true }
|
||||
else
|
||||
fetcher.detect(specs_type) do |name_tuple|
|
||||
name === name_tuple.name
|
||||
name === name_tuple.name && options[:version].satisfied_by?(name_tuple.version)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -159,7 +159,7 @@ module Gem::QueryUtils
|
|||
end
|
||||
|
||||
def specs_type
|
||||
if options[:all]
|
||||
if options[:all] || options[:version].specific?
|
||||
if options[:prerelease]
|
||||
:complete
|
||||
else
|
||||
|
|
|
@ -40,4 +40,30 @@ class TestGemCommandsInfoCommand < Gem::TestCase
|
|||
assert_match %r{#{@gem.summary}\n}, @ui.output
|
||||
assert_match "", @ui.error
|
||||
end
|
||||
|
||||
def test_execute_with_version_flag
|
||||
spec_fetcher do |fetcher|
|
||||
fetcher.spec "coolgem", "1.0"
|
||||
fetcher.spec "coolgem", "2.0"
|
||||
end
|
||||
|
||||
@cmd.handle_options %w[coolgem --remote --version 1.0]
|
||||
|
||||
use_ui @ui do
|
||||
@cmd.execute
|
||||
end
|
||||
|
||||
expected = <<-EOF
|
||||
|
||||
*** REMOTE GEMS ***
|
||||
|
||||
coolgem (1.0)
|
||||
Author: A User
|
||||
Homepage: http://example.com
|
||||
|
||||
this is a summary
|
||||
EOF
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue