From 8458540afbee9376491471a5feaf10d5823274c8 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 27 Dec 2014 20:46:01 +0000 Subject: [PATCH] audit: simplify test defined check. --- Library/Homebrew/cmd/audit.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index d4bc0be20e..79fe0a8cf7 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -41,7 +41,6 @@ class FormulaText @text = path.open("rb", &:read) end - def without_patch @text.split("\n__END__").first end @@ -57,10 +56,6 @@ class FormulaText def has_trailing_newline? /\Z\n/ =~ @text end - - def has_test? - @text.include? "test do" - end end class FormulaAuditor @@ -109,9 +104,11 @@ class FormulaAuditor unless text.has_trailing_newline? problem "File should end with a newline" end + end + def audit_class if @strict - unless text.has_test? + unless formula.test_defined? problem "A `test do` test block should be added" end end @@ -595,6 +592,7 @@ class FormulaAuditor def audit audit_file + audit_class audit_specs audit_urls audit_deps