summaryrefslogtreecommitdiff
path: root/test/rubygems
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-12-21 10:37:46 +0100
committergit <svn-admin@ruby-lang.org>2021-12-27 22:57:46 +0900
commitbe476f38f9a467a25b81dabe42ca120924527395 (patch)
tree938825063ce393b5c2e44c336455882a5e7de9ec /test/rubygems
parentebb4044decb293fde12b2d71e822be78034b90b1 (diff)
[rubygems/rubygems] Don't crash when updating to an unsupported `rubygems-update` version
https://github.com/rubygems/rubygems/commit/b0badcd00a
Diffstat (limited to 'test/rubygems')
-rw-r--r--test/rubygems/test_gem_commands_update_command.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_update_command.rb b/test/rubygems/test_gem_commands_update_command.rb
index e9264f6d14..ce599d5812 100644
--- a/test/rubygems/test_gem_commands_update_command.rb
+++ b/test/rubygems/test_gem_commands_update_command.rb
@@ -106,6 +106,31 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
assert_empty out
end
+ def test_execute_system_when_latest_does_not_support_your_ruby
+ spec_fetcher do |fetcher|
+ fetcher.download 'rubygems-update', 9 do |s|
+ s.files = %w[setup.rb]
+ s.required_ruby_version = '> 9'
+ end
+ end
+
+ @cmd.options[:args] = []
+ @cmd.options[:system] = true
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ out = @ui.output.split "\n"
+ assert_equal "Updating rubygems-update", out.shift
+ assert_empty out
+
+ err = @ui.error.split "\n"
+ assert_equal "ERROR: Error installing rubygems-update:", err.shift
+ assert_equal "\trubygems-update-9 requires Ruby version > 9. The current ruby version is #{Gem.ruby_version}.", err.shift
+ assert_empty err
+ end
+
def test_execute_system_multiple
spec_fetcher do |fetcher|
fetcher.download 'rubygems-update', 8 do |s|