Fix tests for attestations
This commit is contained in:
parent
81e606007f
commit
8839ccfe72
@ -53,7 +53,6 @@ module Homebrew
|
|||||||
return true if Homebrew::EnvConfig.verify_attestations?
|
return true if Homebrew::EnvConfig.verify_attestations?
|
||||||
return false if GitHub::API.credentials.blank?
|
return false if GitHub::API.credentials.blank?
|
||||||
return false if ENV.fetch("CI", false)
|
return false if ENV.fetch("CI", false)
|
||||||
return false unless Formula["gh"].any_version_installed?
|
|
||||||
|
|
||||||
Homebrew::EnvConfig.developer? || Homebrew::EnvConfig.devcmdrun?
|
Homebrew::EnvConfig.developer? || Homebrew::EnvConfig.devcmdrun?
|
||||||
end
|
end
|
||||||
@ -70,7 +69,7 @@ module Homebrew
|
|||||||
return @gh_executable if @gh_executable.present?
|
return @gh_executable if @gh_executable.present?
|
||||||
|
|
||||||
with_env(HOMEBREW_NO_VERIFY_ATTESTATIONS: "1") do
|
with_env(HOMEBREW_NO_VERIFY_ATTESTATIONS: "1") do
|
||||||
@gh_executable = ensure_executable!("gh")
|
@gh_executable = ensure_executable!("gh", reason: "verifying attestations")
|
||||||
|
|
||||||
gh_version = Version.new(system_command!(@gh_executable, args: ["--version"], print_stderr: false)
|
gh_version = Version.new(system_command!(@gh_executable, args: ["--version"], print_stderr: false)
|
||||||
.stdout.match(/\d+(?:\.\d+)+/i).to_s)
|
.stdout.match(/\d+(?:\.\d+)+/i).to_s)
|
||||||
|
|||||||
@ -267,7 +267,7 @@ module Homebrew
|
|||||||
if formulae.include?(Formula["gh"])
|
if formulae.include?(Formula["gh"])
|
||||||
formulae.unshift(T.must(formulae.delete(Formula["gh"])))
|
formulae.unshift(T.must(formulae.delete(Formula["gh"])))
|
||||||
else
|
else
|
||||||
Homebrew::Attestation.ensure_gh_installed!
|
Homebrew::Attestation.gh_executable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -128,7 +128,7 @@ module Homebrew
|
|||||||
if formulae.include?(Formula["gh"])
|
if formulae.include?(Formula["gh"])
|
||||||
formulae.unshift(T.must(formulae.delete(Formula["gh"])))
|
formulae.unshift(T.must(formulae.delete(Formula["gh"])))
|
||||||
else
|
else
|
||||||
Homebrew::Attestation.ensure_gh_installed!
|
Homebrew::Attestation.gh_executable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -138,7 +138,7 @@ module Homebrew
|
|||||||
if formulae.include?(Formula["gh"])
|
if formulae.include?(Formula["gh"])
|
||||||
formulae.unshift(formulae.delete(Formula["gh"]))
|
formulae.unshift(formulae.delete(Formula["gh"]))
|
||||||
else
|
else
|
||||||
Homebrew::Attestation.ensure_gh_installed!
|
Homebrew::Attestation.gh_executable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ RSpec.describe Homebrew::Attestation do
|
|||||||
|
|
||||||
it "calls ensure_executable and ensure_formula_installed" do
|
it "calls ensure_executable and ensure_formula_installed" do
|
||||||
expect(described_class).to receive(:ensure_executable!)
|
expect(described_class).to receive(:ensure_executable!)
|
||||||
.with("gh")
|
.with("gh", reason: "verifying attestations")
|
||||||
.and_return(fake_old_gh)
|
.and_return(fake_old_gh)
|
||||||
|
|
||||||
expect(described_class).to receive(:ensure_formula_installed!)
|
expect(described_class).to receive(:ensure_formula_installed!)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user