aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_commands_cleanup_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_commands_cleanup_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_cleanup_command.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_cleanup_command.rb b/test/rubygems/test_gem_commands_cleanup_command.rb
index 22bbfb7a2f..40c7b30539 100644
--- a/test/rubygems/test_gem_commands_cleanup_command.rb
+++ b/test/rubygems/test_gem_commands_cleanup_command.rb
@@ -38,6 +38,44 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
refute_path_exists @b_1.gem_dir
end
+ def test_execute_all_user
+ @a_1_1 = quick_spec 'a', '1.1'
+ @a_1_1 = install_gem_user @a_1_1 # pick up user install path
+
+ Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
+
+ assert_path_exists @a_1.gem_dir
+ assert_path_exists @a_1_1.gem_dir
+
+ @cmd.options[:args] = %w[a]
+
+ @cmd.execute
+
+ refute_path_exists @a_1.gem_dir
+ refute_path_exists @a_1_1.gem_dir
+ end
+
+ def test_execute_all_user_no_sudo
+ FileUtils.chmod 0555, @gemhome
+
+ @a_1_1 = quick_spec 'a', '1.1'
+ @a_1_1 = install_gem_user @a_1_1 # pick up user install path
+
+ Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
+
+ assert_path_exists @a_1.gem_dir
+ assert_path_exists @a_1_1.gem_dir
+
+ @cmd.options[:args] = %w[a]
+
+ @cmd.execute
+
+ assert_path_exists @a_1.gem_dir
+ refute_path_exists @a_1_1.gem_dir
+ ensure
+ FileUtils.chmod 0755, @gemhome
+ end unless win_platform?
+
def test_execute_dry_run
@cmd.options[:args] = %w[a]
@cmd.options[:dryrun] = true