audit (strict): check a test is present.
This commit is contained in:
parent
d263c73cc4
commit
f3a5a83452
@ -56,6 +56,10 @@ 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
|
||||||
@ -104,6 +108,12 @@ 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
|
||||||
|
|
||||||
|
if @strict
|
||||||
|
unless text.has_test?
|
||||||
|
problem "A `test do` test block should be added"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@aliases ||= Formula.aliases
|
@@aliases ||= Formula.aliases
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user