Update tests

This commit is contained in:
Rylan Polster 2024-06-25 00:15:41 -04:00
parent 673b171b10
commit 46cb7f2847
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64
14 changed files with 527 additions and 38 deletions

View File

@ -212,6 +212,82 @@ RSpec.describe Cask::Cask, :cask do
end
end
describe "#artifacts_list" do
subject(:cask) { Cask::CaskLoader.load("many-artifacts") }
it "returns all artifacts when no options are given" do
expected_artifacts = [
{ "uninstall_preflight" => nil },
{ "preflight" => nil },
{ uninstall: [{
rmdir: "#{TEST_TMPDIR}/empty_directory_path",
trash: ["#{TEST_TMPDIR}/foo", "#{TEST_TMPDIR}/bar"],
}] },
{ pkg: ["ManyArtifacts/ManyArtifacts.pkg"] },
{ app: ["ManyArtifacts/ManyArtifacts.app"] },
{ "uninstall_postflight" => nil },
{ "postflight" => nil },
{ zap: [{
rmdir: ["~/Library/Caches/ManyArtifacts", "~/Library/Application Support/ManyArtifacts"],
trash: "~/Library/Logs/ManyArtifacts.log",
}] },
]
expect(cask.artifacts_list).to eq(expected_artifacts)
end
it "skips flight blocks when compact is true" do
expected_artifacts = [
{ uninstall: [{
rmdir: "#{TEST_TMPDIR}/empty_directory_path",
trash: ["#{TEST_TMPDIR}/foo", "#{TEST_TMPDIR}/bar"],
}] },
{ pkg: ["ManyArtifacts/ManyArtifacts.pkg"] },
{ app: ["ManyArtifacts/ManyArtifacts.app"] },
{ zap: [{
rmdir: ["~/Library/Caches/ManyArtifacts", "~/Library/Application Support/ManyArtifacts"],
trash: "~/Library/Logs/ManyArtifacts.log",
}] },
]
expect(cask.artifacts_list(compact: true)).to eq(expected_artifacts)
end
it "returns only uninstall artifacts when uninstall_only is true" do
expected_artifacts = [
{ "uninstall_preflight" => nil },
{ uninstall: [{
rmdir: "#{TEST_TMPDIR}/empty_directory_path",
trash: ["#{TEST_TMPDIR}/foo", "#{TEST_TMPDIR}/bar"],
}] },
{ app: ["ManyArtifacts/ManyArtifacts.app"] },
{ "uninstall_postflight" => nil },
{ zap: [{
rmdir: ["~/Library/Caches/ManyArtifacts", "~/Library/Application Support/ManyArtifacts"],
trash: "~/Library/Logs/ManyArtifacts.log",
}] },
]
expect(cask.artifacts_list(uninstall_only: true)).to eq(expected_artifacts)
end
it "skips flight blocks and returns only uninstall artifacts when compact and uninstall_only are true" do
expected_artifacts = [
{ uninstall: [{
rmdir: "#{TEST_TMPDIR}/empty_directory_path",
trash: ["#{TEST_TMPDIR}/foo", "#{TEST_TMPDIR}/bar"],
}] },
{ app: ["ManyArtifacts/ManyArtifacts.app"] },
{ zap: [{
rmdir: ["~/Library/Caches/ManyArtifacts", "~/Library/Application Support/ManyArtifacts"],
trash: "~/Library/Logs/ManyArtifacts.log",
}] },
]
expect(cask.artifacts_list(compact: true, uninstall_only: true)).to eq(expected_artifacts)
end
end
describe "#to_h" do
let(:expected_json) { (TEST_FIXTURE_DIR/"cask/everything.json").read.strip }

View File

@ -0,0 +1,275 @@
# frozen_string_literal: true
require "cask"
RSpec.describe Cask::Tab, :cask do
matcher :be_installed_as_dependency do
match do |actual|
actual.installed_as_dependency == true
end
end
matcher :be_installed_on_request do
match do |actual|
actual.installed_on_request == true
end
end
matcher :be_loaded_from_api do
match do |actual|
actual.loaded_from_api == true
end
end
matcher :have_uninstall_flight_blocks do
match do |actual|
actual.uninstall_flight_blocks == true
end
end
subject(:tab) do
described_class.new(
"homebrew_version" => HOMEBREW_VERSION,
"loaded_from_api" => false,
"uninstall_flight_blocks" => true,
"installed_as_dependency" => false,
"installed_on_request" => true,
"time" => time,
"runtime_dependencies" => {
"cask" => [{ "full_name" => "bar", "version" => "2.0", "declared_directly" => false }],
},
"source" => {
"path" => CoreCaskTap.instance.path.to_s,
"tap" => CoreCaskTap.instance.to_s,
"tap_git_head" => "8b79aa759500f0ffdf65a23e12950cbe3bf8fe17",
"version" => "1.2.3",
},
"arch" => Hardware::CPU.arch,
"uninstall_artifacts" => [{ "app" => ["Foo.app"] }],
"built_on" => DevelopmentTools.build_system_info,
)
end
let(:time) { Time.now.to_i }
let(:f) { formula { url "foo-1.0" } }
let(:f_tab_path) { f.prefix/"INSTALL_RECEIPT.json" }
let(:f_tab_content) { (TEST_FIXTURE_DIR/"receipt.json").read }
specify "defaults" do
stub_const("HOMEBREW_VERSION", "4.3.7")
tab = described_class.empty
expect(tab.homebrew_version).to eq(HOMEBREW_VERSION)
expect(tab).not_to be_installed_as_dependency
expect(tab).not_to be_installed_on_request
expect(tab).not_to be_loaded_from_api
expect(tab).not_to have_uninstall_flight_blocks
expect(tab.tap).to be_nil
expect(tab.time).to be_nil
expect(tab.runtime_dependencies).to be_nil
expect(tab.source["path"]).to be_nil
end
specify "#runtime_dependencies" do
tab = described_class.new
expect(tab.runtime_dependencies).to be_nil
tab.runtime_dependencies = {}
expect(tab.runtime_dependencies).not_to be_nil
tab.runtime_dependencies = {
"cask" => [{ "full_name" => "bar", "version" => "2.0", "declared_directly" => false }],
}
expect(tab.runtime_dependencies).not_to be_nil
end
specify "::runtime_deps_hash" do
cask = Cask::CaskLoader.load("with-depends-on-everything")
unar = instance_double(Formula, full_name: "unar", version: "1.2", revision: 0, pkg_version: "1.2")
expect(Formulary).to receive(:factory).with("unar", { warn: false }).and_return(unar)
expected_hash = {
arch: [{ type: :intel, bits: 64 }, { type: :arm, bits: 64 }],
cask: [
{ "full_name"=>"local-caffeine", "version"=>"1.2.3", "declared_directly"=>true },
{ "full_name"=>"local-transmission", "version"=>"2.61", "declared_directly"=>true },
],
formula: [
{ "full_name"=>"unar", "version"=>"1.2", "revision"=>0, "pkg_version"=>"1.2", "declared_directly"=>true },
],
macos: MacOSRequirement.new([:el_capitan], comparator: ">="),
}
runtime_deps_hash = described_class.runtime_deps_hash(cask, cask.depends_on)
tab = described_class.new
tab.runtime_dependencies = runtime_deps_hash
expect(tab.runtime_dependencies).to eql(expected_hash)
end
specify "other attributes" do
expect(tab.tap.name).to eq("homebrew/cask")
expect(tab.time).to eq(time)
expect(tab).not_to be_loaded_from_api
expect(tab).to have_uninstall_flight_blocks
expect(tab).not_to be_installed_as_dependency
expect(tab).to be_installed_on_request
expect(tab).not_to be_loaded_from_api
end
describe "::from_file" do
it "parses a cask Tab from a file" do
path = Pathname.new("#{TEST_FIXTURE_DIR}/cask_receipt.json")
tab = described_class.from_file(path)
source_path = "/opt/homebrew/Library/Taps/homebrew/homebrew-cask/Casks/f/foo.rb"
runtime_dependencies = {
"cask" => [
{
"full_name" => "bar",
"version" => "2.0",
"declared_directly" => true,
},
],
"formula" => [
{
"full_name" => "baz",
"version" => "3.0",
"revision" => 0,
"pkg_version" => "3.0",
"declared_directly" => true,
},
],
"macos" => {
">=" => [
"12",
],
},
}
expect(tab).not_to be_loaded_from_api
expect(tab).to have_uninstall_flight_blocks
expect(tab).not_to be_installed_as_dependency
expect(tab).to be_installed_on_request
expect(tab.time).to eq(Time.at(1_719_289_256).to_i)
expect(tab.runtime_dependencies).to eq(runtime_dependencies)
expect(tab.source["path"]).to eq(source_path)
expect(tab.version).to eq("1.2.3")
expect(tab.tap.name).to eq("homebrew/cask")
end
end
describe "::from_file_content" do
it "parses a cask Tab from a file" do
path = Pathname.new("#{TEST_FIXTURE_DIR}/cask_receipt.json")
tab = described_class.from_file_content(path.read, path)
source_path = "/opt/homebrew/Library/Taps/homebrew/homebrew-cask/Casks/f/foo.rb"
runtime_dependencies = {
"cask" => [
{
"full_name" => "bar",
"version" => "2.0",
"declared_directly" => true,
},
],
"formula" => [
{
"full_name" => "baz",
"version" => "3.0",
"revision" => 0,
"pkg_version" => "3.0",
"declared_directly" => true,
},
],
"macos" => {
">=" => [
"12",
],
},
}
expect(tab).not_to be_loaded_from_api
expect(tab).to have_uninstall_flight_blocks
expect(tab).not_to be_installed_as_dependency
expect(tab).to be_installed_on_request
expect(tab.tabfile).to eq(path)
expect(tab.time).to eq(Time.at(1_719_289_256).to_i)
expect(tab.runtime_dependencies).to eq(runtime_dependencies)
expect(tab.source["path"]).to eq(source_path)
expect(tab.version).to eq("1.2.3")
expect(tab.tap.name).to eq("homebrew/cask")
end
it "raises a parse exception message including the Tab filename" do
expect { described_class.from_file_content("''", "cask_receipt.json") }.to raise_error(
JSON::ParserError,
/receipt.json:/,
)
end
end
describe "::create" do
it "creates a cask Tab" do
cask = Cask::CaskLoader.load("local-caffeine")
tab = described_class.create(cask)
expect(tab).not_to be_loaded_from_api
expect(tab).not_to have_uninstall_flight_blocks
expect(tab).not_to be_installed_as_dependency
expect(tab).not_to be_installed_on_request
expect(tab.source).to eq({
"path" => "#{CoreCaskTap.instance.path}/Casks/local-caffeine.rb",
"tap" => CoreCaskTap.instance.name,
"tap_git_head" => nil,
"version" => "1.2.3",
})
expect(tab.runtime_dependencies).to eq({})
expect(tab.uninstall_artifacts).to eq([{ app: ["Caffeine.app"] }])
end
end
describe "::for_cask" do
let(:cask) { Cask::CaskLoader.load("local-transmission") }
let(:cask_tab_path) { cask.metadata_main_container_path/AbstractTab::FILENAME }
let(:cask_tab_content) { (TEST_FIXTURE_DIR/"cask_receipt.json").read }
it "creates a Tab for a given cask" do
tab = described_class.for_cask(cask)
expect(tab.source["path"]).to eq(cask.sourcefile_path.to_s)
end
it "creates a Tab for a given cask with existing Tab" do
cask_tab_path.dirname.mkpath
cask_tab_path.write cask_tab_content
tab = described_class.for_cask(cask)
expect(tab.tabfile).to eq(cask_tab_path)
end
it "can create a Tab for a non-existent cask" do
cask_tab_path.dirname.mkpath
tab = described_class.for_cask(cask)
expect(tab.tabfile).to be_nil
end
end
specify "#to_json" do
json_tab = described_class.new(JSON.parse(tab.to_json))
expect(json_tab.homebrew_version).to eq(tab.homebrew_version)
expect(json_tab.loaded_from_api).to eq(tab.loaded_from_api)
expect(json_tab.uninstall_flight_blocks).to eq(tab.uninstall_flight_blocks)
expect(json_tab.installed_as_dependency).to eq(tab.installed_as_dependency)
expect(json_tab.installed_on_request).to eq(tab.installed_on_request)
expect(json_tab.time).to eq(tab.time)
expect(json_tab.runtime_dependencies).to eq(tab.runtime_dependencies)
expect(json_tab.source["path"]).to eq(tab.source["path"])
expect(json_tab.tap).to eq(tab.tap)
expect(json_tab.source["tap_git_head"]).to eq(tab.source["tap_git_head"])
expect(json_tab.version).to eq(tab.version)
expect(json_tab.arch).to eq(tab.arch.to_s)
expect(json_tab.uninstall_artifacts).to eq(tab.uninstall_artifacts)
expect(json_tab.built_on["os"]).to eq(tab.built_on["os"])
end
end

View File

@ -32,7 +32,7 @@ RSpec.describe Homebrew::Cmd::Deps do
# Mock `Formula#any_version_installed?` by creating the tab in a plausible keg directory
keg_dir = HOMEBREW_CELLAR/"installed"/"1.0"
keg_dir.mkpath
touch keg_dir/Tab::FILENAME
touch keg_dir/AbstractTab::FILENAME
expect { brew "deps", "baz", "--include-test", "--missing", "--skip-recommended" }
.to be_a_success

View File

@ -33,7 +33,7 @@ RSpec.describe Homebrew::Cmd::Untap do
keg_path = HOMEBREW_CELLAR/name/"1.2.3"
keg_path.mkpath
tab_path = keg_path/Tab::FILENAME
tab_path = keg_path/AbstractTab::FILENAME
tab_path.write <<~JSON
{
"source": {

View File

@ -36,7 +36,7 @@ RSpec.describe Homebrew::Cmd::Uses do
%w[foo installed].each do |formula_name|
keg_dir = HOMEBREW_CELLAR/formula_name/"1.0"
keg_dir.mkpath
touch keg_dir/Tab::FILENAME
touch keg_dir/AbstractTab::FILENAME
end
expect { brew "uses", "foo", "--eval-all", "--include-optional", "--missing", "--recursive" }

View File

@ -264,7 +264,7 @@ RSpec.describe Formula do
prefix = HOMEBREW_CELLAR/f.name/"0.1"
prefix.mkpath
FileUtils.touch prefix/Tab::FILENAME
FileUtils.touch prefix/AbstractTab::FILENAME
expect(f).to have_any_version_installed
end
@ -279,7 +279,7 @@ RSpec.describe Formula do
oldname_prefix.mkpath
oldname_tab = Tab.empty
oldname_tab.tabfile = oldname_prefix/Tab::FILENAME
oldname_tab.tabfile = oldname_prefix/AbstractTab::FILENAME
oldname_tab.write
expect(f).not_to need_migration
@ -346,7 +346,7 @@ RSpec.describe Formula do
head_prefix.mkpath
tab = Tab.empty
tab.tabfile = head_prefix/Tab::FILENAME
tab.tabfile = head_prefix/AbstractTab::FILENAME
tab.source["versions"] = { "stable" => "1.0" }
tab.write
@ -378,7 +378,7 @@ RSpec.describe Formula do
prefix.mkpath
tab = Tab.empty
tab.tabfile = prefix/Tab::FILENAME
tab.tabfile = prefix/AbstractTab::FILENAME
tab.source_modified_time = stamp
tab.write
end
@ -1106,7 +1106,7 @@ RSpec.describe Formula do
prefix = f.prefix(version)
prefix.mkpath
tab = Tab.empty
tab.tabfile = prefix/Tab::FILENAME
tab.tabfile = prefix/AbstractTab::FILENAME
tab.source_modified_time = 1
tab.write
end
@ -1340,7 +1340,7 @@ RSpec.describe Formula do
def setup_tab_for_prefix(prefix, options = {})
prefix.mkpath
tab = Tab.empty
tab.tabfile = prefix/Tab::FILENAME
tab.tabfile = prefix/AbstractTab::FILENAME
tab.source["path"] = options[:path].to_s if options[:path]
tab.source["tap"] = options[:tap] if options[:tap]
tab.source["versions"] = options[:versions] if options[:versions]

View File

@ -61,7 +61,7 @@ RSpec.describe InstalledDependents do
def tab_dependencies(keg, deps, homebrew_version: "1.1.6")
alter_tab(keg) do |tab|
tab.homebrew_version = homebrew_version
tab.tabfile = keg/Tab::FILENAME
tab.tabfile = keg/AbstractTab::FILENAME
tab.runtime_dependencies = deps
end
end

View File

@ -0,0 +1,32 @@
cask "many-artifacts" do
version "1.2.3"
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
url "file://#{TEST_FIXTURE_DIR}/cask/ManyArtifacts.zip"
homepage "https://brew.sh/many-artifacts"
app "ManyArtifacts/ManyArtifacts.app"
pkg "ManyArtifacts/ManyArtifacts.pkg"
preflight do
# do nothing
end
postflight do
# do nothing
end
uninstall_preflight do
# do nothing
end
uninstall_postflight do
# do nothing
end
uninstall trash: ["#{TEST_TMPDIR}/foo", "#{TEST_TMPDIR}/bar"],
rmdir: "#{TEST_TMPDIR}/empty_directory_path"
zap trash: "~/Library/Logs/ManyArtifacts.log",
rmdir: ["~/Library/Caches/ManyArtifacts", "~/Library/Application Support/ManyArtifacts"]
end

View File

@ -0,0 +1,15 @@
cask "with-depends-on-everything" do
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
homepage "https://brew.sh/with-depends-on-everything"
depends_on arch: [:intel, :arm64]
depends_on cask: "local-caffeine"
depends_on cask: "local-transmission"
depends_on formula: "unar"
depends_on macos: ">= :el_capitan"
app "Caffeine.app"
end

View File

@ -0,0 +1,53 @@
{
"homebrew_version": "4.3.7",
"loaded_from_api": false,
"uninstall_flight_blocks": true,
"installed_as_dependency": false,
"installed_on_request": true,
"time": 1719289256,
"runtime_dependencies": {
"cask": [
{
"full_name": "bar",
"version": "2.0",
"declared_directly": true
}
],
"formula": [
{
"full_name": "baz",
"version": "3.0",
"revision": 0,
"pkg_version": "3.0",
"declared_directly": true
}
],
"macos": {
">=": [
"12"
]
}
},
"source": {
"path": "/opt/homebrew/Library/Taps/homebrew/homebrew-cask/Casks/f/foo.rb",
"tap": "homebrew/cask",
"tap_git_head": "8b79aa759500f0ffdf65a23e12950cbe3bf8fe17",
"version": "1.2.3"
},
"arch": "arm64",
"uninstall_artifacts": [
{
"app": [
"Foo.app"
]
}
],
"built_on": {
"os": "Macintosh",
"os_version": "macOS 14",
"cpu_family": "arm_firestorm_icestorm",
"xcode": "15.4",
"clt": "15.3.0.0.1.1708646388",
"preferred_perl": "5.34"
}
}

View File

@ -10,6 +10,9 @@
],
"built_as_bottle": false,
"poured_from_bottle": true,
"loaded_from_api": false,
"installed_as_dependency": false,
"installed_on_request": true,
"changed_files": [
"INSTALL_RECEIPT.json",
"bin/foo"
@ -27,12 +30,12 @@
}
],
"source": {
"path": "/usr/local/Library/Taps/homebrew/homebrew-core/Formula/foo.rb",
"tap": "homebrew/core",
"spec": "stable",
"versions": {
"stable": "2.14",
"head": "HEAD-0000000"
}
"path": "/usr/local/Library/Taps/homebrew/homebrew-core/Formula/foo.rb",
"tap": "homebrew/core",
"spec": "stable",
"versions": {
"stable": "2.14",
"head": "HEAD-0000000"
}
}
}

View File

@ -191,7 +191,7 @@ RSpec.shared_context "integration test" do # rubocop:disable RSpec/ContextWordin
keg.mkpath
tab = Tab.for_name(name)
tab.tabfile ||= keg/Tab::FILENAME
tab.tabfile ||= keg/AbstractTab::FILENAME
tab_attributes.each do |key, value|
tab.instance_variable_set(:"@#{key}", value)
end

View File

@ -18,20 +18,40 @@ RSpec.describe Tab do
end
end
matcher :be_installed_as_dependency do
match do |actual|
actual.installed_as_dependency == true
end
end
matcher :be_installed_on_request do
match do |actual|
actual.installed_on_request == true
end
end
matcher :be_loaded_from_api do
match do |actual|
actual.loaded_from_api == true
end
end
subject(:tab) do
described_class.new(
"homebrew_version" => HOMEBREW_VERSION,
"used_options" => used_options.as_flags,
"unused_options" => unused_options.as_flags,
"built_as_bottle" => false,
"poured_from_bottle" => true,
"changed_files" => [],
"time" => time,
"source_modified_time" => 0,
"compiler" => "clang",
"stdlib" => "libcxx",
"runtime_dependencies" => [],
"source" => {
"homebrew_version" => HOMEBREW_VERSION,
"used_options" => used_options.as_flags,
"unused_options" => unused_options.as_flags,
"built_as_bottle" => false,
"poured_from_bottle" => true,
"installed_as_dependency" => false,
"installed_on_request" => true,
"changed_files" => [],
"time" => time,
"source_modified_time" => 0,
"compiler" => "clang",
"stdlib" => "libcxx",
"runtime_dependencies" => [],
"source" => {
"tap" => CoreTap.instance.to_s,
"path" => CoreTap.instance.path.to_s,
"spec" => "stable",
@ -40,8 +60,8 @@ RSpec.describe Tab do
"head" => "HEAD-1111111",
},
},
"arch" => Hardware::CPU.arch,
"built_on" => DevelopmentTools.build_system_info,
"arch" => Hardware::CPU.arch,
"built_on" => DevelopmentTools.build_system_info,
)
end
@ -65,6 +85,9 @@ RSpec.describe Tab do
expect(tab.changed_files).to be_nil
expect(tab).not_to be_built_as_bottle
expect(tab).not_to be_poured_from_bottle
expect(tab).not_to be_installed_as_dependency
expect(tab).not_to be_installed_on_request
expect(tab).not_to be_loaded_from_api
expect(tab).to be_stable
expect(tab).not_to be_head
expect(tab.tap).to be_nil
@ -156,10 +179,13 @@ RSpec.describe Tab do
expect(tab.time).to eq(time)
expect(tab).not_to be_built_as_bottle
expect(tab).to be_poured_from_bottle
expect(tab).not_to be_installed_as_dependency
expect(tab).to be_installed_on_request
expect(tab).not_to be_loaded_from_api
end
describe "::from_file" do
it "parses a Tab from a file" do
it "parses a formula Tab from a file" do
path = Pathname.new("#{TEST_FIXTURE_DIR}/receipt.json")
tab = described_class.from_file(path)
source_path = "/usr/local/Library/Taps/homebrew/homebrew-core/Formula/foo.rb"
@ -171,6 +197,9 @@ RSpec.describe Tab do
expect(tab.changed_files).to eq(changed_files)
expect(tab).not_to be_built_as_bottle
expect(tab).to be_poured_from_bottle
expect(tab).not_to be_installed_as_dependency
expect(tab).to be_installed_on_request
expect(tab).not_to be_loaded_from_api
expect(tab).to be_stable
expect(tab).not_to be_head
expect(tab.tap.name).to eq("homebrew/core")
@ -186,7 +215,7 @@ RSpec.describe Tab do
end
describe "::from_file_content" do
it "parses a Tab from a file" do
it "parses a formula Tab from a file" do
path = Pathname.new("#{TEST_FIXTURE_DIR}/receipt.json")
tab = described_class.from_file_content(path.read, path)
source_path = "/usr/local/Library/Taps/homebrew/homebrew-core/Formula/foo.rb"
@ -198,6 +227,9 @@ RSpec.describe Tab do
expect(tab.changed_files).to eq(changed_files)
expect(tab).not_to be_built_as_bottle
expect(tab).to be_poured_from_bottle
expect(tab).not_to be_installed_as_dependency
expect(tab).to be_installed_on_request
expect(tab).not_to be_loaded_from_api
expect(tab).to be_stable
expect(tab).not_to be_head
expect(tab.tap.name).to eq("homebrew/core")
@ -211,7 +243,7 @@ RSpec.describe Tab do
expect(tab.source["path"]).to eq(source_path)
end
it "can parse an old Tab file" do
it "can parse an old formula Tab file" do
path = Pathname.new("#{TEST_FIXTURE_DIR}/receipt_old.json")
tab = described_class.from_file_content(path.read, path)
@ -219,6 +251,9 @@ RSpec.describe Tab do
expect(tab.unused_options.sort).to eq(unused_options.sort)
expect(tab).not_to be_built_as_bottle
expect(tab).to be_poured_from_bottle
expect(tab).not_to be_installed_as_dependency
expect(tab).not_to be_installed_on_request
expect(tab).not_to be_loaded_from_api
expect(tab).to be_stable
expect(tab).not_to be_head
expect(tab.tap.name).to eq("homebrew/core")
@ -238,7 +273,7 @@ RSpec.describe Tab do
end
describe "::create" do
it "creates a Tab" do
it "creates a formula Tab" do
# < 1.1.7 runtime dependencies were wrong so are ignored
stub_const("HOMEBREW_VERSION", "1.1.7")
@ -277,7 +312,7 @@ RSpec.describe Tab do
expect(tab.source["path"]).to eq(f.path.to_s)
end
it "can create a Tab from an alias" do
it "can create a formula Tab from an alias" do
alias_path = CoreTap.instance.alias_dir/"bar"
f = formula(alias_path:) { url "foo-1.0" }
compiler = DevelopmentTools.default_compiler

View File

@ -33,7 +33,7 @@ RSpec.describe Homebrew::Uninstall do
tab = Tab.empty
tab.homebrew_version = "1.1.6"
tab.tabfile = dependent_formula.latest_installed_prefix/Tab::FILENAME
tab.tabfile = dependent_formula.latest_installed_prefix/AbstractTab::FILENAME
tab.runtime_dependencies = [
{ "full_name" => "dependency", "version" => "1" },
]