rubocops/cask: Add another test case to check I've done it right?
- I wrote this because I was concerned that I'd done something wrong since `brew style --only=Cask/NoOverrides` in `$(brew --repo homebrew/cask)` didn't report any offenses. Turns out I'd just missed the `.` off the end of the command to target the current directory! But, the cost of writing the test is sunk now, and more tests can't hurt?
This commit is contained in:
parent
1e18e88c68
commit
478ba9b604
@ -59,6 +59,47 @@ describe RuboCop::Cop::Cask::NoOverrides do
|
||||
include_examples "does not report any offenses"
|
||||
end
|
||||
|
||||
context "when there are multiple differences between the `on_*` blocks" do
|
||||
let(:source) do
|
||||
<<~CASK
|
||||
cask "foo" do
|
||||
version "1.2.3"
|
||||
sha256 "aaa"
|
||||
url "https://brew.sh/foo-2.3.4.dmg"
|
||||
|
||||
on_big_sur :or_older do
|
||||
sha256 "bbb"
|
||||
url "https://brew.sh/legacy/foo-2.3.4.dmg"
|
||||
end
|
||||
end
|
||||
CASK
|
||||
end
|
||||
|
||||
let(:expected_offenses) do
|
||||
[{
|
||||
message: <<~EOS,
|
||||
Do not use a top-level `sha256` stanza as the default. Add it to an `on_{system}` block instead.
|
||||
Use `:or_older` or `:or_newer` to specify a range of macOS versions.
|
||||
EOS
|
||||
severity: :convention,
|
||||
line: 3,
|
||||
column: 2,
|
||||
source: "sha256 \"aaa\"",
|
||||
}, {
|
||||
message: <<~EOS,
|
||||
Do not use a top-level `url` stanza as the default. Add it to an `on_{system}` block instead.
|
||||
Use `:or_older` or `:or_newer` to specify a range of macOS versions.
|
||||
EOS
|
||||
severity: :convention,
|
||||
line: 4,
|
||||
column: 2,
|
||||
source: "url \"https://brew.sh/foo-2.3.4.dmg\"",
|
||||
}]
|
||||
end
|
||||
|
||||
include_examples "reports offenses"
|
||||
end
|
||||
|
||||
context "when there are top-level standalone stanzas" do
|
||||
let(:source) do
|
||||
<<~CASK
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user