1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
require "cmd/uninstall"
class UninstallTests < Homebrew::TestCase
def setup
@dependency = formula("dependency") { url "f-1" }
@dependent = formula("dependent") do
url "f-1"
depends_on "dependency"
end
[@dependency, @dependent].each { |f| f.installed_prefix.mkpath }
tab = Tab.empty
tab.tabfile = @dependent.installed_prefix/Tab::FILENAME
tab.runtime_dependencies = [
{ "full_name" => "dependency", "version" => "1" },
]
tab.write
stub_formula_loader @dependency
stub_formula_loader @dependent
end
def teardown
Homebrew.failed = false
[@dependency, @dependent].each { |f| f.rack.rmtree }
end
def handle_unsatisfied_dependents
capture_stderr do
opts = { @dependency.rack => [Keg.new(@dependency.installed_prefix)] }
Homebrew.handle_unsatisfied_dependents(opts)
end
end
def test_check_for_testball_f2s_when_developer
assert_match "Warning", handle_unsatisfied_dependents
refute_predicate Homebrew, :failed?
end
def test_check_for_dependents_when_not_developer
run_as_not_developer do
assert_match "Error", handle_unsatisfied_dependents
assert_predicate Homebrew, :failed?
end
end
def test_check_for_dependents_when_ignore_dependencies
ARGV << "--ignore-dependencies"
run_as_not_developer do
assert_empty handle_unsatisfied_dependents
refute_predicate Homebrew, :failed?
end
ensure
ARGV.delete("--ignore-dependencies")
end
end
class IntegrationCommandTestUninstall < IntegrationCommandTestCase
def test_uninstall
cmd("install", testball)
assert_match "Uninstalling testball", cmd("uninstall", "--force", testball)
end
end
|