aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorAlyssa Ross2016-09-28 20:55:24 +0100
committerAlyssa Ross2016-10-25 22:34:35 +0100
commit7792acda52c9c3b810959ac2c20066d3cf1fbe15 (patch)
tree043c5240b396e4bf12210c81f25e6a8367107855 /Library/Homebrew/test
parent13d705c5e7683ccfdb415642013daa34b6a0f1e5 (diff)
downloadbrew-7792acda52c9c3b810959ac2c20066d3cf1fbe15.tar.bz2
uninstall: allow dependent checks to be by-passed
Dependent can be bypassed with `--ignore-dependencies`. This is now the default for `HOMEBREW_DEVELOPER`s.
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_uninstall.rb62
1 files changed, 51 insertions, 11 deletions
diff --git a/Library/Homebrew/test/test_uninstall.rb b/Library/Homebrew/test/test_uninstall.rb
index dde736624..ede1e321b 100644
--- a/Library/Homebrew/test/test_uninstall.rb
+++ b/Library/Homebrew/test/test_uninstall.rb
@@ -17,35 +17,75 @@ class IntegrationCommandTestUninstall < IntegrationCommandTestCase
CONTENT
end
+ def f1
+ Formulary.factory(@f1_path)
+ end
+
+ def f2
+ Formulary.factory(@f2_path)
+ end
+
def test_uninstall
cmd("install", testball)
assert_match "Uninstalling testball", cmd("uninstall", "--force", testball)
+ assert_empty Formulary.factory(testball).installed_kegs
end
def test_uninstall_leaving_dependents
cmd("install", "testball_f2")
- assert_match "Refusing to uninstall", cmd_fail("uninstall", "testball_f1")
- assert_match "Uninstalling #{Formulary.factory(@f2_path).rack}",
- cmd("uninstall", "testball_f2")
+ run_as_not_developer do
+ assert_match "Refusing to uninstall",
+ cmd_fail("uninstall", "testball_f1")
+ refute_empty f1.installed_kegs
+ assert_match "Uninstalling #{f2.rack}",
+ cmd("uninstall", "testball_f2")
+ assert_empty f2.installed_kegs
+ end
end
def test_uninstall_force_leaving_dependents
cmd("install", "testball_f2")
- assert_match "Refusing to uninstall",
- cmd_fail("uninstall", "testball_f1", "--force")
- assert_match "Uninstalling testball_f2",
- cmd("uninstall", "testball_f2", "--force")
+ run_as_not_developer do
+ assert_match "Refusing to uninstall",
+ cmd_fail("uninstall", "testball_f1", "--force")
+ refute_empty f1.installed_kegs
+ assert_match "Uninstalling testball_f2",
+ cmd("uninstall", "testball_f2", "--force")
+ assert_empty f2.installed_kegs
+ end
+ end
+
+ def test_uninstall_ignore_dependencies_leaving_dependents
+ cmd("install", "testball_f2")
+ run_as_not_developer do
+ assert_match "Uninstalling #{f1.rack}",
+ cmd("uninstall", "testball_f1", "--ignore-dependencies")
+ assert_empty f1.installed_kegs
+ end
+ end
+
+ def test_uninstall_leaving_dependents_developer
+ cmd("install", "testball_f2")
+ assert_match "Uninstalling #{f1.rack}",
+ cmd("uninstall", "testball_f1")
+ assert_empty f1.installed_kegs
end
def test_uninstall_dependent_first
cmd("install", "testball_f2")
- assert_match "Uninstalling #{Formulary.factory(@f1_path).rack}",
- cmd("uninstall", "testball_f2", "testball_f1")
+ run_as_not_developer do
+ assert_match "Uninstalling #{f1.rack}",
+ cmd("uninstall", "testball_f2", "testball_f1")
+ assert_empty f1.installed_kegs
+ end
end
def test_uninstall_dependent_last
cmd("install", "testball_f2")
- assert_match "Uninstalling #{Formulary.factory(@f2_path).rack}",
- cmd("uninstall", "testball_f1", "testball_f2")
+ run_as_not_developer do
+ assert_match "Uninstalling #{f2.rack}",
+ cmd("uninstall", "testball_f1", "testball_f2")
+ assert_empty f2.installed_kegs
+ end
end
end