summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_update_command.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2020-02-01 11:14:04 +0900
committerHiroshi SHIBATA <[email protected]>2020-02-01 11:14:57 +0900
commit600a715c9bde99fe2e9a669465d78833445273e8 (patch)
tree8244622e8cc02b40dd0dad29d30fc60a11342396 /test/rubygems/test_gem_commands_update_command.rb
parentadc303131187654d8ce83f3db17eefa3d5bae26c (diff)
Merge the current master branch of rubygems/rubygems.
Just started to develop RubyGems 3.2.0.
Diffstat (limited to 'test/rubygems/test_gem_commands_update_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_update_command.rb54
1 files changed, 49 insertions, 5 deletions
diff --git a/test/rubygems/test_gem_commands_update_command.rb b/test/rubygems/test_gem_commands_update_command.rb
index 37f990ea1a..340c658b9d 100644
--- a/test/rubygems/test_gem_commands_update_command.rb
+++ b/test/rubygems/test_gem_commands_update_command.rb
@@ -159,6 +159,44 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
assert_empty out
end
+ def test_execute_system_specific_older_than_3_2_removes_plugins_dir
+ spec_fetcher do |fetcher|
+ fetcher.download 'rubygems-update', 3.1 do |s|
+ s.files = %w[setup.rb]
+ end
+ end
+
+ @cmd.options[:args] = []
+ @cmd.options[:system] = "3.1"
+
+ FileUtils.mkdir_p Gem.plugins_dir
+ write_file File.join(Gem.plugins_dir, 'a_plugin.rb')
+
+ @cmd.execute
+
+ refute_path_exists Gem.plugins_dir, "Plugins folder not removed when updating rubygems to pre-3.2"
+ end
+
+ def test_execute_system_specific_newer_than_or_equal_to_3_2_leaves_plugins_dir_alone
+ spec_fetcher do |fetcher|
+ fetcher.download 'rubygems-update', 3.2 do |s|
+ s.files = %w[setup.rb]
+ end
+ end
+
+ @cmd.options[:args] = []
+ @cmd.options[:system] = "3.2"
+
+ FileUtils.mkdir_p Gem.plugins_dir
+ plugin_file = File.join(Gem.plugins_dir, 'a_plugin.rb')
+ write_file plugin_file
+
+ @cmd.execute
+
+ assert_path_exists Gem.plugins_dir, "Plugin folder removed when updating rubygems to post-3.2"
+ assert_path_exists plugin_file, "Plugin removed when updating rubygems to post-3.2"
+ end
+
def test_execute_system_specifically_to_latest_version
spec_fetcher do |fetcher|
fetcher.download 'rubygems-update', 8 do |s|
@@ -359,10 +397,10 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
end
def test_execute_user_install
- spec_fetcher do |fetcher|
- fetcher.download 'a', 2
- fetcher.spec 'a', 1
- end
+ a = util_spec "a", 1
+ b = util_spec "b", 1
+ install_gem_user(a)
+ install_gem(b)
@cmd.handle_options %w[--user-install]
@@ -373,7 +411,13 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
installer = @cmd.installer
user_install = installer.instance_variable_get :@user_install
- assert user_install, 'user_install must be set on the installer'
+ assert user_install, "user_install must be set on the installer"
+
+ out = @ui.output.split "\n"
+ assert_equal "Updating installed gems", out.shift
+ assert_equal "Updating a", out.shift
+ assert_equal "Gems updated: a", out.shift
+ assert_empty out
end
def test_fetch_remote_gems