From 991e5f2f9c8c388af3c7de65b54e2dce23783992 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 22 Mar 2023 21:41:28 +0000 Subject: [PATCH] Failing test for mishandling contents of `livecheck` blocks in `on_*` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The Cask `little-snitch4` in `Homebrew/homebrew-cask-versions` was failing and it took me a while to figure out _how_. Add a test for easier further debugging (and to prevent breakage once the bug is fixed). ``` ❯ brew tests --only=rubocops/cask/no_overrides Randomized with seed 29917 1 process for 1 spec, ~ 1 spec per process F Failures: 1) RuboCop::Cop::Cask::NoOverrides when there are livecheck blocks within `on_*` blocks, ignore their contents does not report any offenses Failure/Error: DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure } expected `[#, @location=#, @message="Do not use a top-level `url` stanza as the default. Add it to an `on_{system}` block instead.\nUse `:or_older` or `:or_newer` to specify a range of macOS versions.\n", @cop_name="Cask/NoOverrides", @status=:unsupported, @corrector=nil>].empty?` to be truthy, got false Shared Example Group: "does not report any offenses" called from ./test/rubocops/cask/no_overrides_spec.rb:77 # ./test/rubocops/cask/shared_examples/cask_cop.rb:24:in `expect_no_offenses' # ./test/rubocops/cask/shared_examples/cask_cop.rb:7:in `block (2 levels) in ' Took 2 seconds Tests Failed ``` --- Library/Homebrew/test/rubocops/cask/no_overrides_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/test/rubocops/cask/no_overrides_spec.rb b/Library/Homebrew/test/rubocops/cask/no_overrides_spec.rb index 237cbbf721..9cee740498 100644 --- a/Library/Homebrew/test/rubocops/cask/no_overrides_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/no_overrides_spec.rb @@ -61,10 +61,10 @@ describe RuboCop::Cop::Cask::NoOverrides do on_intel do livecheck do url 'https://brew.sh/foo' # Livecheck should be allowed since it's a different "kind" of URL. + strategy :sparkle end version '1.2.3' end - on_arm do version '2.3.4' end