
- 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.
36 lines
858 B
Ruby
36 lines
858 B
Ruby
# typed: false
|
|
# frozen_string_literal: true
|
|
|
|
require "rubocops/rubocop-cask"
|
|
require "test/rubocops/cask/shared_examples/cask_cop"
|
|
|
|
describe RuboCop::Cop::Cask::NoDslVersion do
|
|
include CaskCop
|
|
|
|
subject(:cop) { described_class.new }
|
|
|
|
context "with no dsl version" do
|
|
let(:source) { "cask 'foo' do; end" }
|
|
|
|
include_examples "does not report any offenses"
|
|
end
|
|
|
|
context "with dsl version" do
|
|
let(:source) { "cask :v1 => 'foo' do; end" }
|
|
let(:correct_source) { "cask 'foo' do; end" }
|
|
let(:expected_offenses) do
|
|
[{
|
|
message: "Cask/NoDslVersion: Use `cask 'foo'` instead of `cask :v1 => 'foo'`",
|
|
severity: :convention,
|
|
line: 1,
|
|
column: 0,
|
|
source: "cask :v1 => 'foo'",
|
|
}]
|
|
end
|
|
|
|
include_examples "reports offenses"
|
|
|
|
include_examples "autocorrects source"
|
|
end
|
|
end
|