Sync rubygems with current master (#2889)

This commit is contained in:
David Rodríguez 2020-03-24 07:39:24 +01:00 committed by GitHub
parent 930b012ad9
commit 96064e6f1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2020-03-24 15:39:48 +09:00
Merged-By: hsbt <hsbt@ruby-lang.org>
33 changed files with 434 additions and 559 deletions

View file

@ -105,6 +105,22 @@ class TestGemCommandsContentsCommand < Gem::TestCase
assert_empty @ui.error
end
def test_execute_missing_version
@cmd.options[:args] = %w[foo]
@cmd.options[:version] = Gem::Requirement.new '= 2'
gem 'foo', 1
assert_raises Gem::MockGemUi::TermError do
use_ui @ui do
@cmd.execute
end
end
assert_match "Unable to find gem 'foo'", @ui.output
assert_empty @ui.error
end
def test_execute_missing_multiple
@cmd.options[:args] = %w[foo bar]
@ -152,6 +168,23 @@ class TestGemCommandsContentsCommand < Gem::TestCase
assert_equal "", @ui.error
end
def test_execute_show_install_dir_latest_version
@cmd.options[:args] = %w[foo]
@cmd.options[:show_install_dir] = true
gem 'foo', 1
gem 'foo', 2
use_ui @ui do
@cmd.execute
end
expected = File.join @gemhome, 'gems', 'foo-2'
assert_equal "#{expected}\n", @ui.output
assert_equal "", @ui.error
end
def test_execute_show_install_dir_version
@cmd.options[:args] = %w[foo]
@cmd.options[:show_install_dir] = true