brew/Library/Homebrew/test/os/linux/diagnostic_spec.rb
copilot-swe-agent[bot] d785e2024b
Add symlinked home detection to brew doctor on Linux
Co-authored-by: MikeMcQuaid <125011+MikeMcQuaid@users.noreply.github.com>
2025-08-12 11:00:14 +01:00

36 lines
1.0 KiB
Ruby

# frozen_string_literal: true
require "diagnostic"
RSpec.describe Homebrew::Diagnostic::Checks do
subject(:checks) { described_class.new }
specify "#check_supported_architecture" do
allow(Hardware::CPU).to receive(:type).and_return(:arm64)
expect(checks.check_supported_architecture)
.to match(/Your CPU architecture .+ is not supported/)
end
specify "#check_glibc_minimum_version" do
allow(OS::Linux::Glibc).to receive(:below_minimum_version?).and_return(true)
expect(checks.check_glibc_minimum_version)
.to match(/Your system glibc .+ is too old/)
end
specify "#check_kernel_minimum_version" do
allow(OS::Linux::Kernel).to receive(:below_minimum_version?).and_return(true)
expect(checks.check_kernel_minimum_version)
.to match(/Your Linux kernel .+ is too old/)
end
specify "#check_for_symlinked_home" do
allow(File).to receive(:symlink?).with("/home").and_return(true)
expect(checks.check_for_symlinked_home)
.to match(%r{Your /home directory is a symlink})
end
end