formula_desc_cop_spec: add whitespace tests
This commit is contained in:
parent
9d7f872ad6
commit
525300b9cd
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user