Issy Long da734a30c2
Say yes to RuboCop's DisplayCopNames; fix test expectations
- Fixing the test expected output was unbelievably tedious.
- There's been debate about this setting being `false` but in
  https://github.com/Homebrew/brew/pull/15136#issuecomment-1500063225
  we decided that it was worth using the default since RuboCop behaviour changed
  so we'd have had to do some horrible things to keep it as `false` -
  https://github.com/Homebrew/brew/pull/15136#issuecomment-1500037278 -
  and multiple maintainers specify the `--display-cop-names` option to
  `brew style` themselves since it's clearer what's gone wrong.
2023-04-07 19:14:07 +01:00

61 lines
1.8 KiB
Ruby

# typed: false
# frozen_string_literal: true
require "rubocops/lines"
describe RuboCop::Cop::FormulaAudit::Lines do
subject(:cop) { described_class.new }
context "when auditing deprecated special dependencies" do
it "reports an offense when using depends_on :automake" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz'
depends_on :automake
^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Lines: :automake is deprecated. Usage should be "automake".
end
RUBY
end
it "reports an offense when using depends_on :autoconf" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz'
depends_on :autoconf
^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Lines: :autoconf is deprecated. Usage should be "autoconf".
end
RUBY
end
it "reports an offense when using depends_on :libtool" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz'
depends_on :libtool
^^^^^^^^^^^^^^^^^^^ FormulaAudit/Lines: :libtool is deprecated. Usage should be "libtool".
end
RUBY
end
it "reports an offense when using depends_on :apr" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz'
depends_on :apr
^^^^^^^^^^^^^^^ FormulaAudit/Lines: :apr is deprecated. Usage should be "apr-util".
end
RUBY
end
it "reports an offense when using depends_on :tex" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz'
depends_on :tex
^^^^^^^^^^^^^^^ FormulaAudit/Lines: :tex is deprecated.
end
RUBY
end
end
end