diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-03-24 07:39:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-24 15:39:24 +0900 |
commit | 96064e6f1ce100a37680dc8f9509f06b3350e9c8 (patch) | |
tree | 798b59f015cb82ee3cd0427f80584032175829ba /test/rubygems/test_gem_commands_contents_command.rb | |
parent | 930b012ad96bfb0bd12446b89407120744ef92eb (diff) | |
download | ruby-96064e6f1ce100a37680dc8f9509f06b3350e9c8.tar.gz |
Sync rubygems with current master (#2889)
Diffstat (limited to 'test/rubygems/test_gem_commands_contents_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_contents_command.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_contents_command.rb b/test/rubygems/test_gem_commands_contents_command.rb index a8d6efe794..93ebcca5bb 100644 --- a/test/rubygems/test_gem_commands_contents_command.rb +++ b/test/rubygems/test_gem_commands_contents_command.rb @@ -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 |