audit_spec: expect error for uppercase formula

Our docs state that formula filenames must not have uppercase letters.
This adds a test to expect that FormulaAuditor's audit_formula_name
method complains about such a formula.
This commit is contained in:
Steve Peters 2021-05-27 17:45:24 -07:00 committed by GitHub
parent 7ae9cc3467
commit ca6fc4873e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -488,6 +488,32 @@ module Homebrew
end end
end end
describe "#audit_formula_name" do
specify "no issue" do
fa = formula_auditor "foo", <<~RUBY, core_tap: true, strict: true
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
homepage "https://brew.sh"
end
RUBY
fa.audit_formula_name
expect(fa.problems).to be_empty
end
specify "uppercase formula name" do
fa = formula_auditor "Foo", <<~RUBY
class Foo < Formula
url "https://brew.sh/Foo-1.0.tgz"
homepage "https://brew.sh"
end
RUBY
fa.audit_formula_name
expect(fa.problems.first[:message]).to match "must not contain uppercase letters"
end
end
describe "#check_service_command" do describe "#check_service_command" do
specify "Not installed" do specify "Not installed" do
fa = formula_auditor "foo", <<~RUBY fa = formula_auditor "foo", <<~RUBY