Update livecheck test fixtures to use deprecate! and disable!

This commit is contained in:
Rylan Polster 2023-12-16 20:37:01 -05:00
parent 4793677123
commit 254fcf7c1f
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64
5 changed files with 63 additions and 19 deletions

View File

@ -529,14 +529,26 @@ describe Cask::Audit, :cask do
it { is_expected.not_to error_with(message) }
end
context "when the Cask is discontinued" do
let(:cask_token) { "livecheck/livecheck-discontinued" }
context "when the Cask is deprecated" do
let(:cask_token) { "livecheck/livecheck-deprecated" }
it { is_expected.not_to error_with(message) }
end
context "when the Cask has a livecheck block referencing a discontinued Cask" do
let(:cask_token) { "livecheck/livecheck-discontinued-reference" }
context "when the Cask has a livecheck block referencing a deprecated Cask" do
let(:cask_token) { "livecheck/livecheck-deprecated-reference" }
it { is_expected.not_to error_with(message) }
end
context "when the Cask is disabled" do
let(:cask_token) { "livecheck/livecheck-disabled" }
it { is_expected.not_to error_with(message) }
end
context "when the Cask has a livecheck block referencing a disabled Cask" do
let(:cask_token) { "livecheck/livecheck-disabled-reference" }
it { is_expected.not_to error_with(message) }
end

View File

@ -1,17 +1,17 @@
cask "livecheck-discontinued-reference" do
cask "livecheck-deprecated-reference" do
version "1.2.3"
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
# This cask is used in --online tests, so we use fake URLs to avoid impacting
# real servers. The URL paths are specific enough that they'll be
# understandable if they appear in local server logs.
url "http://localhost/homebrew/test/cask/audit/livecheck/discontinued-#{version}.dmg"
name "Discontinued Reference"
desc "Cask for testing a livecheck reference to a discontinued cask"
homepage "http://localhost/homebrew/test/cask/audit/livecheck/discontinued"
url "http://localhost/homebrew/test/cask/audit/livecheck/deprecated-#{version}.dmg"
name "Deprecated Reference"
desc "Cask for testing a livecheck reference to a deprecated cask"
homepage "http://localhost/homebrew/test/cask/audit/livecheck/deprecated"
livecheck do
cask "livecheck/livecheck-discontinued"
cask "livecheck/livecheck-deprecated"
end
app "TestCask.app"

View File

@ -0,0 +1,16 @@
cask "livecheck-deprecated" do
version "1.2.3"
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
# This cask is used in --online tests, so we use fake URLs to avoid impacting
# real servers. The URL paths are specific enough that they'll be
# understandable if they appear in local server logs.
url "http://localhost/homebrew/test/cask/audit/livecheck/deprecated-#{version}.dmg"
name "Deprecated"
desc "Cask for testing deprecated in livecheck"
homepage "http://localhost/homebrew/test/cask/audit/livecheck/deprecated"
deprecate! date: "2023-01-01", because: :discontinued
app "TestCask.app"
end

View File

@ -0,0 +1,18 @@
cask "livecheck-disabled-reference" do
version "1.2.3"
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
# This cask is used in --online tests, so we use fake URLs to avoid impacting
# real servers. The URL paths are specific enough that they'll be
# understandable if they appear in local server logs.
url "http://localhost/homebrew/test/cask/audit/livecheck/disabled-#{version}.dmg"
name "Disabled Reference"
desc "Cask for testing a livecheck reference to a disabled cask"
homepage "http://localhost/homebrew/test/cask/audit/livecheck/disabled"
livecheck do
cask "livecheck/livecheck-disabled"
end
app "TestCask.app"
end

View File

@ -1,18 +1,16 @@
cask "livecheck-discontinued" do
cask "livecheck-disabled" do
version "1.2.3"
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
# This cask is used in --online tests, so we use fake URLs to avoid impacting
# real servers. The URL paths are specific enough that they'll be
# understandable if they appear in local server logs.
url "http://localhost/homebrew/test/cask/audit/livecheck/discontinued-#{version}.dmg"
name "Discontinued"
desc "Cask for testing discontinued in livecheck"
homepage "http://localhost/homebrew/test/cask/audit/livecheck/discontinued"
url "http://localhost/homebrew/test/cask/audit/livecheck/disabled-#{version}.dmg"
name "Disabled"
desc "Cask for testing disabled in livecheck"
homepage "http://localhost/homebrew/test/cask/audit/livecheck/disabled"
disable! date: "2023-01-01", because: :discontinued
app "TestCask.app"
caveats do
discontinued
end
end