diff --git a/Library/Homebrew/test/dev-cmd/livecheck_spec.rb b/Library/Homebrew/test/dev-cmd/livecheck_spec.rb index 2aaad5cd0e095b..cd9526e0fe420d 100644 --- a/Library/Homebrew/test/dev-cmd/livecheck_spec.rb +++ b/Library/Homebrew/test/dev-cmd/livecheck_spec.rb @@ -19,7 +19,19 @@ .and be_a_success end - it "gives an error when no arguments are given and there's no watchlist", :integration_test do + # When a watchlist file is present, livecheck parses the formula/cask names + # in the file and ignores any that aren't available. Since formulae and casks + # aren't available in the testing environment, the watchlist file will be + # treated as empty and this produces an `Invalid usage: No formulae or casks + # to check.` error instead. As such, this test will only pass when a + # watchlist file isn't present in the testing environment. + # + # Also note, any older `~/.brew_livecheck_watchlist` file won't be accessible + # from this test (as the home folder is `HOMEBREW_PREFIX/test/`), so we don't + # have to guard against its existence. + it "gives an error when no arguments are given and there's no watchlist", + :integration_test, + if: !File.exist?(Homebrew::EnvConfig.livecheck_watchlist) do expect { brew "livecheck" } .to output(/Invalid usage: A watchlist file is required when no arguments are given\./).to_stderr .and not_to_output.to_stdout