2016-09-27 00:03:40 +02:00
|
|
|
require "helper/integration_command_test_case"
|
2016-10-25 23:53:10 +01:00
|
|
|
require "cmd/uninstall"
|
|
|
|
|
|
|
|
class UninstallTests < Homebrew::TestCase
|
|
|
|
def test_check_for_testball_f2s_when_developer
|
|
|
|
refute_predicate Homebrew, :should_check_for_dependents?
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_check_for_dependents_when_not_developer
|
|
|
|
run_as_not_developer do
|
|
|
|
assert_predicate Homebrew, :should_check_for_dependents?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_check_for_dependents_when_ignore_dependencies
|
|
|
|
ARGV << "--ignore-dependencies"
|
|
|
|
run_as_not_developer do
|
|
|
|
refute_predicate Homebrew, :should_check_for_dependents?
|
|
|
|
end
|
|
|
|
ensure
|
|
|
|
ARGV.delete("--ignore-dependencies")
|
|
|
|
end
|
|
|
|
end
|
2016-09-26 19:55:50 +02:00
|
|
|
|
2016-09-27 00:03:40 +02:00
|
|
|
class IntegrationCommandTestUninstall < IntegrationCommandTestCase
|
2016-09-27 22:37:03 +01:00
|
|
|
def setup
|
|
|
|
super
|
|
|
|
@f1_path = setup_test_formula "testball_f1", <<-CONTENT
|
|
|
|
def install
|
|
|
|
FileUtils.touch prefix/touch("hello")
|
|
|
|
end
|
|
|
|
CONTENT
|
|
|
|
@f2_path = setup_test_formula "testball_f2", <<-CONTENT
|
|
|
|
depends_on "testball_f1"
|
|
|
|
|
|
|
|
def install
|
|
|
|
FileUtils.touch prefix/touch("hello")
|
|
|
|
end
|
|
|
|
CONTENT
|
|
|
|
end
|
|
|
|
|
2016-09-28 20:55:24 +01:00
|
|
|
def f1
|
|
|
|
Formulary.factory(@f1_path)
|
|
|
|
end
|
|
|
|
|
|
|
|
def f2
|
|
|
|
Formulary.factory(@f2_path)
|
|
|
|
end
|
|
|
|
|
2016-09-26 19:55:50 +02:00
|
|
|
def test_uninstall
|
2016-09-27 22:37:03 +01:00
|
|
|
cmd("install", "testball_f2")
|
2016-09-28 20:55:24 +01:00
|
|
|
run_as_not_developer do
|
2016-09-30 19:34:14 +01:00
|
|
|
assert_match "Refusing to uninstall",
|
|
|
|
cmd_fail("uninstall", "testball_f1")
|
|
|
|
refute_empty f1.installed_kegs
|
2016-10-25 23:53:59 +01:00
|
|
|
|
2016-09-30 19:34:14 +01:00
|
|
|
assert_match "Uninstalling #{f2.rack}",
|
|
|
|
cmd("uninstall", "testball_f2")
|
|
|
|
assert_empty f2.installed_kegs
|
|
|
|
|
2016-09-28 20:55:24 +01:00
|
|
|
assert_match "Uninstalling #{f1.rack}",
|
2016-10-25 23:53:59 +01:00
|
|
|
cmd("uninstall", "testball_f1")
|
2016-09-28 20:55:24 +01:00
|
|
|
assert_empty f1.installed_kegs
|
|
|
|
end
|
2016-09-27 22:37:03 +01:00
|
|
|
end
|
2016-09-26 19:55:50 +02:00
|
|
|
end
|