aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_commands_uninstall_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_commands_uninstall_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_uninstall_command.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_uninstall_command.rb b/test/rubygems/test_gem_commands_uninstall_command.rb
index 844c7b4b97..d6fe3ea5d9 100644
--- a/test/rubygems/test_gem_commands_uninstall_command.rb
+++ b/test/rubygems/test_gem_commands_uninstall_command.rb
@@ -16,6 +16,20 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
@executable = File.join(@gemhome, 'bin', 'executable')
end
+ def test_execute_all_gem_names
+ @cmd.options[:args] = %w[a b]
+ @cmd.options[:all] = true
+
+ assert_raises Gem::MockGemUi::TermError do
+ use_ui @ui do
+ @cmd.execute
+ end
+ end
+
+ assert_equal "ERROR: Gem names and --all may not be used together\n",
+ @ui.error
+ end
+
def test_execute_dependency_order
c = quick_gem 'c' do |spec|
spec.add_dependency 'a'
@@ -43,6 +57,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
def test_execute_removes_executable
ui = Gem::MockGemUi.new
+
util_setup_gem ui
build_rake_in do
@@ -175,5 +190,23 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
assert Gem::Specification.find_all_by_name('x').length == 0
end
+ def test_execute_all
+ ui = Gem::MockGemUi.new "y\n"
+
+ util_make_gems
+ util_setup_gem ui
+
+ assert Gem::Specification.find_all_by_name('a').length > 1
+
+ @cmd.options[:all] = true
+ @cmd.options[:args] = []
+
+ use_ui ui do
+ @cmd.execute
+ end
+
+ refute_includes Gem::Specification.all_names, 'a'
+ end
+
end