test/rubocops/formula_desc: Ensure autocorrect when desc ends in .

- This was another thing that I should have done in PR 3411 in 2017,
  tested that the regex for autocorrecting `desc` stanzas ending in full
  stops actually worked. At least I'm getting to it now.
This commit is contained in:
Issy Long 2022-11-03 23:11:41 +00:00
parent f3d43110b5
commit 6f2f97b98f
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4

View File

@ -118,12 +118,19 @@ describe RuboCop::Cop::FormulaAudit::Desc do
RUBY RUBY
end end
it "reports an offense when the description ends with a full stop" do it "report and corrects an offense when the description ends with a full stop" do
expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb") expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb")
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc 'Description with a full stop at the end.' desc 'Description with a full stop at the end.'
^ Description shouldn\'t end with a full stop. ^ Description shouldn't end with a full stop.
end
RUBY
expect_correction(<<~RUBY)
class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz'
desc 'Description with a full stop at the end'
end end
RUBY RUBY
end end