formula_desc_cop_spec: add whitespace tests

This commit is contained in:
Dominyk Tiller 2018-08-06 19:19:48 +01:00
parent 9d7f872ad6
commit 525300b9cd
No known key found for this signature in database
GPG Key ID: FE19AEFCF658C6F6

View File

@ -101,6 +101,26 @@ describe RuboCop::Cop::FormulaAuditStrict::Desc do
RUBY RUBY
end 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 it "autocorrects all rules" do
source = <<~RUBY source = <<~RUBY
class Foo < Formula class Foo < Formula