source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/string_inreplace_extension_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 6,969 | # typed: false
# 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
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/analytics_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 7,617 | # typed: false
# 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(Hom... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/cpan_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,672 | # typed: false
# 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
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/gzip_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 3,414 | # typed: false
# 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_nam... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/linkage_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,492 | # typed: false
# 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").wr... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/timer_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 921 | # typed: false
# 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.rem... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/topological_hash_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,771 | # typed: false
# 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(... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/path_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,139 | # typed: false
# 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
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/tar_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,545 | # typed: false
# 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).t... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/github_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 6,571 | # typed: false
# 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 e... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/user_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,077 | # typed: false
# 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(instan... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/shell_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 5,089 | # typed: false
# 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
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/shell_completion_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 3,881 | # typed: false
# frozen_string_literal: true
require "utils/shell_completion"
RSpec.describe Utils::ShellCompletion do
describe ".default_completion_shells" do
it "returns bash, zsh, and fish for nil format" do
expect(described_class.default_completion_shells(nil)).to eq([:bash, :zsh, :fish])
end
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/svn_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,560 | # typed: false
# 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(d... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/backtrace_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 3,883 | # typed: false
# 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... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/tty_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,873 | # typed: false
# 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(descri... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/output_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 4,705 | # typed: false
# 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
bef... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/pypi_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 9,885 | # typed: false
# 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://fi... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/git_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 7,674 | # typed: false
# 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
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/spdx_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 15,477 | # typed: false
# frozen_string_literal: true
require "utils/spdx"
RSpec.describe SPDX do
describe ".license_data" do
it "has the license list version" do
expect(described_class.license_data["licenseListVersion"]).not_to be_nil
end
it "has the release date" do
expect(described_class.license_... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/bottles/tag_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 3,041 | # typed: false
# frozen_string_literal: true
require "utils/bottles"
RSpec.describe Utils::Bottles::Tag do
it "can parse macOS symbols with archs" do
symbol = :arm64_big_sur
tag = described_class.from_symbol(symbol)
expect(tag.system).to eq(:big_sur)
expect(tag.arch).to eq(:arm64)
expect(tag.to_... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/bottles/bottles_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,728 | # typed: false
# frozen_string_literal: true
require "utils/bottles"
RSpec.describe Utils::Bottles do
describe "#tag", :needs_macos do
it "returns :big_sur or :arm64_big_sur on Big Sur" do
allow(MacOS).to receive(:version).and_return(MacOSVersion.new("11.0"))
if Hardware::CPU.intel?
expect(d... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/bottles/collector_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,460 | # typed: false
# frozen_string_literal: true
require "utils/bottles"
RSpec.describe Utils::Bottles::Collector do
subject(:collector) { described_class.new }
let(:tahoe) { Utils::Bottles::Tag.from_symbol(:tahoe) }
let(:sequoia) { Utils::Bottles::Tag.from_symbol(:sequoia) }
let(:sonoma) { Utils::Bottles::Tag.f... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/ast/ast_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,836 | # typed: false
# frozen_string_literal: true
require "utils/ast"
RSpec.describe Utils::AST do
describe ".stanza_text" do
let(:compound_license) do
<<-RUBY
license all_of: [
:public_domain,
"MIT",
"GPL-3.0-or-later" => { with: "Autoconf-exception-3.0" },
]
RUBY
end
it "accept... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/ast/formula_ast_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 13,815 | # typed: false
# frozen_string_literal: true
require "utils/ast"
RSpec.describe Utils::AST::FormulaAST do
subject(:formula_ast) do
described_class.new <<~RUBY
class Foo < Formula
url "https://brew.sh/foo-1.0.tar.gz"
license all_of: [
:public_domain,
"MIT",
"GP... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/utils/github/actions_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,536 | # typed: false
# frozen_string_literal: true
require "utils/github/actions"
RSpec.describe GitHub::Actions::Annotation do
let(:message) { "lorem ipsum" }
describe "#new" do
it "fails when the type is wrong" do
expect do
described_class.new(:fatal, message, file: "file.txt")
end.to raise_e... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/version/parser_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,925 | # typed: false
# frozen_string_literal: true
require "version/parser"
RSpec.describe Version::Parser do
specify "::new" do
expect { described_class.new }
.to raise_error("Version::Parser is declared as abstract; it cannot be instantiated")
end
describe Version::RegexParser do
specify "::new" do
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/download_strategies/curl_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 12,842 | # typed: false
# frozen_string_literal: true
require "download_strategy"
RSpec.describe CurlDownloadStrategy do
subject(:strategy) { described_class.new(url, name, version, **specs) }
let(:name) { "foo" }
let(:url) { "https://example.com/foo.tar.gz" }
let(:version) { "1.2.3" }
let(:specs) { { user: "downlo... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/download_strategies/vcs_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 514 | # typed: false
# frozen_string_literal: true
require "download_strategy"
RSpec.describe VCSDownloadStrategy do
let(:url) { "https://example.com/bar" }
let(:version) { nil }
describe "#cached_location" do
it "returns the path of the cached resource" do
allow_any_instance_of(described_class).to receive... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/download_strategies/github_git_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 504 | # typed: false
# frozen_string_literal: true
require "download_strategy"
RSpec.describe GitHubGitDownloadStrategy do
subject(:strategy) { described_class.new(url, name, version) }
let(:name) { "brew" }
let(:url) { "https://github.com/homebrew/brew.git" }
let(:version) { nil }
it "parses the URL and sets t... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/download_strategies/abstract_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 648 | # typed: false
# frozen_string_literal: true
require "download_strategy"
RSpec.describe AbstractDownloadStrategy do
subject(:strategy) { Class.new(described_class).new(url, name, version, **specs) }
let(:specs) { {} }
let(:name) { "foo" }
let(:url) { "https://example.com/foo.tar.gz" }
let(:version) { nil }... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/download_strategies/curl_post_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,262 | # typed: false
# frozen_string_literal: true
require "download_strategy"
RSpec.describe CurlPostDownloadStrategy do
subject(:strategy) { described_class.new(url, name, version, **specs) }
let(:name) { "foo" }
let(:url) { "https://example.com/foo.tar.gz" }
let(:version) { "1.2.3" }
let(:specs) { {} }
let(... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/download_strategies/git_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,846 | # typed: false
# frozen_string_literal: true
require "download_strategy"
RSpec.describe GitDownloadStrategy do
subject(:strategy) { described_class.new(url, name, version) }
let(:name) { "baz" }
let(:url) { "https://github.com/homebrew/foo" }
let(:version) { nil }
let(:cached_location) { subject.cached_loc... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/download_strategies/subversion_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,103 | # typed: false
# frozen_string_literal: true
require "download_strategy"
RSpec.describe SubversionDownloadStrategy do
subject(:strategy) { described_class.new(url, name, version, **specs) }
let(:name) { "foo" }
let(:url) { "https://example.com/foo.tar.gz" }
let(:version) { "1.2.3" }
let(:specs) { {} }
d... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/download_strategies/curl_github_packages_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,727 | # typed: false
# frozen_string_literal: true
require "download_strategy"
RSpec.describe CurlGitHubPackagesDownloadStrategy do
subject(:strategy) { described_class.new(url, name, version, **specs) }
let(:name) { "foo" }
let(:url) { "https://#{GitHubPackages::URL_DOMAIN}/v2/homebrew/core/spec_test/manifests/1.2.... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/download_strategies/detector_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,031 | # typed: false
# frozen_string_literal: true
require "download_strategy"
RSpec.describe DownloadStrategyDetector do
describe "::detect" do
subject(:strategy_detector) { described_class.detect(url, strategy) }
let(:url) { "invalidurl" }
let(:strategy) { nil }
context "when given Git URL" do
l... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/sorbet/tapioca/config_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 528 | # typed: false
# frozen_string_literal: true
require "bundler"
require "yaml"
RSpec.describe "Tapioca Config", type: :system do
let(:config) { YAML.load_file(File.join(__dir__, "../../../sorbet/tapioca/config.yml")) }
it "only excludes dependencies" do
exclusions = config.dig("gem", "exclude")
dependenci... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/options/deprecated_option_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 835 | # typed: false
# frozen_string_literal: true
require "options"
RSpec.describe DeprecatedOption do
subject(:option) { described_class.new("foo", "bar") }
specify "#old" do
expect(option.old).to eq("foo")
end
specify "#old_flag" do # rubocop:todo RSpec/AggregateExamples
expect(option.old_flag).to eq("... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/options/option_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 761 | # typed: false
# frozen_string_literal: true
require "options"
RSpec.describe Option do
subject(:option) { described_class.new("foo") }
specify "#to_s" do
expect(option.to_s).to eq("--foo")
end
specify "equality" do
foo = described_class.new("foo")
bar = described_class.new("bar")
expect(opt... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/cli/named_args_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 14,119 | # typed: false
# 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 se... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/cli/parser_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 20,475 | # typed: false
# 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", ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/test_bot/test_cleanup_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,649 | # typed: false
# frozen_string_literal: true
require "dev-cmd/test-bot"
RSpec.describe Homebrew::TestBot::CleanupAfter do
# Regression test: checkout_branch_if_needed, reset_if_needed, and clean_if_needed
# expect a String (repository path). Passing HOMEBREW_REPOSITORY (Pathname) would cause
# "Parameter 'repos... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/test_bot/setup_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 469 | # typed: false
# frozen_string_literal: true
require "dev-cmd/test-bot"
RSpec.describe Homebrew::TestBot::Setup do
subject(:setup) { described_class.new }
describe "#run!" do
it "is successful" do
expect(setup).to receive(:test)
.exactly(3).times
.and_return(instance_double(Homebrew::Te... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/test_bot/step_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 577 | # typed: false
# frozen_string_literal: true
require "test_bot"
RSpec.describe Homebrew::TestBot::Step do
subject(:step) { described_class.new(command, env:, verbose:) }
let(:command) { ["brew", "config"] }
let(:env) { {} }
let(:verbose) { false }
describe "#run" do
it "runs the command" do
expe... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/test_bot/junit_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,100 | # typed: false
# frozen_string_literal: true
require "test_bot"
RSpec.describe Homebrew::TestBot::Junit do
# Regression test: Junit requires REXML before use. Without the require calls in #initialize,
# environments that don't load REXML elsewhere (e.g. Linux CI) raise
# "uninitialized constant Homebrew::TestBo... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/test_bot/formulae_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,845 | # typed: false
# frozen_string_literal: true
require "test_bot"
RSpec.describe Homebrew::TestBot::Formulae do
describe "#testing_portable_ruby?" do
it "returns false (not nil) when tap is nil" do
# Regression test: without `!!`, tap&.core_tap? returns nil when tap is nil,
# and `nil && ...` evaluate... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/test_bot/test_formulae_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,302 | # typed: false
# frozen_string_literal: true
require "test_bot"
require "utils/github/artifacts"
RSpec.describe Homebrew::TestBot::TestFormulae do
subject(:test_formulae) do
described_class.new(tap: nil, git: nil, dry_run: false, fail_fast: false, verbose: false)
end
describe "#download_artifacts_from_prev... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/test_bot/test_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 691 | # typed: false
# frozen_string_literal: true
require "test_bot"
RSpec.describe Homebrew::TestBot::Test do
describe "#test" do
it "converts Pathname arguments to strings" do
# Regression test: callers like TestCleanup pass Pathname objects (e.g. repository)
# as positional arguments. The `test` metho... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/test_bot/bottles_fetch_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 984 | # typed: false
# frozen_string_literal: true
require "test_bot"
require "dev-cmd/test-bot"
RSpec.describe Homebrew::TestBot::BottlesFetch do
describe "#run!" do
it "accepts Utils::Bottles::Tag objects from the bottle collector" do
# Regression test: bottle_specification.collector.tags returns Utils::Bottl... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/public_api_cookbook_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,293 | # typed: false
# frozen_string_literal: true
require "rubocops/public_api_cookbook"
RSpec.describe RuboCop::Cop::Homebrew::PublicApiCookbook do
subject(:cop) { described_class.new }
let(:formula_path) { "formula.rb" }
let(:cask_dsl_path) { "cask/dsl.rb" }
context "when a cookbook-referenced method lacks `@a... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/exec_shell_metacharacters_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 763 | # typed: false
# frozen_string_literal: true
require "rubocops/shell_commands"
RSpec.describe RuboCop::Cop::Homebrew::ExecShellMetacharacters do
subject(:cop) { described_class.new }
context "when auditing exec calls" do
it "reports aan offense when output piping is used" do
expect_offense(<<~RUBY)
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/homepage_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 6,003 | # typed: false
# frozen_string_literal: true
require "rubocops/homepage"
RSpec.describe RuboCop::Cop::FormulaAudit::Homepage do
subject(:cop) { described_class.new }
context "when auditing homepage" do
it "reports an offense when there is no homepage" do
expect_offense(<<~RUBY)
class Foo < Form... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/install_bundler_gems_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 420 | # typed: false
# frozen_string_literal: true
require "rubocops/install_bundler_gems"
RSpec.describe RuboCop::Cop::Homebrew::InstallBundlerGems, :config do
it "registers an offense and corrects when using `Homebrew.install_bundler_gems!`" do
expect_offense(<<~RUBY)
Homebrew.install_bundler_gems!
^^^^... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/public_api_documentation_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,700 | # typed: false
# frozen_string_literal: true
require "rubocops/public_api_documentation"
RSpec.describe RuboCop::Cop::Homebrew::PublicApiDocumentation do
subject(:cop) { described_class.new }
context "when a method has a bare `@api public` with no description" do
it "reports an offense" do
expect_offen... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/no_autobump.rb | Ruby | bsd-2-clause | 47,751 | main | 3,475 | # typed: false
# frozen_string_literal: true
require "rubocops/no_autobump"
RSpec.describe RuboCop::Cop::FormulaAudit::NoAutobump do
subject(:cop) { described_class.new }
it "reports no offenses if `reason` is acceptable" do
expect_no_offenses(<<~RUBY)
class Foo < Formula
url 'https://brew.sh/f... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/caveats_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,222 | # typed: false
# frozen_string_literal: true
require "rubocops/caveats"
RSpec.describe RuboCop::Cop::FormulaAudit::Caveats do
subject(:cop) { described_class.new }
context "when auditing `caveats`" do
it "reports an offense if `setuid` is mentioned" do
expect_offense(<<~RUBY)
class Foo < Formul... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/negate_include_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 738 | # typed: false
# frozen_string_literal: true
require "rubocops/negate_include"
RSpec.describe RuboCop::Cop::Homebrew::NegateInclude, :config do
it "registers an offense and corrects when using `!include?`" do
expect_offense(<<~RUBY)
!array.include?(2)
^^^^^^^^^^^^^^^^^^ Use `.exclude?` and remove th... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/keg_only_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,365 | # typed: false
# frozen_string_literal: true
require "rubocops/keg_only"
RSpec.describe RuboCop::Cop::FormulaAudit::KegOnly do
subject(:cop) { described_class.new }
it "reports and corrects an offense when the `keg_only` reason is capitalized" do
expect_offense(<<~RUBY)
class Foo < Formula
url... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/desc_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 6,813 | # typed: false
# frozen_string_literal: true
require "rubocops/desc"
RSpec.describe RuboCop::Cop::FormulaAudit::Desc do
subject(:cop) { described_class.new }
context "when auditing formula `desc` methods" do
it "reports an offense when there is no `desc`" do
expect_offense(<<~RUBY)
class Foo < ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/service_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,485 | # typed: false
# frozen_string_literal: true
require "rubocops/service"
RSpec.describe RuboCop::Cop::FormulaAudit::Service do
subject(:cop) { described_class.new }
it "reports offenses when a service block is missing a required command" do
expect_offense(<<~RUBY)
class Foo < Formula
url "https:... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/components_redundancy_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 3,757 | # typed: false
# frozen_string_literal: true
require "rubocops/components_redundancy"
RSpec.describe RuboCop::Cop::FormulaAudit::ComponentsRedundancy do
subject(:cop) { described_class.new }
context "when auditing formula components" do
it "reports an offense if `url` is outside `stable` block" do
expe... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/blank_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 4,360 | # typed: false
# frozen_string_literal: true
require "rubocops/blank"
RSpec.describe RuboCop::Cop::Homebrew::Blank, :config do
shared_examples "offense" do |source, correction, message|
it "registers an offense and corrects" do
expect_offense(<<~RUBY, source:, message:)
#{source}
^{source}... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/disable_comment_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,293 | # typed: false
# frozen_string_literal: true
require "rubocops/disable_comment"
RSpec.describe RuboCop::Cop::DisableComment, :config do
shared_examples "offense" do |source, correction, message|
it "registers an offense and corrects" do
expect_offense(<<~RUBY, source:, message:)
#{source}
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/lines_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,822 | # typed: false
# frozen_string_literal: true
require "rubocops/lines"
RSpec.describe RuboCop::Cop::FormulaAudit::Lines do
subject(:cop) { described_class.new }
context "when auditing deprecated special dependencies" do
it "reports an offense when using depends_on :automake" do
expect_offense(<<~RUBY)
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/version_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,163 | # typed: false
# frozen_string_literal: true
require "rubocops/version"
RSpec.describe RuboCop::Cop::FormulaAudit::Version do
subject(:cop) { described_class.new }
context "when auditing version" do
it "reports an offense if `version` is an empty string" do
expect_offense(<<~RUBY)
class Foo < F... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/present_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 3,806 | # typed: false
# frozen_string_literal: true
require "rubocops/present"
RSpec.describe RuboCop::Cop::Homebrew::Present, :config do
shared_examples "offense" do |source, correction, message|
it "registers an offense and corrects" do
expect_offense(<<~RUBY, source:, message:)
#{source}
^{sou... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/no_fileutils_rmrf_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 3,108 | # typed: false
# frozen_string_literal: true
require "rubocops/no_fileutils_rmrf"
RSpec.describe RuboCop::Cop::Homebrew::NoFileutilsRmrf do
subject(:cop) { described_class.new }
describe "rm_rf" do
it "registers an offense" do
expect_offense(<<~RUBY)
rm_rf("path/to/directory")
^^^^^^^^^... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/provided_by_macos_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,306 | # typed: false
# frozen_string_literal: true
require "rubocops/uses_from_macos"
RSpec.describe RuboCop::Cop::FormulaAudit::ProvidedByMacos do
subject(:cop) { described_class.new }
it "fails for formulae not in PROVIDED_BY_MACOS_FORMULAE list" do
expect_offense(<<~RUBY)
class Baz < Formula
url "... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/io_read_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,411 | # typed: false
# frozen_string_literal: true
require "rubocops/io_read"
RSpec.describe RuboCop::Cop::Homebrew::IORead do
subject(:cop) { described_class.new }
it "reports an offense when `IO.read` is used with a pipe character" do
expect_offense(<<~RUBY)
IO.read("|echo test")
^^^^^^^^^^^^^^^^^^^^... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/components_order_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 38,117 | # typed: false
# frozen_string_literal: true
require "rubocops/components_order"
RSpec.describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
subject(:cop) { described_class.new }
context "when auditing formula components order" do
it "reports and corrects an offense when `uses_from_macos` precedes `depends... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/compact_blank_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 3,194 | # typed: false
# frozen_string_literal: true
require "rubocops/compact_blank"
RSpec.describe RuboCop::Cop::Homebrew::CompactBlank, :config do
it "registers and corrects an offense when using `reject { |e| e.blank? }`" do
expect_offense(<<~RUBY)
collection.reject { |e| e.blank? }
^^^^^^^^^... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/shell_commands_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 6,030 | # typed: false
# frozen_string_literal: true
require "rubocops/shell_commands"
RSpec.describe RuboCop::Cop::Homebrew::ShellCommands do
subject(:cop) { described_class.new }
context "when auditing shell commands" do
it "reports and corrects an offense when `system` arguments should be separated" do
expe... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/safe_navigation_with_blank_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,217 | # typed: false
# frozen_string_literal: true
require "rubocops/safe_navigation_with_blank"
RSpec.describe RuboCop::Cop::Homebrew::SafeNavigationWithBlank, :config do
context "when in a conditional" do
it "registers an offense on a single conditional" do
expect_offense(<<~RUBY)
do_something unless ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/urls_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 14,132 | # typed: false
# frozen_string_literal: true
require "rubocops/urls"
RSpec.describe RuboCop::Cop::FormulaAudit::Urls do
subject(:cop) { described_class.new }
let(:offense_list) do
[{
"url" => "https://ftp.gnu.org/lightning/lightning-2.1.0.tar.gz",
"msg" => "https://ftp.gnu.org/lightning/lightning... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/move_to_extend_os_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,761 | # typed: false
# frozen_string_literal: true
require "rubocops/move_to_extend_os"
RSpec.describe RuboCop::Cop::Homebrew::MoveToExtendOS do
subject(:cop) { described_class.new }
it "registers an offense when using `OS.linux?`" do
expect_offense(<<~RUBY)
OS.linux?
^^^^^^^^^ Homebrew/MoveToExtendOS:... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/dependency_order_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 10,904 | # typed: false
# frozen_string_literal: true
require "rubocops/dependency_order"
RSpec.describe RuboCop::Cop::FormulaAudit::DependencyOrder do
subject(:cop) { described_class.new }
context "when auditing `uses_from_macos`" do
it "reports and corrects incorrectly ordered conditional dependencies" do
exp... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/patches_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 17,727 | # typed: false
# frozen_string_literal: true
require "rubocops/patches"
RSpec.describe RuboCop::Cop::FormulaAudit::Patches do
subject(:cop) { described_class.new }
def expect_offense_hash(message:, severity:, line:, column:, source:)
[{ message:, severity:, line:, column:, source: }]
end
context "when a... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/uses_from_macos_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,885 | # typed: false
# frozen_string_literal: true
require "rubocops/uses_from_macos"
RSpec.describe RuboCop::Cop::FormulaAudit::UsesFromMacos do
subject(:cop) { described_class.new }
context "when auditing `uses_from_macos` dependencies" do
it "reports an offense when used on non-macOS dependency" do
expect... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/text_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 8,462 | # typed: false
# frozen_string_literal: true
require "rubocops/text"
RSpec.describe RuboCop::Cop::FormulaAudit::Text do
subject(:cop) { described_class.new }
context "when auditing formula text" do
it 'reports an offense if `require "formula"` is present' do
expect_offense(<<~RUBY)
require "for... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/zero_zero_zero_zero_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 3,790 | # typed: false
# frozen_string_literal: true
require "rubocops/zero_zero_zero_zero"
RSpec.describe RuboCop::Cop::FormulaAudit::ZeroZeroZeroZero do
subject(:cop) { described_class.new }
it "reports no offenses when 0.0.0.0 is used inside test do blocks" do
expect_no_offenses(<<~RUBY, "/homebrew-core/")
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/resource_requires_dependencies_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 7,041 | # typed: false
# frozen_string_literal: true
require "rubocops/resource_requires_dependencies"
RSpec.describe RuboCop::Cop::FormulaAudit::ResourceRequiresDependencies do
subject(:cop) { described_class.new }
context "when a formula does not have any resources" do
it "does not report offenses" do
expect... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/non_public_api_usage_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,707 | # typed: false
# frozen_string_literal: true
require "rubocops/non_public_api_usage"
RSpec.describe RuboCop::Cop::FormulaAudit::NonPublicApiUsage do
subject(:cop) { described_class.new }
before do
allow(RuboCop::Cop::ApiAnnotationHelper).to receive(:methods_with_api_level).and_return(Set.new)
allow(RuboC... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/presence_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 11,476 | # typed: false
# frozen_string_literal: true
require "rubocops/presence"
RSpec.describe RuboCop::Cop::Homebrew::Presence, :config do
it "registers an offense and corrects when `a.present? ? a : nil`" do
expect_offense(<<~RUBY)
a.present? ? a : nil
^^^^^^^^^^^^^^^^^^^^ Use `a.presence` instead of `a.... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/conflicts_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,364 | # typed: false
# frozen_string_literal: true
require "rubocops/conflicts"
RSpec.describe RuboCop::Cop::FormulaAudit::Conflicts do
subject(:cop) { described_class.new }
context "when auditing `conflicts_with`" do
it "reports and corrects an offense if reason is capitalized" do
expect_offense(<<~RUBY, "/... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/options_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,802 | # typed: false
# frozen_string_literal: true
require "rubocops/options"
RSpec.describe RuboCop::Cop::FormulaAudit::Options do
subject(:cop) { described_class.new }
context "when auditing options" do
it "reports an offense when using bad option names" do
expect_offense(<<~RUBY)
class Foo < Formu... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/files_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 675 | # typed: false
# frozen_string_literal: true
require "rubocops/files"
RSpec.describe RuboCop::Cop::FormulaAudit::Files do
subject(:cop) { described_class.new }
context "when auditing files" do
it "reports an offense when the permissions are invalid" do
filename = Formulary.core_path("test_formula")
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/urls/git_strict_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 2,771 | # typed: false
# 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-co... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/urls/http_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 4,568 | # typed: false
# frozen_string_literal: true
require "rubocops/urls"
RSpec.describe RuboCop::Cop::FormulaAudit::HttpUrls do
subject(:cop) { described_class.new }
context "when auditing HTTP URLs" do
it "reports an offense for http:// URLs in homebrew-core" do
expect_offense(<<~RUBY, "/homebrew-core/")
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/urls/git_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 3,550 | # typed: false
# 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/")
clas... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/urls/pypi_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,430 | # typed: false
# 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
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/cask/variables_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 4,906 | # typed: false
# 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`... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/cask/deprecate_disable_unsigned_reason_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,260 | # typed: false
# 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... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/cask/url_legacy_comma_separators_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,760 | # typed: false
# 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-#{vers... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 11,785 | # typed: false
# 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
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/cask/on_system_conditionals_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 15,805 | # typed: false
# 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
postfl... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/cask/url_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 7,167 | # typed: false
# 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.... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/cask/homepage_url_styling_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 896 | # typed: false
# 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 ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/cask/stanza_order_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 12,662 | # typed: false
# 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
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/cask/desc_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 3,480 | # typed: false
# 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/... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test/rubocops/cask/discontinued_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 1,769 | # typed: false
# 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",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.