audit: simplify test defined check.
This commit is contained in:
parent
13239276f0
commit
8458540afb
@ -41,7 +41,6 @@ class FormulaText
|
|||||||
@text = path.open("rb", &:read)
|
@text = path.open("rb", &:read)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def without_patch
|
def without_patch
|
||||||
@text.split("\n__END__").first
|
@text.split("\n__END__").first
|
||||||
end
|
end
|
||||||
@ -57,10 +56,6 @@ class FormulaText
|
|||||||
def has_trailing_newline?
|
def has_trailing_newline?
|
||||||
/\Z\n/ =~ @text
|
/\Z\n/ =~ @text
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_test?
|
|
||||||
@text.include? "test do"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class FormulaAuditor
|
class FormulaAuditor
|
||||||
@ -109,9 +104,11 @@ class FormulaAuditor
|
|||||||
unless text.has_trailing_newline?
|
unless text.has_trailing_newline?
|
||||||
problem "File should end with a newline"
|
problem "File should end with a newline"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def audit_class
|
||||||
if @strict
|
if @strict
|
||||||
unless text.has_test?
|
unless formula.test_defined?
|
||||||
problem "A `test do` test block should be added"
|
problem "A `test do` test block should be added"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -595,6 +592,7 @@ class FormulaAuditor
|
|||||||
|
|
||||||
def audit
|
def audit
|
||||||
audit_file
|
audit_file
|
||||||
|
audit_class
|
||||||
audit_specs
|
audit_specs
|
||||||
audit_urls
|
audit_urls
|
||||||
audit_deps
|
audit_deps
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user