Test the shell_output single string edge case

This commit is contained in:
Issy Long 2024-07-25 10:41:13 +01:00
parent ace23ce735
commit a6596c969f
No known key found for this signature in database

View File

@ -144,5 +144,16 @@ RSpec.describe RuboCop::Cop::FormulaAuditStrict::Text do
end end
RUBY RUBY
end 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
end end