aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorDominyk Tiller2017-10-10 15:43:07 +0100
committerDominyk Tiller2017-10-14 02:50:08 +0100
commit29070e5cbecad6553b29bb482ce94352682b9c64 (patch)
tree326c766f48ad5800e3c57e197f16d058791cdc74 /Library
parent075f818118387b0d4a198732ba9632cad9607633 (diff)
downloadbrew-29070e5cbecad6553b29bb482ce94352682b9c64.tar.bz2
formula_desc_cop_spec: add empty string test
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb b/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb
index ac8893e18..4816c3b26 100644
--- a/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb
+++ b/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb
@@ -27,6 +27,27 @@ describe RuboCop::Cop::FormulaAuditStrict::DescLength do
end
end
+ it "reports an offense when desc is an empty string" do
+ source = <<-EOS.undent
+ class Foo < Formula
+ url 'http://example.com/foo-1.0.tgz'
+ desc ''
+ end
+ EOS
+
+ msg = "The desc (description) should not be an empty string."
+ expected_offenses = [{ message: msg,
+ severity: :convention,
+ line: 3,
+ column: 2,
+ source: source }]
+
+ inspect_source(source, "/homebrew-core/Formula/foo.rb")
+ expected_offenses.zip(cop.offenses).each do |expected, actual|
+ expect_offense(expected, actual)
+ end
+ end
+
it "When desc is too long" do
source = <<-EOS.undent
class Foo < Formula