From a6596c969f86eb0f1e95b175d90092f4bca40835 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 25 Jul 2024 10:41:13 +0100 Subject: [PATCH] Test the `shell_output` single string edge case --- Library/Homebrew/test/rubocops/text/strict_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Library/Homebrew/test/rubocops/text/strict_spec.rb b/Library/Homebrew/test/rubocops/text/strict_spec.rb index f802cb376d..8ccd8ef678 100644 --- a/Library/Homebrew/test/rubocops/text/strict_spec.rb +++ b/Library/Homebrew/test/rubocops/text/strict_spec.rb @@ -144,5 +144,16 @@ RSpec.describe RuboCop::Cop::FormulaAuditStrict::Text do end RUBY end + + it 'reports an offense if "\#{bin}" is in a `shell_output` string' do + expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb") + class Foo < Formula + test do + shell_output("\#{bin}/foo --version") + ^^^^^^^^^^^^^^^^^^^^^^ FormulaAuditStrict/Text: Use `bin/"foo"` instead of `"\#{bin}/foo"` + end + end + RUBY + end end end