repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/update-perl-resources_spec.rb | Library/Homebrew/test/dev-cmd/update-perl-resources_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/update-perl-resources"
RSpec.describe Homebrew::DevCmd::UpdatePerlResources do
it_behaves_like "parseable arguments"
end
| ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/audit_spec.rb | Library/Homebrew/test/dev-cmd/audit_spec.rb | # frozen_string_literal: true
require "dev-cmd/audit"
require "cmd/shared_examples/args_parse"
RSpec.describe Homebrew::DevCmd::Audit do
it_behaves_like "parseable arguments"
end
| ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/bump-revision_spec.rb | Library/Homebrew/test/dev-cmd/bump-revision_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/bump-revision"
RSpec.describe Homebrew::DevCmd::BumpRevision do
it_behaves_like "parseable arguments"
end
| ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/extract_spec.rb | Library/Homebrew/test/dev-cmd/extract_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/extract"
RSpec.describe Homebrew::DevCmd::Extract do
it_behaves_like "parseable arguments"
context "when extracting a formula" do
let!(:target) do
path = HOMEBREW_TAP_DIRECTORY/"homebrew/homebrew-foo"
(path/"F... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/vendor-gems_spec.rb | Library/Homebrew/test/dev-cmd/vendor-gems_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/vendor-gems"
RSpec.describe Homebrew::DevCmd::VendorGems do
it_behaves_like "parseable arguments"
end
| ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb | Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb | # frozen_string_literal: true
require "dev-cmd/determine-test-runners"
require "cmd/shared_examples/args_parse"
RSpec.describe Homebrew::DevCmd::DetermineTestRunners do
def get_runners(file)
runner_line = File.open(file).first
json_text = runner_line[/runners=(.*)/, 1]
runner_hash = JSON.parse(json_text... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/pr-publish_spec.rb | Library/Homebrew/test/dev-cmd/pr-publish_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/pr-publish"
RSpec.describe Homebrew::DevCmd::PrPublish do
it_behaves_like "parseable arguments"
end
| ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/formula-analytics_spec.rb | Library/Homebrew/test/dev-cmd/formula-analytics_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/formula-analytics"
RSpec.describe Homebrew::DevCmd::FormulaAnalytics do
it_behaves_like "parseable arguments"
end
| ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/edit_spec.rb | Library/Homebrew/test/dev-cmd/edit_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/edit"
RSpec.describe Homebrew::DevCmd::Edit do
it_behaves_like "parseable arguments"
it "opens a given Formula in an editor", :integration_test do
HOMEBREW_REPOSITORY.cd do
system "git", "init"
end
setup_te... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/unbottled_spec.rb | Library/Homebrew/test/dev-cmd/unbottled_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/unbottled"
RSpec.describe Homebrew::DevCmd::Unbottled do
it_behaves_like "parseable arguments"
end
| ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/pr-upload_spec.rb | Library/Homebrew/test/dev-cmd/pr-upload_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/pr-upload"
RSpec.describe Homebrew::DevCmd::PrUpload do
it_behaves_like "parseable arguments"
end
| ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/release_spec.rb | Library/Homebrew/test/dev-cmd/release_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/release"
RSpec.describe Homebrew::DevCmd::Release do
it_behaves_like "parseable arguments"
end
| ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/lgtm_spec.rb | Library/Homebrew/test/dev-cmd/lgtm_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/lgtm"
RSpec.describe Homebrew::DevCmd::Lgtm do
it_behaves_like "parseable arguments"
end
| ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/cat_spec.rb | Library/Homebrew/test/dev-cmd/cat_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/cat"
RSpec.describe Homebrew::DevCmd::Cat do
it_behaves_like "parseable arguments"
it "prints the content of a given Formula", :integration_test do
formula_file = setup_test_formula "testball"
content = formula_file.r... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/bump_spec.rb | Library/Homebrew/test/dev-cmd/bump_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/bump"
RSpec.describe Homebrew::DevCmd::Bump do
it_behaves_like "parseable arguments"
describe "formula", :integration_test, :needs_homebrew_curl, :needs_network do
it "returns no data and prints a message for HEAD-only fo... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/install-bundler-gems_spec.rb | Library/Homebrew/test/dev-cmd/install-bundler-gems_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/install-bundler-gems"
RSpec.describe Homebrew::DevCmd::InstallBundlerGems do
it_behaves_like "parseable arguments"
end
| ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/dev-cmd/test_spec.rb | Library/Homebrew/test/dev-cmd/test_spec.rb | # frozen_string_literal: true
require "cmd/shared_examples/args_parse"
require "dev-cmd/test"
require "sandbox"
RSpec.describe Homebrew::DevCmd::Test do
it_behaves_like "parseable arguments"
it "tests a given Formula", :integration_test do
install_test_formula "testball", <<~'RUBY'
test do
asse... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/hardware/cpu_spec.rb | Library/Homebrew/test/hardware/cpu_spec.rb | # frozen_string_literal: true
require "hardware"
RSpec.describe Hardware::CPU do
describe "::type" do
let(:cpu_types) do
[
:arm,
:intel,
:ppc,
:dunno,
]
end
it "returns the current CPU's type as a symbol, or :dunno if it cannot be detected" do
expect(cp... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/macos_spec.rb | Library/Homebrew/test/cask/macos_spec.rb | # frozen_string_literal: true
RSpec.describe MacOS, :cask do
it "says '/' is undeletable" do
expect(described_class).to be_undeletable(
"/",
)
expect(described_class).to be_undeletable(
"/.",
)
expect(described_class).to be_undeletable(
"/usr/local/Library/Taps/../../../..",
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/cask_spec.rb | Library/Homebrew/test/cask/cask_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Cask, :cask do
let(:cask) { described_class.new("versioned-cask") }
context "when multiple versions are installed" do
describe "#installed_version" do
context "when there are duplicate versions" do
it "uses the last unique version" do
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/tab_spec.rb | Library/Homebrew/test/cask/tab_spec.rb | # 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... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/dsl_spec.rb | Library/Homebrew/test/cask/dsl_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::DSL, :cask, :no_api do
let(:cask) { Cask::CaskLoader.load(token) }
let(:token) { "basic-cask" }
describe "stanzas" do
it "lets you set url, homepage and version" do
expect(cask.url.to_s).to eq("https://brew.sh/TestCask-1.2.3.dmg")
expect(cask.ho... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/cask_loader_spec.rb | Library/Homebrew/test/cask/cask_loader_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::CaskLoader, :cask do
describe "::for" do
let(:tap) { CoreCaskTap.instance }
context "when a cask is renamed" do
let(:old_token) { "version-newest" }
let(:new_token) { "version-latest" }
let(:api_casks) do
[old_token, new_token].to... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/utils_spec.rb | Library/Homebrew/test/cask/utils_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Utils do
let(:command) { NeverSudoSystemCommand }
let(:dir) { mktmpdir }
let(:path) { dir/"a/b/c" }
let(:link) { dir/"link" }
describe "::gain_permissions_mkpath" do
it "creates a directory" do
expect(path).not_to exist
described_class.gain_... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/reinstall_spec.rb | Library/Homebrew/test/cask/reinstall_spec.rb | # frozen_string_literal: true
require "cask/installer"
require "cask/reinstall"
RSpec.describe Cask::Reinstall, :cask do
it "displays the reinstallation progress" do
caffeine = Cask::CaskLoader.load(cask_path("local-caffeine"))
Cask::Installer.new(caffeine).install
output = Regexp.new <<~EOS
==>... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/audit_spec.rb | Library/Homebrew/test/cask/audit_spec.rb | # frozen_string_literal: true
require "cask/audit"
RSpec.describe Cask::Audit, :cask do
def include_msg?(problems, msg)
if msg.is_a?(Regexp)
Array(problems).any? { |problem| msg.match?(problem[:message]) }
else
Array(problems).any? { |problem| problem[:message] == msg }
end
end
def pass... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | true |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/upgrade_spec.rb | Library/Homebrew/test/cask/upgrade_spec.rb | # frozen_string_literal: true
require "cask/upgrade"
RSpec.describe Cask::Upgrade, :cask do
let(:version_latest_paths) do
[
version_latest.config.appdir.join("Caffeine Mini.app"),
version_latest.config.appdir.join("Caffeine Pro.app"),
]
end
let(:version_latest) { Cask::CaskLoader.load("versi... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/list_spec.rb | Library/Homebrew/test/cask/list_spec.rb | # frozen_string_literal: true
require "cask/list"
RSpec.describe Cask::List, :cask do
it "lists the installed Casks in a pretty fashion" do
casks = %w[local-caffeine local-transmission].map { |c| Cask::CaskLoader.load(c) }
casks.each do |c|
InstallHelper.install_with_caskfile(c)
end
expect d... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/denylist_spec.rb | Library/Homebrew/test/cask/denylist_spec.rb | # frozen_string_literal: true
require "cask/denylist"
RSpec.describe Cask::Denylist, :cask do
describe "::reason" do
matcher :disallow do |name|
match do |expected|
expected.reason(name)
end
end
specify(:aggregate_failures) do
expect(subject).not_to disallow("adobe-air") # rub... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/pkg_spec.rb | Library/Homebrew/test/cask/pkg_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Pkg, :cask do
describe "#uninstall" do
let(:fake_system_command) { NeverSudoSystemCommand }
let(:empty_response) do
instance_double(
SystemCommand::Result,
stdout: "",
plist: { "volume" => "/", "install-location" => "", "paths"... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/depends_on_spec.rb | Library/Homebrew/test/cask/depends_on_spec.rb | # frozen_string_literal: true
# TODO: this test should be named after the corresponding class, once
# that class is abstracted from installer.rb
# rubocop:disable RSpec/DescribeClass
RSpec.describe "Satisfy Dependencies and Requirements", :cask do
# rubocop:enable RSpec/DescribeClass
subject(:install) do
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/download_spec.rb | Library/Homebrew/test/cask/download_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Download, :cask do
describe "#download_name" do
subject(:download_name) { described_class.new(cask).send(:download_name) }
let(:download) { described_class.new(cask) }
let(:token) { "example-cask" }
let(:full_token) { token }
let(:url) { instanc... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/uninstall_spec.rb | Library/Homebrew/test/cask/uninstall_spec.rb | # frozen_string_literal: true
require "cask/uninstall"
RSpec.describe Cask::Uninstall, :cask do
describe ".uninstall_casks" do
it "displays the uninstallation progress" do
caffeine = Cask::CaskLoader.load(cask_path("local-caffeine"))
Cask::Installer.new(caffeine).install
output = Regexp.new ... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/installer_spec.rb | Library/Homebrew/test/cask/installer_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Installer, :cask do
describe "install" do
it "downloads and installs a nice fresh Cask" do
caffeine = Cask::CaskLoader.load(cask_path("local-caffeine"))
described_class.new(caffeine).install
expect(Cask::Caskroom.path.join("local-caffeine", c... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/config_spec.rb | Library/Homebrew/test/cask/config_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Config, :cask do
subject(:config) { described_class.new }
describe "::from_json" do
it "deserializes a configuration in JSON format" do
config = described_class.from_json <<~EOS
{
"default": {
"appdir": "/path/to/apps"
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/info_spec.rb | Library/Homebrew/test/cask/info_spec.rb | # frozen_string_literal: true
require "utils"
require "cask/info"
RSpec.describe Cask::Info, :cask do
include Utils::Output::Mixin
let(:args) { instance_double(Homebrew::Cmd::Info::Args) }
def uninstalled(string)
"#{Tty.bold}#{string} #{Formatter.error("✘")}#{Tty.reset}"
end
def installed(string)
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/dsl/uninstall_preflight_spec.rb | Library/Homebrew/test/cask/dsl/uninstall_preflight_spec.rb | # frozen_string_literal: true
require "test/cask/dsl/shared_examples/base"
require "test/cask/dsl/shared_examples/staged"
RSpec.describe Cask::DSL::UninstallPreflight, :cask do
let(:cask) { Cask::CaskLoader.load(cask_path("basic-cask")) }
let(:fake_system_command) { class_double(SystemCommand) }
let(:dsl) { des... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/dsl/version_spec.rb | Library/Homebrew/test/cask/dsl/version_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::DSL::Version, :cask do
shared_examples "expectations hash" do |input_name, expectations|
expectations.each do |input_value, expected_output|
context "when #{input_name} is #{input_value.inspect}" do
let(input_name.to_sym) { input_value }
i... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/dsl/caveats_spec.rb | Library/Homebrew/test/cask/dsl/caveats_spec.rb | # frozen_string_literal: true
require "test/cask/dsl/shared_examples/base"
RSpec.describe Cask::DSL::Caveats, :cask do
subject(:caveats) { described_class.new(cask) }
let(:cask) { Cask::CaskLoader.load(cask_path("basic-cask")) }
let(:dsl) { caveats }
it_behaves_like Cask::DSL::Base
# TODO: add tests for ... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/dsl/postflight_spec.rb | Library/Homebrew/test/cask/dsl/postflight_spec.rb | # frozen_string_literal: true
require "test/cask/dsl/shared_examples/base"
require "test/cask/dsl/shared_examples/staged"
RSpec.describe Cask::DSL::Postflight, :cask do
let(:cask) { Cask::CaskLoader.load(cask_path("basic-cask")) }
let(:fake_system_command) { class_double(SystemCommand) }
let(:dsl) { described_c... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/dsl/uninstall_postflight_spec.rb | Library/Homebrew/test/cask/dsl/uninstall_postflight_spec.rb | # frozen_string_literal: true
require "test/cask/dsl/shared_examples/base"
RSpec.describe Cask::DSL::UninstallPostflight, :cask do
let(:cask) { Cask::CaskLoader.load(cask_path("basic-cask")) }
let(:dsl) { described_class.new(cask, class_double(SystemCommand)) }
it_behaves_like Cask::DSL::Base
end
| ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/dsl/rename_spec.rb | Library/Homebrew/test/cask/dsl/rename_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::DSL::Rename do
subject(:rename) { described_class.new(from, to) }
let(:from) { "Source File*.pkg" }
let(:to) { "Target File.pkg" }
describe "#initialize" do
it "sets the from and to attributes" do
expect(rename.from).to eq("Source File*.pkg")
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/dsl/preflight_spec.rb | Library/Homebrew/test/cask/dsl/preflight_spec.rb | # frozen_string_literal: true
require "test/cask/dsl/shared_examples/base"
require "test/cask/dsl/shared_examples/staged"
RSpec.describe Cask::DSL::Preflight, :cask do
let(:cask) { Cask::CaskLoader.load(cask_path("basic-cask")) }
let(:fake_system_command) { class_double(SystemCommand) }
let(:dsl) { described_cl... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/dsl/container_spec.rb | Library/Homebrew/test/cask/dsl/container_spec.rb | # frozen_string_literal: true
require "test/cask/dsl/shared_examples/base"
RSpec.describe Cask::DSL::Container do
subject(:container) { described_class.new(**params) }
describe "#pairs" do
let(:params) { { nested: "NestedApp.dmg" } }
it "returns the attributes as a hash" do
expect(container.pairs)... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/dsl/shared_examples/staged.rb | Library/Homebrew/test/cask/dsl/shared_examples/staged.rb | # frozen_string_literal: true
require "cask/staged"
RSpec.shared_examples Cask::Staged do
let(:existing_path) { Pathname("/path/to/file/that/exists") }
let(:non_existent_path) { Pathname("/path/to/file/that/does/not/exist") }
before do
allow(existing_path).to receive_messages(exist?: true, expand_path: exi... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/dsl/shared_examples/base.rb | Library/Homebrew/test/cask/dsl/shared_examples/base.rb | # frozen_string_literal: true
require "cask/dsl/base"
RSpec.shared_examples Cask::DSL::Base do
it "supports the token method" do
expect(dsl.token).to eq(cask.token)
end
it "supports the version method" do
expect(dsl.version).to eq(cask.version)
end
it "supports the caskroom_path method" do
exp... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/zap_spec.rb | Library/Homebrew/test/cask/artifact/zap_spec.rb | # frozen_string_literal: true
require_relative "shared_examples/uninstall_zap"
RSpec.describe Cask::Artifact::Zap, :cask do
describe "#zap_phase" do
include_examples "#uninstall_phase or #zap_phase"
context "when using :rmdir" do
subject(:artifact) { cask.artifacts.find { |a| a.is_a?(described_class)... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/bashcompletion_spec.rb | Library/Homebrew/test/cask/artifact/bashcompletion_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::BashCompletion, :cask do
let(:cask) { Cask::CaskLoader.load(cask_token) }
context "with install" do
let(:install_phase) do
lambda do
cask.artifacts.select { |a| a.is_a?(described_class) }.each do |artifact|
artifact.install_p... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb | Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::App, :cask do
describe "multiple apps" do
let(:cask) { Cask::CaskLoader.load(cask_path("with-two-apps-correct")) }
let(:install_phase) do
cask.artifacts.select { |a| a.is_a?(described_class) }.each do |artifact|
artifact.install_phas... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb | Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::Zap, :cask do
let(:cask) { Cask::CaskLoader.load(cask_path("with-installable")) }
let(:zap_artifact) do
cask.artifacts.find { |a| a.is_a?(described_class) }
end
before do
InstallHelper.install_without_artifacts(cask)
end
describe "#uni... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/symlinked_spec.rb | Library/Homebrew/test/cask/artifact/symlinked_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::Symlinked, :cask do
# Test the formula conflict detection functionality that applies to all symlinked artifacts
describe "#conflicting_formula" do
let(:cask) do
Cask::CaskLoader.load(cask_path("with-binary")).tap do |cask|
InstallHelper... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb | Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::Artifact, :cask do
let(:cask) { Cask::CaskLoader.load(cask_path("with-generic-artifact")) }
let(:install_phase) do
lambda do
cask.artifacts.select { |a| a.is_a?(described_class) }.each do |artifact|
artifact.install_phase(command: Neve... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/preflight_block_spec.rb | Library/Homebrew/test/cask/artifact/preflight_block_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::PreflightBlock, :cask do
describe "install_phase" do
it "calls the specified block before installing, passing a Cask mini-dsl" do
called = false
yielded_arg = nil
cask = Cask::Cask.new("with-preflight") do
preflight do |c|
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/fishlcompletion_spec.rb | Library/Homebrew/test/cask/artifact/fishlcompletion_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::FishCompletion, :cask do
let(:cask) { Cask::CaskLoader.load(cask_token) }
context "with install" do
let(:install_phase) do
lambda do
cask.artifacts.select { |a| a.is_a?(described_class) }.each do |artifact|
artifact.install_p... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/postflight_block_spec.rb | Library/Homebrew/test/cask/artifact/postflight_block_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::PostflightBlock, :cask do
describe "install_phase" do
it "calls the specified block after installing, passing a Cask mini-dsl" do
called = false
yielded_arg = nil
cask = Cask::Cask.new("with-postflight") do
postflight do |c|
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/binary_spec.rb | Library/Homebrew/test/cask/artifact/binary_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::Binary, :cask do
let(:cask) do
Cask::CaskLoader.load(cask_path("with-binary")).tap do |cask|
InstallHelper.install_without_artifacts(cask)
end
end
let(:artifacts) { cask.artifacts.select { |a| a.is_a?(described_class) } }
let(:binarydir... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/relocated_spec.rb | Library/Homebrew/test/cask/artifact/relocated_spec.rb | # frozen_string_literal: true
require "cask/artifact/relocated"
RSpec.describe Cask::Artifact::Relocated, :cask do
let(:cask) do
Cask::Cask.new("test-cask") do
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
homepage "https://brew.sh/"
version "1.0"
sha256 "67cdb8a02803ef37fdbf7e0be20... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/pkg_spec.rb | Library/Homebrew/test/cask/artifact/pkg_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::Pkg, :cask do
let(:cask) { Cask::CaskLoader.load(cask_path("with-installable")) }
let(:fake_system_command) { class_double(SystemCommand) }
before do
InstallHelper.install_without_artifacts(cask)
end
describe "install_phase" do
it "runs t... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/suite_spec.rb | Library/Homebrew/test/cask/artifact/suite_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::Suite, :cask do
let(:cask) { Cask::CaskLoader.load(cask_path("with-suite")) }
let(:install_phase) do
lambda do
cask.artifacts.select { |a| a.is_a?(described_class) }.each do |artifact|
artifact.install_phase(command: NeverSudoSystemCom... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/abstract_artifact_spec.rb | Library/Homebrew/test/cask/artifact/abstract_artifact_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::AbstractArtifact, :cask do
describe ".read_script_arguments" do
let(:stanza) { :installer }
it "accepts a string and uses it as the executable" do
arguments = "something"
expect(described_class.read_script_arguments(arguments, stanza)... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/app_spec.rb | Library/Homebrew/test/cask/artifact/app_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::App, :cask do
let(:cask) { Cask::CaskLoader.load(cask_path("local-caffeine")) }
let(:command) { NeverSudoSystemCommand }
let(:adopt) { false }
let(:force) { false }
let(:auto_updates) { false }
let(:app) { cask.artifacts.find { |a| a.is_a?(descri... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/manpage_spec.rb | Library/Homebrew/test/cask/artifact/manpage_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::Manpage, :cask do
let(:cask) { Cask::CaskLoader.load(cask_token) }
context "without section" do
let(:cask_token) { "invalid-manpage-no-section" }
it "fails to load a cask without section", :no_api do
expect { cask }.to raise_error(Cask::C... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/alt_target_spec.rb | Library/Homebrew/test/cask/artifact/alt_target_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::App, :cask do
describe "activate to alternate target" do
let(:cask) { Cask::CaskLoader.load(cask_path("with-alt-target")) }
let(:install_phase) do
cask.artifacts.select { |a| a.is_a?(described_class) }.each do |artifact|
artifact.ins... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/zshcompletion_spec.rb | Library/Homebrew/test/cask/artifact/zshcompletion_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::ZshCompletion, :cask do
let(:cask) { Cask::CaskLoader.load(cask_token) }
context "with install" do
let(:install_phase) do
lambda do
cask.artifacts.select { |a| a.is_a?(described_class) }.each do |artifact|
artifact.install_ph... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/uninstall_spec.rb | Library/Homebrew/test/cask/artifact/uninstall_spec.rb | # frozen_string_literal: true
require_relative "shared_examples/uninstall_zap"
RSpec.describe Cask::Artifact::Uninstall, :cask do
describe "#uninstall_phase" do
let(:fake_system_command) { NeverSudoSystemCommand }
include_examples "#uninstall_phase or #zap_phase"
describe "upgrade/reinstall opt-in uni... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/installer_spec.rb | Library/Homebrew/test/cask/artifact/installer_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::Artifact::Installer, :cask do
subject(:installer) { described_class.new(cask, **args) }
let(:staged_path) { mktmpdir }
let(:cask) { instance_double(Cask::Cask, staged_path:) }
let(:command) { SystemCommand }
let(:args) { {} }
describe "#install_phase" ... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb | Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb | # frozen_string_literal: true
require "benchmark"
RSpec.shared_examples "#uninstall_phase or #zap_phase" do
subject { artifact }
let(:artifact_dsl_key) { described_class.dsl_key }
let(:artifact) { cask.artifacts.find { |a| a.is_a?(described_class) } }
let(:fake_system_command) { class_double(SystemCommand) }... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/cask_loader/from_content_loader_spec.rb | Library/Homebrew/test/cask/cask_loader/from_content_loader_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::CaskLoader::FromContentLoader do
describe "::try_new" do
it "returns a loader for Casks specified with `cask \"token\" do … end`" do
expect(described_class.try_new(<<~RUBY)).not_to be_nil
cask "token" do
end
RUBY
end
it "retu... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/cask_loader/from_api_loader_spec.rb | Library/Homebrew/test/cask/cask_loader/from_api_loader_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::CaskLoader::FromAPILoader, :cask do
shared_context "with API setup" do |local_token|
let(:api_token) { "#{local_token}-api" }
let(:cask_from_source) { Cask::CaskLoader.load(local_token) }
let(:cask_json) do
hash = cask_from_source.to_hash_with_vari... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/cask_loader/from_tap_loader_spec.rb | Library/Homebrew/test/cask/cask_loader/from_tap_loader_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::CaskLoader::FromTapLoader do
let(:tap) { CoreCaskTap.instance }
let(:cask_name) { "testball" }
let(:cask_full_name) { "homebrew/cask/#{cask_name}" }
let(:cask_path) { tap.cask_dir/"#{cask_name}.rb" }
describe "#load" do
before do
cask_path.parent.... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/cask_loader/from_path_loader_spec.rb | Library/Homebrew/test/cask/cask_loader/from_path_loader_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::CaskLoader::FromPathLoader do
describe "#load" do
context "when the file does not contain a cask" do
let(:path) do
(mktmpdir/"cask.rb").tap do |path|
path.write <<~RUBY
true
RUBY
end
end
it "rais... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cask/cask_loader/from_uri_loader_spec.rb | Library/Homebrew/test/cask/cask_loader/from_uri_loader_spec.rb | # frozen_string_literal: true
RSpec.describe Cask::CaskLoader::FromURILoader do
describe "::try_new" do
it "returns a loader when given an URI" do
expect(described_class.try_new(URI("https://brew.sh/"))).not_to be_nil
end
it "returns a loader when given a string which can be parsed to a URI" do
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/path_spec.rb | Library/Homebrew/test/utils/path_spec.rb | # frozen_string_literal: true
require "utils/path"
RSpec.describe Utils::Path do
describe "::child_of?" do
it "recognizes a path as its own child" do
expect(described_class.child_of?("/foo/bar", "/foo/bar")).to be(true)
end
it "recognizes a path that is a child of the parent" do
expect(desc... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/shared_audits_spec.rb | Library/Homebrew/test/utils/shared_audits_spec.rb | # frozen_string_literal: true
require "utils/shared_audits"
require "utils/curl"
RSpec.describe SharedAudits do
let(:eol_json_text) do
<<~JSON
{
"schema_version" : "1.0.0",
"generated_at": "2025-01-02T01:23:45+00:00",
"result": {
"name": "1.2",
"codename": null,... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/inreplace_spec.rb | Library/Homebrew/test/utils/inreplace_spec.rb | # frozen_string_literal: true
require "tempfile"
require "utils/inreplace"
RSpec.describe Utils::Inreplace do
let(:file) { Tempfile.new("test") }
before do
File.binwrite(file, <<~EOS)
a
b
c
aa
EOS
end
after { file.unlink }
describe ".inreplace" do
it "raises error if t... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/output_spec.rb | Library/Homebrew/test/utils/output_spec.rb | # frozen_string_literal: true
require "utils/output"
RSpec.describe Utils::Output do
def esc(code)
/(\e\[\d+m)*\e\[#{code}m/
end
describe "#pretty_installed" do
subject(:pretty_installed_output) { described_class.pretty_installed("foo") }
context "when $stdout is a TTY" do
before { allow($st... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/linkage_spec.rb | Library/Homebrew/test/utils/linkage_spec.rb | # frozen_string_literal: true
require "utils/linkage"
RSpec.describe Utils do
[:needs_macos, :needs_linux].each do |needs_os|
describe "::binary_linked_to_library?", needs_os do
let(:suffix) { OS.mac? ? ".dylib" : ".so" }
before do
mktmpdir do |dir|
(dir/"foo.h").write "void foo()... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/repology_spec.rb | Library/Homebrew/test/utils/repology_spec.rb | # typed: strict
# frozen_string_literal: true
require "utils/repology"
| ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/analytics_spec.rb | Library/Homebrew/test/utils/analytics_spec.rb | # frozen_string_literal: true
require "utils/analytics"
require "formula_installer"
RSpec.describe Utils::Analytics do
describe "::default_package_tags" do
let(:ci) { ", CI" if ENV["CI"] }
it "returns OS_VERSION and prefix when HOMEBREW_PREFIX is a custom prefix on intel" do
expect(Homebrew).to recei... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/autoremove_spec.rb | Library/Homebrew/test/utils/autoremove_spec.rb | # frozen_string_literal: true
require "utils/autoremove"
RSpec.describe Utils::Autoremove do
shared_context "with formulae for dependency testing" do
let(:formula_with_deps) do
formula "zero" do
url "zero-1.0"
depends_on "three" => :build
end
end
let(:first_formula_dep) do
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/pypi_spec.rb | Library/Homebrew/test/utils/pypi_spec.rb | # frozen_string_literal: true
require "utils/pypi"
RSpec.describe PyPI do
let(:pypi_package_url) do
"https://files.pythonhosted.org/packages/b0/3f/2e1dad67eb172b6443b5eb37eb885a054a55cfd733393071499514140282/" \
"snakemake-5.29.0.tar.gz"
end
let(:old_pypi_package_url) do
"https://files.pythonhoste... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/ruby_check_version_script_spec.rb | Library/Homebrew/test/utils/ruby_check_version_script_spec.rb | # frozen_string_literal: true
RSpec.describe Utils do
describe "ruby_check_version_script" do
subject do
homebrew_env = ENV.select { |key, _| key.start_with?("HOMEBREW_") }
Bundler.with_unbundled_env do
ENV.delete_if { |key,| key.start_with?("HOMEBREW_") }
ENV.update(homebrew_env)
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/git_spec.rb | Library/Homebrew/test/utils/git_spec.rb | # frozen_string_literal: true
require "utils/git"
RSpec.describe Utils::Git do
around do |example|
described_class.clear_available_cache
example.run
ensure
described_class.clear_available_cache
end
before do
git = HOMEBREW_SHIMS_PATH/"shared/git"
HOMEBREW_CACHE.cd do
system git, "i... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/backtrace_spec.rb | Library/Homebrew/test/utils/backtrace_spec.rb | # frozen_string_literal: true
require "utils/backtrace"
RSpec.describe Utils::Backtrace do
let(:backtrace_no_sorbet_paths) do
[
"/Library/Homebrew/downloadable.rb:75:in",
"/Library/Homebrew/downloadable.rb:50:in",
"/Library/Homebrew/cmd/fetch.rb:236:in",
"/Library/Homebrew/cmd/fetch.rb:2... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/git_repository_spec.rb | Library/Homebrew/test/utils/git_repository_spec.rb | # frozen_string_literal: true
require "utils/git_repository"
RSpec.describe Utils do
shared_examples "git_repository helper function" do |method_name|
context "when directory is not a Git repository" do
it "returns nil if `safe` parameter is `false`" do
expect(described_class.public_send(method_na... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/curl_spec.rb | Library/Homebrew/test/utils/curl_spec.rb | # frozen_string_literal: true
require "utils/curl"
RSpec.describe "Utils::Curl" do
include Utils::Curl
let(:details) do
details = {
normal: {},
cloudflare: {},
incapsula: {},
}
details[:normal][:no_cookie] = {
url: "https://www.example.com/",
final_url: ... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/topological_hash_spec.rb | Library/Homebrew/test/utils/topological_hash_spec.rb | # frozen_string_literal: true
require "utils/topological_hash"
RSpec.describe Utils::TopologicalHash do
describe "#tsort" do
it "returns a topologically sorted array" do
hash = described_class.new
hash[1] = [2, 3]
hash[2] = [3]
hash[3] = []
hash[4] = []
expect(hash.tsort).to ... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/service_spec.rb | Library/Homebrew/test/utils/service_spec.rb | # frozen_string_literal: true
require "utils/service"
RSpec.describe Utils::Service do
describe "::systemd_quote" do
it "quotes empty strings correctly" do
expect(described_class.systemd_quote("")).to eq '""'
end
it "quotes strings with special characters escaped correctly" do
expect(descri... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/cpan_spec.rb | Library/Homebrew/test/utils/cpan_spec.rb | # frozen_string_literal: true
require "utils/cpan"
RSpec.describe CPAN do
let(:cpan_package_url) do
"https://cpan.metacpan.org/authors/id/P/PE/PEVANS/Scalar-List-Utils-1.68.tar.gz"
end
let(:cpan_tgz_url) do
"https://cpan.metacpan.org/authors/id/S/ST/STBEY/Example-Module-1.23.tgz"
end
let(:non_cpan_p... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/svn_spec.rb | Library/Homebrew/test/utils/svn_spec.rb | # frozen_string_literal: true
require "utils/svn"
RSpec.describe Utils::Svn do
before do
described_class.clear_version_cache
end
describe "::available?" do
it "returns svn version if svn available" do
if quiet_system "#{HOMEBREW_SHIMS_PATH}/shared/svn", "--version"
expect(described_class)... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/string_inreplace_extension_spec.rb | Library/Homebrew/test/utils/string_inreplace_extension_spec.rb | # frozen_string_literal: true
require "utils/string_inreplace_extension"
RSpec.describe StringInreplaceExtension do
subject(:string_extension) { described_class.new(string.dup) }
describe "#change_make_var!" do
context "with a flag" do
context "with spaces" do
let(:string) do
<<~EOS
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/github_spec.rb | Library/Homebrew/test/utils/github_spec.rb | # frozen_string_literal: true
require "utils/github"
RSpec.describe GitHub do
describe "::search_query_string" do
it "builds a query with the given hash parameters formatted as key:value" do
query = described_class.search_query_string(user: "Homebrew", repo: "brew")
expect(query).to eq("q=user%3AHom... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/fork_spec.rb | Library/Homebrew/test/utils/fork_spec.rb | # frozen_string_literal: true
require "utils/fork"
RSpec.describe Utils do
describe "#safe_fork" do
it "raises a RuntimeError on an error that isn't ErrorDuringExecution" do
expect do
described_class.safe_fork do
raise "this is an exception in the child"
end
end.to raise_er... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/tar_spec.rb | Library/Homebrew/test/utils/tar_spec.rb | # frozen_string_literal: true
require "utils/tar"
RSpec.describe Utils::Tar do
before do
described_class.clear_executable_cache
end
describe ".available?" do
it "returns true if tar or gnu-tar is available" do
if described_class.executable.present?
expect(described_class).to be_available
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/gzip_spec.rb | Library/Homebrew/test/utils/gzip_spec.rb | # frozen_string_literal: true
require "utils/gzip"
RSpec.describe Utils::Gzip do
include FileUtils
describe "compress_with_options" do
it "uses the explicitly specified mtime, orig_name and output path when passed" do
mktmpdir do |path|
mtime = Time.at(12345).utc
orig_name = "someotherf... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/shell_spec.rb | Library/Homebrew/test/utils/shell_spec.rb | # frozen_string_literal: true
require "utils/shell"
RSpec.describe Utils::Shell do
describe "::profile" do
it "returns ~/.profile by default" do
ENV["SHELL"] = "/bin/another_shell"
expect(described_class.profile).to eq("~/.profile")
end
it "returns ~/.profile for sh" do
ENV["SHELL"] =... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/timer_spec.rb | Library/Homebrew/test/utils/timer_spec.rb | # frozen_string_literal: true
require "utils/timer"
RSpec.describe Utils::Timer do
describe "#remaining" do
it "returns nil when nil" do
expect(described_class.remaining(nil)).to be_nil
end
it "returns time remaining when there is time remaining" do
expect(described_class.remaining(Time.now... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/tty_spec.rb | Library/Homebrew/test/utils/tty_spec.rb | # frozen_string_literal: true
RSpec.describe Tty do
describe "::strip_ansi" do
it "removes ANSI escape codes from a string" do
expect(described_class.strip_ansi("\033[36;7mhello\033[0m")).to eq("hello")
end
end
describe "::width" do
it "returns an Integer" do
expect(described_class.width... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/popen_spec.rb | Library/Homebrew/test/utils/popen_spec.rb | # frozen_string_literal: true
require "utils/popen"
RSpec.describe Utils do
describe "::popen_read" do
it "reads the standard output of a given command" do
expect(described_class.popen_read("sh", "-c", "echo success").chomp).to eq("success")
expect($CHILD_STATUS).to be_a_success
end
it "can... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/utils/user_spec.rb | Library/Homebrew/test/utils/user_spec.rb | # frozen_string_literal: true
require "utils/user"
RSpec.describe User do
subject(:user) { described_class.current }
it { is_expected.to eq ENV.fetch("USER") }
describe "#gui?" do
before do
allow(SystemCommand).to receive(:run)
.with("who", any_args)
.and_return(instance_double(Syste... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.