diff options
| author | Mike McQuaid | 2017-09-22 20:34:08 +0100 |
|---|---|---|
| committer | GitHub | 2017-09-22 20:34:08 +0100 |
| commit | 199aa956ccad5ec7034e3d1f2011fee4bcd9b784 (patch) | |
| tree | 6b6e308a4fbf3706ed7450546186f7558f44380d | |
| parent | c4b6dbf6533dcf98e388620bd96081d1a557aa73 (diff) | |
| parent | 626cb6ca91f99df6f7c646d95cb5e82d0dd6532d (diff) | |
| download | brew-199aa956ccad5ec7034e3d1f2011fee4bcd9b784.tar.bz2 | |
Merge pull request #3144 from GauthamGoli/audit_line_rubocop_more_tests
audit: Add more tests for FormulaAudit/Miscellaneous cop
| -rw-r--r-- | Library/Homebrew/test/rubocops/lines_cop_spec.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Library/Homebrew/test/rubocops/lines_cop_spec.rb b/Library/Homebrew/test/rubocops/lines_cop_spec.rb index 31aafbcf8..d93962688 100644 --- a/Library/Homebrew/test/rubocops/lines_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/lines_cop_spec.rb @@ -380,6 +380,21 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do 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 @@ -450,6 +465,19 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do 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 @@ -471,5 +499,18 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do 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 |
