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/rubocops/livecheck/regex_parentheses_spec.rb | Library/Homebrew/test/rubocops/livecheck/regex_parentheses_spec.rb | # frozen_string_literal: true
require "rubocops/livecheck"
RSpec.describe RuboCop::Cop::FormulaAudit::LivecheckRegexParentheses do
subject(:cop) { described_class.new }
it "reports an offense when the `regex` call in the `livecheck` block does not use parentheses" do
expect_offense(<<~RUBY)
class 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/rubocops/livecheck/url_symbol_spec.rb | Library/Homebrew/test/rubocops/livecheck/url_symbol_spec.rb | # frozen_string_literal: true
require "rubocops/livecheck"
RSpec.describe RuboCop::Cop::FormulaAudit::LivecheckUrlSymbol do
subject(:cop) { described_class.new }
it "reports an offense when the `url` specified in the `livecheck` block is identical to a formula URL" do
expect_offense(<<~RUBY)
class 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/rubocops/livecheck/regex_case_insensitive_spec.rb | Library/Homebrew/test/rubocops/livecheck/regex_case_insensitive_spec.rb | # frozen_string_literal: true
require "rubocops/livecheck"
RSpec.describe RuboCop::Cop::FormulaAudit::LivecheckRegexCaseInsensitive do
subject(:cop) { described_class.new }
it "reports an offense when the `regex` is not case-insensitive" do
expect_offense(<<~RUBY)
class Foo < Formula
url "https... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/livecheck/regex_if_page_match_spec.rb | Library/Homebrew/test/rubocops/livecheck/regex_if_page_match_spec.rb | # frozen_string_literal: true
require "rubocops/livecheck"
RSpec.describe RuboCop::Cop::FormulaAudit::LivecheckRegexIfPageMatch do
subject(:cop) { described_class.new }
it "reports an offense when there is no `regex` for `strategy :page_match`" do
expect_offense(<<~RUBY)
class Foo < Formula
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/rubocops/livecheck/regex_extension_spec.rb | Library/Homebrew/test/rubocops/livecheck/regex_extension_spec.rb | # frozen_string_literal: true
require "rubocops/livecheck"
RSpec.describe RuboCop::Cop::FormulaAudit::LivecheckRegexExtension do
subject(:cop) { described_class.new }
it "reports an offense when the `regex` does not use `\\.t` for archive file extensions" do
expect_offense(<<~RUBY)
class Foo < Formula
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/deprecate_disable/date_spec.rb | Library/Homebrew/test/rubocops/deprecate_disable/date_spec.rb | # frozen_string_literal: true
require "rubocops/deprecate_disable"
RSpec.describe RuboCop::Cop::FormulaAudit::DeprecateDisableDate do
subject(:cop) { described_class.new }
context "when auditing `deprecate!`" do
it "reports and corrects an offense if `date` is not ISO 8601 compliant" do
expect_offense(... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/deprecate_disable/reason_spec.rb | Library/Homebrew/test/rubocops/deprecate_disable/reason_spec.rb | # frozen_string_literal: true
require "rubocops/deprecate_disable"
RSpec.describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do
subject(:cop) { described_class.new }
context "when auditing `deprecate!`" do
it "reports no offenses if `reason` is acceptable" do
expect_no_offenses(<<~RUBY)
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/checksum/checksum_spec.rb | Library/Homebrew/test/rubocops/checksum/checksum_spec.rb | # frozen_string_literal: true
require "rubocops/checksum"
RSpec.describe RuboCop::Cop::FormulaAudit::Checksum do
subject(:cop) { described_class.new }
context "when auditing spec checksums" do
it "reports an offense if a checksum is empty" do
expect_offense(<<~RUBY)
class Foo < Formula
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/checksum/checksum_case_spec.rb | Library/Homebrew/test/rubocops/checksum/checksum_case_spec.rb | # frozen_string_literal: true
require "rubocops/checksum"
RSpec.describe RuboCop::Cop::FormulaAudit::ChecksumCase do
subject(:cop) { described_class.new }
context "when auditing spec checksums" do
it "reports an offense if a checksum contains uppercase letters" do
expect_offense(<<~RUBY)
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/rubocops/cask/desc_spec.rb | Library/Homebrew/test/rubocops/cask/desc_spec.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::Desc, :config do
it "does not start with an article" do
expect_no_offenses <<~RUBY
cask "foo" do
desc "Bar program"
end
RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
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/rubocops/cask/on_system_conditionals_spec.rb | Library/Homebrew/test/rubocops/cask/on_system_conditionals_spec.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::OnSystemConditionals, :config do
context "when auditing `postflight` stanzas" do
it "accepts when there are no `on_*` blocks" do
expect_no_offenses <<~CASK
cask 'foo' do
postflight 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/rubocops/cask/uninstall_methods_order_spec.rb | Library/Homebrew/test/rubocops/cask/uninstall_methods_order_spec.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::UninstallMethodsOrder, :config do
context "with uninstall blocks" do
context "when methods are incorrectly ordered" do
it "detects and corrects ordering offenses in the uninstall block when each method contains... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/cask/shared_filelist_glob_spec.rb | Library/Homebrew/test/rubocops/cask/shared_filelist_glob_spec.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::SharedFilelistGlob, :config do
it "reports an offense when a zap trash array includes an .sfl2 or .sfl3 file" do
expect_offense(<<~CASK)
cask "foo" do
url "https://example.com/foo.zip"
zap tra... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/cask/discontinued_spec.rb | Library/Homebrew/test/rubocops/cask/discontinued_spec.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::Discontinued, :config do
it "reports no offenses when there is no `caveats` stanza" do
expect_no_offenses <<~CASK
cask "foo" do
url "https://example.com/download/foo-v1.2.0.dmg",
verified: ... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/cask/homepage_url_styling_spec.rb | Library/Homebrew/test/rubocops/cask/homepage_url_styling_spec.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::HomepageUrlStyling, :config do
it "accepts a homepage URL ending with a slash" do
expect_no_offenses <<~CASK
cask 'foo' do
homepage 'https://foo.brew.sh/'
end
CASK
end
it "accepts a home... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/cask/stanza_order_spec.rb | Library/Homebrew/test/rubocops/cask/stanza_order_spec.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::StanzaOrder, :config do
it "accepts a sole stanza" do
expect_no_offenses <<~CASK
cask 'foo' do
version :latest
end
CASK
end
it "accepts when all stanzas are in order" do
expect_no_of... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/cask/variables_spec.rb | Library/Homebrew/test/rubocops/cask/variables_spec.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::Variables, :config do
it "accepts when there are no variables" do
expect_no_offenses <<~CASK
cask "foo" do
version :latest
end
CASK
end
it "accepts when there is an `arch` stanza" 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/rubocops/cask/url_spec.rb | Library/Homebrew/test/rubocops/cask/url_spec.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::Url, :config do
it "allows regular `url` blocks in homebrew-cask" do
expect_no_offenses <<~CASK, "/homebrew-cask/Casks/f/foo.rb"
cask "foo" do
url "https://example.com/download/foo-v1.2.0.dmg",
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/cask/array_alphabetization_spec.rb | Library/Homebrew/test/rubocops/cask/array_alphabetization_spec.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::ArrayAlphabetization, :config do
it "reports an offense when a single `zap trash` path is specified in an array" do
expect_offense(<<~CASK)
cask "foo" do
url "https://example.com/foo.zip"
zap ... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/cask/deprecate_disable_unsigned_reason_spec.rb | Library/Homebrew/test/rubocops/cask/deprecate_disable_unsigned_reason_spec.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::DeprecateDisableUnsignedReason, :config do
it "flags and autocorrects deprecate! with :unsigned" do
expect_offense <<~CASK
cask "foo" do
deprecate! date: "2024-01-01", because: :unsigned
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/cask/no_autobump.rb | Library/Homebrew/test/rubocops/cask/no_autobump.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::NoAutobump, :config do
it "reports no offenses if `reason` is acceptable" do
expect_no_offenses <<~CASK
cask 'foo' do
no_autobump! because: "some reason"
end
CASK
end
it "reports no offe... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb | Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::StanzaGrouping, :config do
it "accepts a sole stanza" do
expect_no_offenses <<~CASK
cask 'foo' do
version :latest
end
CASK
end
it "accepts correctly grouped stanzas" do
expect_no_off... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/cask/url_legacy_comma_separators_spec.rb | Library/Homebrew/test/rubocops/cask/url_legacy_comma_separators_spec.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators, :config do
it "accepts a simple `version` interpolation" do
expect_no_offenses <<~'CASK'
cask 'foo' do
version '1.1'
url 'https://foo.brew.sh/foo-#{version}.dmg'
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/cask/no_overrides_spec.rb | Library/Homebrew/test/rubocops/cask/no_overrides_spec.rb | # frozen_string_literal: true
require "rubocops/rubocop-cask"
RSpec.describe RuboCop::Cop::Cask::NoOverrides, :config do
it "accepts when there are no `on_*` blocks" do
expect_no_offenses <<~CASK
cask 'foo' do
version '1.2.3'
url 'https://brew.sh/foo.pkg'
name 'Foo'
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/rubocops/class/test_present.rb | Library/Homebrew/test/rubocops/class/test_present.rb | # frozen_string_literal: true
require "rubocops/class"
RSpec.describe RuboCop::Cop::FormulaAuditStrict::TestPresent do
subject(:cop) { described_class.new }
it "reports an offense when there is no test block" do
expect_offense(<<~RUBY)
class Foo < Formula
^^^^^^^^^^^^^^^^^^^ A `test do` test bloc... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/class/class_name_spec.rb | Library/Homebrew/test/rubocops/class/class_name_spec.rb | # frozen_string_literal: true
require "rubocops/class"
RSpec.describe RuboCop::Cop::FormulaAudit::ClassName do
subject(:cop) { described_class.new }
let(:corrected_source) do
<<~RUBY
class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz'
end
RUBY
end
it "reports and corrects an of... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/class/test_spec.rb | Library/Homebrew/test/rubocops/class/test_spec.rb | # frozen_string_literal: true
require "rubocops/class"
RSpec.describe RuboCop::Cop::FormulaAudit::Test do
subject(:cop) { described_class.new }
it "reports and corrects an offense when /usr/local/bin is found in test calls" do
expect_offense(<<~'RUBY')
class Foo < Formula
url 'https://brew.sh/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/rubocops/text/python_versions_spec.rb | Library/Homebrew/test/rubocops/text/python_versions_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::PythonVersions do
subject(:cop) { described_class.new }
context "when auditing Python versions" do
it "reports no offenses for Python with no dependency" do
expect_no_offenses(<<~RUBY)
class 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/rubocops/text/on_system_conditionals_spec.rb | Library/Homebrew/test/rubocops/text/on_system_conditionals_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do
subject(:cop) { described_class.new }
context "when auditing OS conditionals" do
it "reports an offense when `OS.linux?` is used on Formula class" do
expect_offense(<<~RUBY, "/homeb... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/text/license_arrays_spec.rb | Library/Homebrew/test/rubocops/text/license_arrays_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::LicenseArrays do
subject(:cop) { described_class.new }
context "when auditing license arrays" do
it "reports no offenses for license strings" do
expect_no_offenses(<<~RUBY)
class Foo < Formula
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/text/macos_on_linux_spec.rb | Library/Homebrew/test/rubocops/text/macos_on_linux_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::MacOSOnLinux do
subject(:cop) { described_class.new }
it "reports an offense when `MacOS` is used in the `Formula` class" do
expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
class Foo < Formula
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/text/mpi_check_spec.rb | Library/Homebrew/test/rubocops/text/mpi_check_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::MpiCheck do
subject(:cop) { described_class.new }
context "when auditing MPI dependencies" do
it "reports and corrects an offense when using depends_on \"mpich\" in homebrew/core" do
expect_offense(<<~RUBY... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/text/shell_variables_spec.rb | Library/Homebrew/test/rubocops/text/shell_variables_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::ShellVariables do
subject(:cop) { described_class.new }
context "when auditing shell variables" do
it "reports and corrects unexpanded shell variables in `Utils.popen`" do
expect_offense(<<~RUBY)
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/rubocops/text/option_declarations_spec.rb | Library/Homebrew/test/rubocops/text/option_declarations_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
subject(:cop) { described_class.new }
context "when auditing options" do
it "reports an offense when `build.without?` is used in homebrew/core" do
expect_offense(<<~RUBY, "/homebrew-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/rubocops/text/make_check_spec.rb | Library/Homebrew/test/rubocops/text/make_check_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAuditStrict::MakeCheck do
subject(:cop) { described_class.new }
let(:path) { HOMEBREW_TAP_DIRECTORY/"homebrew/homebrew-core" }
before do
path.mkpath
(path/"style_exceptions").mkpath
end
def setup_style_exce... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/text/safe_popen_commands_spec.rb | Library/Homebrew/test/rubocops/text/safe_popen_commands_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::SafePopenCommands do
subject(:cop) { described_class.new }
context "when auditing popen commands" do
it "reports and corrects `Utils.popen_read` usage" do
expect_offense(<<~RUBY)
class Foo < Formul... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/text/comments_spec.rb | Library/Homebrew/test/rubocops/text/comments_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::Comments do
subject(:cop) { described_class.new }
context "when auditing comment text" do
it "reports an offense when commented cmake calls exist" do
expect_offense(<<~RUBY)
class Foo < Formula
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/text/strict_spec.rb | Library/Homebrew/test/rubocops/text/strict_spec.rb | # frozen_string_literal: true
require "rubocops/text"
RSpec.describe RuboCop::Cop::FormulaAuditStrict::Text do
subject(:cop) { described_class.new }
context "when auditing formula text in homebrew/core" do
it "reports an offense if `env :userpaths` is present" do
expect_offense(<<~RUBY)
class 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/rubocops/text/std_npm_args_spec.rb | Library/Homebrew/test/rubocops/text/std_npm_args_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::StdNpmArgs do
subject(:cop) { described_class.new }
context "when auditing node formulae" do
it "reports an offense when `npm install` is called without std_npm_args arguments" do
expect_offense(<<~RUBY)
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/text/miscellaneous_spec.rb | Library/Homebrew/test/rubocops/text/miscellaneous_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::Miscellaneous do
subject(:cop) { described_class.new }
context "when auditing formula miscellany" do
it "reports an offense for unneeded `FileUtils` usage" do
expect_offense(<<~RUBY)
class Foo < 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/rubocops/text/assert_statements_spec.rb | Library/Homebrew/test/rubocops/text/assert_statements_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::AssertStatements do
subject(:cop) { described_class.new }
context "when auditing formula assertions" do
it "reports an offense when assert ... include is used" do
expect_offense(<<~RUBY)
class 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/rubocops/text/licenses_spec.rb | Library/Homebrew/test/rubocops/text/licenses_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::Licenses do
subject(:cop) { described_class.new }
context "when auditing licenses" do
it "reports no offenses for license strings" do
expect_no_offenses(<<~RUBY)
class Foo < Formula
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/rubocops/lines/class_inheritance_spec.rb | Library/Homebrew/test/rubocops/lines/class_inheritance_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::ClassInheritance do
subject(:cop) { described_class.new }
context "when auditing formula class inheritance" do
it "reports an offense when not using spaces for class inheritance" do
expect_offense(<<~RUBY,... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/lines/quictls_check_spec.rb | Library/Homebrew/test/rubocops/lines/quictls_check_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::QuicTLSCheck do
subject(:cop) { described_class.new }
context "when auditing formula dependencies" do
it "reports an offense when a formula depends on `quictls`" do
expect_offense(<<~RUBY, "/homebrew-core/... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/lines/generate_completions_spec.rb | Library/Homebrew/test/rubocops/lines/generate_completions_spec.rb | # frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit do
describe RuboCop::Cop::FormulaAudit::GenerateCompletionsDSL do
subject(:cop) { described_class.new }
it "reports an offense when writing to a shell completions file directly" do
expect_offense(<<~RUBY,... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/rubocops/urls/git_strict_spec.rb | Library/Homebrew/test/rubocops/urls/git_strict_spec.rb | # frozen_string_literal: true
require "rubocops/urls"
RSpec.describe RuboCop::Cop::FormulaAuditStrict::GitUrls do
subject(:cop) { described_class.new }
context "when a git URL is used" do
it "reports no offenses with both a tag and a revision" do
expect_no_offenses(<<~RUBY, "/homebrew-core/")
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/rubocops/urls/pypi_spec.rb | Library/Homebrew/test/rubocops/urls/pypi_spec.rb | # frozen_string_literal: true
require "rubocops/urls"
RSpec.describe RuboCop::Cop::FormulaAudit::PyPiUrls do
subject(:cop) { described_class.new }
context "when a pypi URL is used" do
it "reports an offense for pypi.python.org urls" do
expect_offense(<<~RUBY)
class Foo < Formula
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/rubocops/urls/git_spec.rb | Library/Homebrew/test/rubocops/urls/git_spec.rb | # frozen_string_literal: true
require "rubocops/urls"
RSpec.describe RuboCop::Cop::FormulaAudit::GitUrls do
subject(:cop) { described_class.new }
context "when a git URL is used" do
it "reports no offenses with a non-git URL" do
expect_no_offenses(<<~RUBY, "/homebrew-core/")
class Foo < Formula... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/mac_spec.rb | Library/Homebrew/test/os/mac_spec.rb | # frozen_string_literal: true
require "locale"
require "os/mac"
RSpec.describe OS::Mac do
describe "::languages" do
it "returns a list of all languages" do
expect(described_class.languages).not_to be_empty
end
end
describe "::language" do
it "returns the first item from #languages" do
e... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/os_spec.rb | Library/Homebrew/test/os/os_spec.rb | # frozen_string_literal: true
RSpec.describe OS do
describe "::kernel_version" do
it "is not NULL" do
expect(described_class.kernel_version).not_to be_null
end
end
describe "::kernel_name" do
it "returns Linux on Linux", :needs_linux do
expect(described_class.kernel_name).to eq "Linux"
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/linux_spec.rb | Library/Homebrew/test/os/linux_spec.rb | # frozen_string_literal: true
require "locale"
require "os/linux"
RSpec.describe OS::Linux do
describe "::languages", :needs_linux do
it "returns a list of all languages" do
expect(described_class.languages).not_to be_empty
end
end
describe "::language", :needs_linux do
it "returns the first ... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/mac/sdk_spec.rb | Library/Homebrew/test/os/mac/sdk_spec.rb | # frozen_string_literal: true
RSpec.describe OS::Mac::CLTSDKLocator do
subject(:locator) { described_class.new }
let(:big_sur_sdk) { OS::Mac::SDK.new(MacOSVersion.new("11"), "/some/path/MacOSX.sdk", :clt) }
let(:catalina_sdk) { OS::Mac::SDK.new(MacOSVersion.new("10.15"), "/some/path/MacOSX10.15.sdk", :clt) }
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/mac/pkgconfig_spec.rb | Library/Homebrew/test/os/mac/pkgconfig_spec.rb | # frozen_string_literal: true
# These tests assume the needed SDKs are correctly installed, i.e. `brew doctor` passes.
# The CLT version installed should be the latest available for the running OS.
# The tests do not check other OS versions beyond than the one the tests are being run on.
#
# It is not possible to auto... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/mac/dependency_collector_spec.rb | Library/Homebrew/test/os/mac/dependency_collector_spec.rb | # frozen_string_literal: true
require "dependency_collector"
RSpec.describe DependencyCollector do
alias_matcher :need_tar_xz_dependency, :be_tar_needs_xz_dependency
subject(:collector) { described_class.new }
specify "Resource dependency from a '.xz' URL" do
resource = Resource.new
resource.url("http... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/mac/keg_spec.rb | Library/Homebrew/test/os/mac/keg_spec.rb | # frozen_string_literal: true
require "keg"
RSpec.describe Keg do
include FileUtils
subject(:keg) { described_class.new(keg_path) }
describe "#mach_o_files" do
let(:keg_path) { HOMEBREW_CELLAR/"a/1.0" }
before { (keg_path/"lib").mkpath }
after { keg.unlink }
it "skips hardlinks" do
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/os/mac/formula_spec.rb | Library/Homebrew/test/os/mac/formula_spec.rb | # frozen_string_literal: true
require "test/support/fixtures/testball"
require "formula"
RSpec.describe Formula do
describe "#uses_from_macos" do
before do
allow(OS).to receive(:mac?).and_return(true)
allow(OS::Mac).to receive(:version).and_return(MacOSVersion.from_symbol(:sonoma))
end
it "... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/mac/reinstall_spec.rb | Library/Homebrew/test/os/mac/reinstall_spec.rb | # typed: false
# frozen_string_literal: true
require "reinstall"
require "extend/os/mac/pkgconf"
RSpec.describe Homebrew::Reinstall do
describe ".reinstall_pkgconf_if_needed!" do
let(:formula) { instance_double(Formula) }
let(:formula_installer) do
instance_double(FormulaInstaller, formula:, prelude_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/os/mac/diagnostic_spec.rb | Library/Homebrew/test/os/mac/diagnostic_spec.rb | # frozen_string_literal: true
require "diagnostic"
RSpec.describe Homebrew::Diagnostic::Checks do
subject(:checks) { described_class.new }
specify "#check_for_unsupported_macos" do
ENV.delete("HOMEBREW_DEVELOPER")
macos_version = MacOSVersion.new("30")
allow(OS::Mac).to receive_messages(version: mac... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/mac/formula_installer_spec.rb | Library/Homebrew/test/os/mac/formula_installer_spec.rb | # frozen_string_literal: true
require "formula_installer"
require "test/support/fixtures/testball"
RSpec.describe FormulaInstaller do
include FileUtils
subject(:keg) { described_class.new(keg_path) }
describe "#fresh_install" do
subject(:formula_installer) { described_class.new(Testball.new) }
it "is... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/mac/mach_spec.rb | Library/Homebrew/test/os/mac/mach_spec.rb | # frozen_string_literal: true
RSpec.describe MachOShim do
describe "Pathname tests" do
specify "fat dylib" do
pn = dylib_path("fat")
expect(pn).to be_universal
expect(pn).not_to be_i386
expect(pn).not_to be_x86_64
expect(pn).not_to be_ppc7400
expect(pn).not_to be_ppc64
e... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/linux/pathname_spec.rb | Library/Homebrew/test/os/linux/pathname_spec.rb | # frozen_string_literal: true
require "extend/pathname"
RSpec.describe Pathname do
let(:elf_dir) { ELFPathname.wrap("#{TEST_FIXTURE_DIR}/elf") }
let(:sho) { ELFPathname.wrap(elf_dir/"libforty.so.0") }
let(:sho_without_runpath_rpath) { ELFPathname.wrap(elf_dir/"libhello.so.0") }
let(:exec) { ELFPathname.wrap(e... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/linux/dependency_collector_spec.rb | Library/Homebrew/test/os/linux/dependency_collector_spec.rb | # frozen_string_literal: true
require "dependency_collector"
RSpec.describe DependencyCollector do
alias_matcher :be_a_build_requirement, :be_build
subject(:collector) { described_class.new }
describe "#add" do
let(:resource) { Resource.new }
context "when xz, unzip and bzip2 are not available" 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/os/linux/libstdcxx_spec.rb | Library/Homebrew/test/os/linux/libstdcxx_spec.rb | # frozen_string_literal: true
require "os/linux/libstdcxx"
RSpec.describe OS::Linux::Libstdcxx do
describe "::below_ci_version?" do
it "returns false when system version matches CI version" do
allow(described_class).to receive(:system_version).and_return(Version.new(OS::LINUX_LIBSTDCXX_CI_VERSION))
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/linux/ld_spec.rb | Library/Homebrew/test/os/linux/ld_spec.rb | # frozen_string_literal: true
require "os/linux/ld"
require "tmpdir"
RSpec.describe OS::Linux::Ld do
let(:diagnostics) do
<<~EOS
path.prefix="/usr"
path.sysconfdir="/usr/local/etc"
path.system_dirs[0x0]="/lib64"
path.system_dirs[0x1]="/var/lib"
EOS
end
describe "::system_ld_so" ... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/linux/formula_spec.rb | Library/Homebrew/test/os/linux/formula_spec.rb | # frozen_string_literal: true
require "test/support/fixtures/testball"
require "formula"
RSpec.describe Formula do
describe "#uses_from_macos" do
before do
allow(OS).to receive(:mac?).and_return(false)
end
it "acts like #depends_on" do
f = formula "foo" do
url "foo-1.0"
use... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/linux/diagnostic_spec.rb | Library/Homebrew/test/os/linux/diagnostic_spec.rb | # 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(/You... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/linux/formula_installer_spec.rb | Library/Homebrew/test/os/linux/formula_installer_spec.rb | # frozen_string_literal: true
require "formula_installer"
require "test/support/fixtures/testball"
RSpec.describe FormulaInstaller do
include FileUtils
subject(:keg) { described_class.new(keg_path) }
describe "#fresh_install" do
subject(:formula_installer) { described_class.new(Testball.new) }
it "is... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/os/linux/elf_spec.rb | Library/Homebrew/test/os/linux/elf_spec.rb | # frozen_string_literal: true
RSpec.describe OS::Linux::Elf do
describe "::expand_elf_dst" do
it "expands tokens that are not wrapped in curly braces" do
str = "$ORIGIN/../lib"
ref = "ORIGIN"
repl = "/opt/homebrew/bin"
expected = "/opt/homebrew/bin/../lib"
expect(described_class.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/extend/blank_spec.rb | Library/Homebrew/test/extend/blank_spec.rb | # frozen_string_literal: true
require "extend/blank"
RSpec.describe Object do
let(:empty_true) do
Class.new(described_class) do
# This API is intentionally non-ideal for testing.
# rubocop:disable Naming/PredicateMethod
def empty?
0
end
# rubocop:enable Naming/PredicateMeth... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/extend/array_spec.rb | Library/Homebrew/test/extend/array_spec.rb | # frozen_string_literal: true
require "extend/array"
RSpec.describe Array do
describe ".to_sentence" do
it "converts a plain array to a sentence" do
expect([].to_sentence).to eq("")
expect(["one"].to_sentence).to eq("one")
expect(["one", "two"].to_sentence).to eq("one and two")
expect(["... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/extend/kernel_spec.rb | Library/Homebrew/test/extend/kernel_spec.rb | # frozen_string_literal: true
RSpec.describe Kernel do
let(:dir) { mktmpdir }
describe "#interactive_shell" do
let(:shell) { dir/"myshell" }
it "starts an interactive shell session" do
File.write shell, <<~SH
#!/bin/sh
echo called > "#{dir}/called"
SH
FileUtils.chmod 07... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/extend/pathname/write_mkpath_extension_spec.rb | Library/Homebrew/test/extend/pathname/write_mkpath_extension_spec.rb | # frozen_string_literal: true
require "extend/pathname/write_mkpath_extension"
# Use a copy of Pathname with the WriteMkpathExtension prepended to avoid affecting the original class for all tests
class PathnameCopy < Pathname
PathnameCopy.prepend WriteMkpathExtension
end
RSpec.describe WriteMkpathExtension do
le... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/cli/parser_spec.rb | Library/Homebrew/test/cli/parser_spec.rb | # frozen_string_literal: true
require_relative "../../cli/parser"
RSpec.describe Homebrew::CLI::Parser do
before { stub_const("Cmd", Class.new(Homebrew::AbstractCommand)) }
describe "test switch options" do
subject(:parser) do
described_class.new(Cmd) do
switch "--more-verbose", description: "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/cli/named_args_spec.rb | Library/Homebrew/test/cli/named_args_spec.rb | # frozen_string_literal: true
require "cli/named_args"
RSpec.describe Homebrew::CLI::NamedArgs do
def setup_unredable_formula(name)
error = FormulaUnreadableError.new(name, RuntimeError.new("testing"))
allow(Formulary).to receive(:factory).with(name, any_args).and_raise(error)
end
def setup_unredable_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/unpack_strategy/lha_spec.rb | Library/Homebrew/test/unpack_strategy/lha_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Lha do
let(:path) { TEST_FIXTURE_DIR/"test.lha" }
include_examples "UnpackStrategy::detect"
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/unpack_strategy/uncompressed_spec.rb | Library/Homebrew/test/unpack_strategy/uncompressed_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Uncompressed do
let(:path) do
(mktmpdir/"test").tap do |path|
FileUtils.touch path
end
end
include_examples "UnpackStrategy::detect"
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/unpack_strategy/subversion_spec.rb | Library/Homebrew/test/unpack_strategy/subversion_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Subversion, :needs_svn do
let(:repo) { mktmpdir }
let(:working_copy) { mktmpdir }
let(:path) { working_copy }
before do
safe_system "svnadmin", "create", repo
safe_system "svn", "checkout", "file://#{repo}... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/unpack_strategy/lzip_spec.rb | Library/Homebrew/test/unpack_strategy/lzip_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Lzip do
let(:path) { TEST_FIXTURE_DIR/"test.lz" }
include_examples "UnpackStrategy::detect"
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/unpack_strategy/cvs_spec.rb | Library/Homebrew/test/unpack_strategy/cvs_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Cvs do
let(:repo) do
mktmpdir.tap do |repo|
FileUtils.touch repo/"test"
(repo/"CVS").mkpath
end
end
let(:path) { repo }
include_examples "UnpackStrategy::detect"
include_examples "#extract", ... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/unpack_strategy/directory_spec.rb | Library/Homebrew/test/unpack_strategy/directory_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Directory do
let(:path) do
mktmpdir.tap do |path|
FileUtils.touch path/"file"
FileUtils.ln_s "file", path/"symlink"
FileUtils.ln path/"file", path/"hardlink"
FileUtils.mkdir path/"folder"
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/unpack_strategy/dmg_spec.rb | Library/Homebrew/test/unpack_strategy/dmg_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Dmg, :needs_macos do
describe "#mount" do
let(:path) { TEST_FIXTURE_DIR/"cask/container.dmg" }
include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["container"]
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/unpack_strategy/zstd_spec.rb | Library/Homebrew/test/unpack_strategy/zstd_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Zstd do
let(:path) { TEST_FIXTURE_DIR/"cask/container.tar.zst" }
it "is correctly detected" do
# `UnpackStrategy.detect(path)` for a `.tar.XXX` file returns either `UnpackStrategy::Tar` if
# the host's `tar` 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/unpack_strategy/git_spec.rb | Library/Homebrew/test/unpack_strategy/git_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Git do
let(:repo) do
mktmpdir.tap do |repo|
system "git", "-C", repo, "init"
FileUtils.touch repo/"test"
system "git", "-C", repo, "add", "test"
system "git", "-C", repo, "commit", "-m", "Add... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/unpack_strategy/p7zip_spec.rb | Library/Homebrew/test/unpack_strategy/p7zip_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::P7Zip do
let(:path) { TEST_FIXTURE_DIR/"cask/container.7z" }
include_examples "UnpackStrategy::detect"
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/unpack_strategy/xz_spec.rb | Library/Homebrew/test/unpack_strategy/xz_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Xz do
let(:path) { TEST_FIXTURE_DIR/"cask/container.xz" }
include_examples "UnpackStrategy::detect"
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/unpack_strategy/shared_examples.rb | Library/Homebrew/test/unpack_strategy/shared_examples.rb | # frozen_string_literal: true
require "unpack_strategy"
RSpec.shared_examples "UnpackStrategy::detect" do
it "is correctly detected" do
expect(UnpackStrategy.detect(path)).to be_a described_class
end
end
RSpec.shared_examples "#extract" do |children: []|
specify "#extract" do
mktmpdir do |unpack_dir|
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/unpack_strategy/rar_spec.rb | Library/Homebrew/test/unpack_strategy/rar_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Rar do
let(:path) { TEST_FIXTURE_DIR/"cask/container.rar" }
include_examples "UnpackStrategy::detect"
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/unpack_strategy/zip_spec.rb | Library/Homebrew/test/unpack_strategy/zip_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Zip do
let(:path) { TEST_FIXTURE_DIR/"cask/MyFancyApp.zip" }
include_examples "UnpackStrategy::detect"
context "when unzip is available", :needs_unzip do
include_examples "#extract", children: ["MyFancyApp"]
... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/unpack_strategy/bzip2_spec.rb | Library/Homebrew/test/unpack_strategy/bzip2_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Bzip2 do
let(:path) { TEST_FIXTURE_DIR/"cask/container.bz2" }
include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["container"]
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/unpack_strategy/bazaar_spec.rb | Library/Homebrew/test/unpack_strategy/bazaar_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Bazaar do
let(:repo) do
mktmpdir.tap do |repo|
FileUtils.touch repo/"test"
(repo/".bzr").mkpath
end
end
let(:path) { repo }
include_examples "UnpackStrategy::detect"
include_examples "#extrac... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/unpack_strategy/tar_spec.rb | Library/Homebrew/test/unpack_strategy/tar_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Tar do
let(:path) { TEST_FIXTURE_DIR/"cask/container.tar.gz" }
include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["container"]
context "when TAR archive is corrupted" do
let(:pa... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/unpack_strategy/gzip_spec.rb | Library/Homebrew/test/unpack_strategy/gzip_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Gzip do
let(:path) { TEST_FIXTURE_DIR/"cask/container.gz" }
include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["container"]
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/unpack_strategy/jar_spec.rb | Library/Homebrew/test/unpack_strategy/jar_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Jar, :needs_unzip do
let(:path) { TEST_FIXTURE_DIR/"test.jar" }
include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["test.jar"]
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/unpack_strategy/xar_spec.rb | Library/Homebrew/test/unpack_strategy/xar_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Xar, :needs_macos do
let(:path) { TEST_FIXTURE_DIR/"cask/container.xar" }
include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["container"]
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/unpack_strategy/mercurial_spec.rb | Library/Homebrew/test/unpack_strategy/mercurial_spec.rb | # frozen_string_literal: true
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Mercurial do
let(:repo) do
mktmpdir.tap do |repo|
(repo/".hg").mkpath
end
end
let(:path) { repo }
include_examples "UnpackStrategy::detect"
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/language/java_spec.rb | Library/Homebrew/test/language/java_spec.rb | # frozen_string_literal: true
require "language/java"
RSpec.describe Language::Java do
let(:f) do
formula("openjdk") do
url "openjdk"
version "15.0.1"
end
end
let(:expected_home) do
if OS.mac?
f.opt_libexec/"openjdk.jdk/Contents/Home"
else
f.opt_libexec
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/language/python_spec.rb | Library/Homebrew/test/language/python_spec.rb | # frozen_string_literal: true
require "language/python"
RSpec.describe Language::Python, :needs_python do
describe "#major_minor_version" do
it "returns a Version for Python 2" do
expect(described_class).to receive(:major_minor_version).and_return(Version)
described_class.major_minor_version("python... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/language/node_spec.rb | Library/Homebrew/test/language/node_spec.rb | # frozen_string_literal: true
require "language/node"
RSpec.describe Language::Node do
let(:npm_pack_cmd) { ["npm", "pack", "--ignore-scripts"] }
describe "#setup_npm_environment" do
it "calls prepend_path when node formula exists only during the first call" do
node = formula "node" do
url "nod... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/language/python/virtualenv_spec.rb | Library/Homebrew/test/language/python/virtualenv_spec.rb | # frozen_string_literal: true
require "language/python"
require "resource"
RSpec.describe Language::Python::Virtualenv, :needs_python do
describe "#virtualenv_install_with_resources" do
let(:venv) { instance_double(Language::Python::Virtualenv::Virtualenv) }
let(:f) do
formula "foo" do
# Could... | ruby | BSD-2-Clause | fe0a384e3a04605192726c149570fbe33a8996b0 | 2026-01-04T15:37:27.366412Z | false |
Homebrew/brew | https://github.com/Homebrew/brew/blob/fe0a384e3a04605192726c149570fbe33a8996b0/Library/Homebrew/test/language/python/shebang_spec.rb | Library/Homebrew/test/language/python/shebang_spec.rb | # frozen_string_literal: true
require "language/python"
require "utils/shebang"
RSpec.describe Language::Python::Shebang do
let(:file) { Tempfile.new("python-shebang") }
let(:broken_file) { Tempfile.new("python-shebang") }
let(:f) do
f = {}
f[:python311] = formula "python@3.11" do
url "https://br... | 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.