aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cmd/uninstall_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/test/cmd/uninstall_spec.rb')
-rw-r--r--Library/Homebrew/test/cmd/uninstall_spec.rb64
1 files changed, 64 insertions, 0 deletions
diff --git a/Library/Homebrew/test/cmd/uninstall_spec.rb b/Library/Homebrew/test/cmd/uninstall_spec.rb
index 65f69e802..b9a0d8d40 100644
--- a/Library/Homebrew/test/cmd/uninstall_spec.rb
+++ b/Library/Homebrew/test/cmd/uninstall_spec.rb
@@ -1,3 +1,5 @@
+require "cmd/uninstall"
+
describe "brew uninstall", :integration_test do
it "uninstalls a given Formula" do
shutup do
@@ -10,3 +12,65 @@ describe "brew uninstall", :integration_test do
.and be_a_success
end
end
+
+describe Homebrew do
+ let(:dependency) { formula("dependency") { url "f-1" } }
+ let(:dependent) do
+ formula("dependent") do
+ url "f-1"
+ depends_on "dependency"
+ end
+ end
+
+ let(:opts) { { dependency.rack => [Keg.new(dependency.installed_prefix)] } }
+
+ before(:each) do
+ [dependency, dependent].each do |f|
+ f.installed_prefix.mkpath
+ Keg.new(f.installed_prefix).optlink
+ end
+
+ tab = Tab.empty
+ tab.homebrew_version = "1.1.6"
+ 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
+
+ describe "::handle_unsatisfied_dependents" do
+ specify "when developer" do
+ expect {
+ described_class.handle_unsatisfied_dependents(opts)
+ }.to output(/Warning/).to_stderr
+
+ expect(described_class).not_to have_failed
+ end
+
+ specify "when not developer" do
+ run_as_not_developer do
+ expect {
+ described_class.handle_unsatisfied_dependents(opts)
+ }.to output(/Error/).to_stderr
+
+ expect(described_class).to have_failed
+ end
+ end
+
+ specify "when not developer and --ignore-dependencies is specified" do
+ ARGV << "--ignore-dependencies"
+
+ run_as_not_developer do
+ expect {
+ described_class.handle_unsatisfied_dependents(opts)
+ }.not_to output.to_stderr
+
+ expect(described_class).not_to have_failed
+ end
+ end
+ end
+end