Skip to content

Commit

Permalink
Merge pull request #3144 from GauthamGoli/audit_line_rubocop_more_tests
Browse files Browse the repository at this point in the history
audit: Add more tests for FormulaAudit/Miscellaneous cop
  • Loading branch information
MikeMcQuaid committed Sep 22, 2017
2 parents c4b6dbf + 626cb6c commit 199aa95
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Library/Homebrew/test/rubocops/lines_cop_spec.rb
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

0 comments on commit 199aa95

Please sign in to comment.