Fix test failure

This commit is contained in:
Carlo Cabrera 2025-08-02 04:30:26 +08:00 committed by Carlo Cabrera
parent 0fd3b8e4af
commit fd80dd9eef
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -186,7 +186,10 @@ RSpec.describe Utils::Git do
unless ENV["HOMEBREW_TEST_GENERIC_OS"] unless ENV["HOMEBREW_TEST_GENERIC_OS"]
it "installs git" do it "installs git" do
expect(described_class).to receive(:available?).and_return(false) expect(described_class).to receive(:available?).and_return(false)
allow_any_instance_of(Formula).to receive(:ensure_installed!) allow(CoreTap.instance).to receive(:installed?).and_return(true)
formula_double = instance_double(Formula)
allow(Formula).to receive(:[]).with("git").and_return(formula_double)
allow(formula_double).to receive(:ensure_installed!).and_return(formula_double)
expect(described_class).to receive(:available?).and_return(true) expect(described_class).to receive(:available?).and_return(true)
described_class.ensure_installed! described_class.ensure_installed!