Merge pull request #12518 from nipunn1313/fix_test_on_m1

Fix analytics_spec.rb test to pass when run from M1
This commit is contained in:
Rylan Polster 2021-12-05 20:49:36 -05:00 committed by GitHub
commit cb7f27d5e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 3 deletions

View File

@ -11,10 +11,30 @@ describe Utils::Analytics do
described_class.clear_os_arch_prefix_ci
end
it "returns OS_VERSION and prefix when HOMEBREW_PREFIX is a custom prefix" do
let(:ci) { ", CI" if ENV["CI"] }
it "returns OS_VERSION and prefix when HOMEBREW_PREFIX is a custom prefix on intel" do
allow(Hardware::CPU).to receive(:type).and_return(:intel)
allow(Hardware::CPU).to receive(:in_rosetta2?).and_return(false)
allow(Homebrew).to receive(:default_prefix?).and_return(false)
expect(described_class.os_arch_prefix_ci).to include("#{OS_VERSION}, #{described_class.custom_prefix_label}")
expected = "#{OS_VERSION}, #{described_class.custom_prefix_label}#{ci}"
expect(described_class.os_arch_prefix_ci).to eq expected
end
it "returns OS_VERSION, ARM and prefix when HOMEBREW_PREFIX is a custom prefix on arm" do
allow(Hardware::CPU).to receive(:type).and_return(:arm)
allow(Hardware::CPU).to receive(:in_rosetta2?).and_return(false)
allow(Homebrew).to receive(:default_prefix?).and_return(false)
expected = "#{OS_VERSION}, ARM, #{described_class.custom_prefix_label}#{ci}"
expect(described_class.os_arch_prefix_ci).to eq expected
end
it "returns OS_VERSION, Rosetta and prefix when HOMEBREW_PREFIX is a custom prefix on Rosetta", :needs_macos do
allow(Hardware::CPU).to receive(:type).and_return(:intel)
allow(Hardware::CPU).to receive(:in_rosetta2?).and_return(true)
allow(Homebrew).to receive(:default_prefix?).and_return(false)
expected = "#{OS_VERSION}, Rosetta, #{described_class.custom_prefix_label}#{ci}"
expect(described_class.os_arch_prefix_ci).to eq expected
end
it "does not include prefix when HOMEBREW_PREFIX is the default prefix" do

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BREW" "1" "November 2021" "Homebrew" "brew"
.TH "BREW" "1" "December 2021" "Homebrew" "brew"
.
.SH "NAME"
\fBbrew\fR \- The Missing Package Manager for macOS (or Linux)