class_cop_spec: add tests for tighter test audit

This commit is contained in:
Dominyk Tiller 2018-08-07 03:39:47 +01:00
parent b8948129b8
commit 7d5f0df71d
No known key found for this signature in database
GPG Key ID: FE19AEFCF658C6F6

View File

@ -59,4 +59,29 @@ describe RuboCop::Cop::FormulaAuditStrict::Test do
end
RUBY
end
it "reports an offense when there is an empty test block" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'https://example.com/foo-1.0.tgz'
test do
^^^^^^^ `test do` should not be empty
end
end
RUBY
end
it "reports an offense when test is falsely true" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'https://example.com/foo-1.0.tgz'
test do
^^^^^^^ `test do` should contain a real test
true
end
end
RUBY
end
end