2020-10-10 14:16:11 +02:00
|
|
|
# typed: false
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-02-25 10:19:27 +01:00
|
|
|
require "diagnostic"
|
|
|
|
|
|
|
|
describe Homebrew::Diagnostic::Checks do
|
2021-01-31 13:14:23 -05:00
|
|
|
subject(:checks) { described_class.new }
|
|
|
|
|
2017-02-25 10:19:27 +01:00
|
|
|
specify "#check_for_unsupported_macos" do
|
|
|
|
ENV.delete("HOMEBREW_DEVELOPER")
|
2020-11-23 10:14:18 +01:00
|
|
|
|
|
|
|
macos_version = OS::Mac::Version.new("10.14")
|
|
|
|
allow(OS::Mac).to receive(:version).and_return(macos_version)
|
|
|
|
allow(OS::Mac).to receive(:full_version).and_return(macos_version)
|
2017-02-25 10:19:27 +01:00
|
|
|
allow(OS::Mac).to receive(:prerelease?).and_return(true)
|
|
|
|
|
2021-01-31 13:14:23 -05:00
|
|
|
expect(checks.check_for_unsupported_macos)
|
2017-02-25 10:19:27 +01:00
|
|
|
.to match("We do not provide support for this pre-release version.")
|
|
|
|
end
|
|
|
|
|
2018-04-02 08:53:05 +01:00
|
|
|
specify "#check_if_xcode_needs_clt_installed" do
|
2020-11-23 10:14:18 +01:00
|
|
|
macos_version = OS::Mac::Version.new("10.11")
|
|
|
|
allow(OS::Mac).to receive(:version).and_return(macos_version)
|
|
|
|
allow(OS::Mac).to receive(:full_version).and_return(macos_version)
|
|
|
|
allow(OS::Mac::Xcode).to receive(:installed?).and_return(true)
|
|
|
|
allow(OS::Mac::Xcode).to receive(:version).and_return("8.0")
|
|
|
|
allow(OS::Mac::Xcode).to receive(:without_clt?).and_return(true)
|
2017-02-25 10:19:27 +01:00
|
|
|
|
2021-01-31 13:14:23 -05:00
|
|
|
expect(checks.check_if_xcode_needs_clt_installed)
|
2018-04-02 08:53:05 +01:00
|
|
|
.to match("Xcode alone is not sufficient on El Capitan")
|
2017-02-25 10:19:27 +01:00
|
|
|
end
|
2017-05-27 13:34:59 +01:00
|
|
|
|
2017-06-06 13:45:09 +07:00
|
|
|
specify "#check_ruby_version" do
|
2020-11-23 10:14:18 +01:00
|
|
|
macos_version = OS::Mac::Version.new("10.12")
|
|
|
|
allow(OS::Mac).to receive(:version).and_return(macos_version)
|
|
|
|
allow(OS::Mac).to receive(:full_version).and_return(macos_version)
|
2017-09-15 08:06:58 +01:00
|
|
|
stub_const("RUBY_VERSION", "1.8.6")
|
2017-06-06 13:45:09 +07:00
|
|
|
|
2021-01-31 13:14:23 -05:00
|
|
|
expect(checks.check_ruby_version)
|
2017-09-15 08:06:58 +01:00
|
|
|
.to match "Ruby version 1.8.6 is unsupported on 10.12"
|
2017-06-06 13:45:09 +07:00
|
|
|
end
|
2017-02-25 10:19:27 +01:00
|
|
|
end
|