From 525300b9cdf5267065998aa5fff7ddebe7acd4ba Mon Sep 17 00:00:00 2001 From: Dominyk Tiller Date: Mon, 6 Aug 2018 19:19:48 +0100 Subject: [PATCH] formula_desc_cop_spec: add whitespace tests --- .../test/rubocops/formula_desc_cop_spec.rb | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb b/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb index 895c48aa54..76782652c7 100644 --- a/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb @@ -101,6 +101,26 @@ describe RuboCop::Cop::FormulaAuditStrict::Desc do RUBY end + it "When the description starts with a leading space" do + expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb") + class Foo < Formula + url 'http://example.com/foo-1.0.tgz' + desc ' Description with a leading space' + ^ Description shouldn\'t have a leading space + end + RUBY + end + + it "When the description ends with a trailing space" do + expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb") + class Foo < Formula + url 'http://example.com/foo-1.0.tgz' + desc 'Description with a trailing space ' + ^ Description shouldn\'t have a trailing space + end + RUBY + end + it "autocorrects all rules" do source = <<~RUBY class Foo < Formula