Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audit: Add more tests for FormulaAudit/Miscellaneous cop #3144

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 41 additions & 0 deletions Library/Homebrew/test/rubocops/lines_cop_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,21 @@ class Foo < Formula
end
end

it "with build.universal? exempted formula" do
source = <<-EOS.undent
class Wine < Formula
desc "foo"
url 'http://example.com/foo-1.0.tgz'
if build.universal?
"foo"
end
end
EOS

inspect_source(cop, source, "/homebrew-core/Formula/wine.rb")
expect(cop.offenses).to eq([])
end

it "with ENV.universal_binary" do
source = <<-EOS.undent
class Foo < Formula
Expand Down Expand Up @@ -450,6 +465,19 @@ class Foo < Formula
end
end

it "with ruby-macho alternatives audit exempted formula" do
source = <<-EOS.undent
class Cctools < Formula
desc "foo"
url 'http://example.com/foo-1.0.tgz'
system "install_name_tool", "-id"
end
EOS

inspect_source(cop, source, "/homebrew-core/Formula/cctools.rb")
expect(cop.offenses).to eq([])
end

it "with npm install without language::Node args" do
source = <<-EOS.undent
class Foo < Formula
Expand All @@ -471,5 +499,18 @@ class Foo < Formula
expect_offense(expected, actual)
end
end

it "with npm install without language::Node args in kibana" do
source = <<-EOS.undent
class KibanaAT44 < Formula
desc "foo"
url 'http://example.com/foo-1.0.tgz'
system "npm", "install"
end
EOS

inspect_source(cop, source, "/homebrew-core/Formula/kibana@4.4.rb")
expect(cop.offenses).to eq([])
end
end
end