From 876cda0e9ba8ed8b8b723da993cda7418ef7be6f Mon Sep 17 00:00:00 2001 From: Troels Thomsen Date: Sun, 24 Nov 2024 09:00:12 +0100 Subject: [PATCH] Verify behavior when formula is unavailable --- spec/bundle/commands/cleanup_command_spec.rb | 6 ++++++ spec/stub/exceptions.rb | 3 +++ 2 files changed, 9 insertions(+) diff --git a/spec/bundle/commands/cleanup_command_spec.rb b/spec/bundle/commands/cleanup_command_spec.rb index 149cb5ec0..8cac2e535 100644 --- a/spec/bundle/commands/cleanup_command_spec.rb +++ b/spec/bundle/commands/cleanup_command_spec.rb @@ -72,6 +72,12 @@ expect(described_class.taps_to_untap).to eql(%w[z]) end + it "ignores unavailable formulae when computing which taps to keep" do + allow(Formulary).to receive(:factory).and_raise(TapFormulaUnavailableError) + allow(Bundle::TapDumper).to receive(:tap_names).and_return(%w[z homebrew/bundle homebrew/core homebrew/tap]) + expect(described_class.taps_to_untap).to eql(%w[z homebrew/tap]) + end + it "computes which VSCode extensions to uninstall" do allow(Bundle::VscodeExtensionDumper).to receive(:extensions).and_return(%w[z]) expect(described_class.vscode_extensions_to_uninstall).to eql(%w[z]) diff --git a/spec/stub/exceptions.rb b/spec/stub/exceptions.rb index 1d921345f..68d01f6b8 100644 --- a/spec/stub/exceptions.rb +++ b/spec/stub/exceptions.rb @@ -5,3 +5,6 @@ class UsageError < RuntimeError class FormulaUnavailableError < RuntimeError end + +class TapFormulaUnavailableError < RuntimeError +end