From 96064e6f1ce100a37680dc8f9509f06b3350e9c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 24 Mar 2020 07:39:24 +0100 Subject: Sync rubygems with current master (#2889) --- .../rubygems/test_gem_commands_contents_command.rb | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'test/rubygems/test_gem_commands_contents_command.rb') 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 -- cgit v1.2.3