Skip to content

Commit

Permalink
Update livecheck test fixtures to use deprecate! and disable!
Browse files Browse the repository at this point in the history
  • Loading branch information
Rylan12 committed Dec 17, 2023
1 parent e5f20f9 commit 78022f5
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 19 deletions.
20 changes: 16 additions & 4 deletions Library/Homebrew/test/cask/audit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -529,14 +529,26 @@ def tmp_cask(name, text)
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
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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"

app "TestCask.app"
disable! date: "2023-01-01", because: :discontinued

caveats do
discontinued
end
app "TestCask.app"
end

0 comments on commit 78022f5

Please sign in to comment.