tests/utils/git_spec: update tests for ensure_formula_installed!

This commit is contained in:
XuehaiPan 2021-11-24 00:30:26 +08:00
parent 9ef52080e3
commit d1aac8857a
2 changed files with 1 additions and 3 deletions

View File

@ -184,7 +184,7 @@ 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)
expect(described_class).to receive(:safe_system).with(HOMEBREW_BREW_FILE, "install", "git").and_return(true) expect(described_class).to receive(:ensure_formula_installed!).with("git")
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!

View File

@ -94,8 +94,6 @@ module Utils
# we cannot install brewed git if homebrew/core is unavailable. # we cannot install brewed git if homebrew/core is unavailable.
if CoreTap.instance.installed? if CoreTap.instance.installed?
begin begin
oh1 "Installing #{Formatter.identifier("git")}"
# Otherwise `git` will be installed from source in tests that need it. This is slow # Otherwise `git` will be installed from source in tests that need it. This is slow
# and will also likely fail due to `OS::Linux` and `OS::Mac` being undefined. # and will also likely fail due to `OS::Linux` and `OS::Mac` being undefined.
raise "Refusing to install Git on a generic OS." if ENV["HOMEBREW_TEST_GENERIC_OS"] raise "Refusing to install Git on a generic OS." if ENV["HOMEBREW_TEST_GENERIC_OS"]