Expand livecheck/livecheck tests
This commit is contained in:
parent
3261bbc0bd
commit
732e67d5db
@ -47,6 +47,24 @@ describe Homebrew::Livecheck do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let(:c_discontinued) do
|
||||||
|
Cask::CaskLoader.load(+<<-RUBY)
|
||||||
|
cask "test_discontinued" do
|
||||||
|
version "0.0.1"
|
||||||
|
sha256 :no_check
|
||||||
|
|
||||||
|
url "https://brew.sh/test-0.0.1.tgz"
|
||||||
|
name "Test Discontinued"
|
||||||
|
desc "Discontinued test cask"
|
||||||
|
homepage "https://brew.sh"
|
||||||
|
|
||||||
|
caveats do
|
||||||
|
discontinued
|
||||||
|
end
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
end
|
||||||
|
|
||||||
let(:f_disabled) do
|
let(:f_disabled) do
|
||||||
formula("test_disabled") do
|
formula("test_disabled") do
|
||||||
desc "Disabled test formula"
|
desc "Disabled test formula"
|
||||||
@ -64,6 +82,34 @@ describe Homebrew::Livecheck do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let(:c_latest) do
|
||||||
|
Cask::CaskLoader.load(+<<-RUBY)
|
||||||
|
cask "test_latest" do
|
||||||
|
version :latest
|
||||||
|
sha256 :no_check
|
||||||
|
|
||||||
|
url "https://brew.sh/test-0.0.1.tgz"
|
||||||
|
name "Test Latest"
|
||||||
|
desc "Latest test cask"
|
||||||
|
homepage "https://brew.sh"
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
end
|
||||||
|
|
||||||
|
# `URL#unversioned?` doesn't work properly when using the
|
||||||
|
# `Cask::CaskLoader.load` setup above, so we use `Cask::Cask.new` instead.
|
||||||
|
let(:c_unversioned) do
|
||||||
|
Cask::Cask.new "test_unversioned" do
|
||||||
|
version "1.2.3"
|
||||||
|
sha256 :no_check
|
||||||
|
|
||||||
|
url "https://brew.sh/test.tgz"
|
||||||
|
name "Test Unversioned"
|
||||||
|
desc "Unversioned test cask"
|
||||||
|
homepage "https://brew.sh"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
let(:f_head_only) do
|
let(:f_head_only) do
|
||||||
formula("test_head_only") do
|
formula("test_head_only") do
|
||||||
desc "HEAD-only test formula"
|
desc "HEAD-only test formula"
|
||||||
@ -133,6 +179,12 @@ describe Homebrew::Livecheck do
|
|||||||
.and not_to_output.to_stderr
|
.and not_to_output.to_stderr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "skips a discontinued cask without a livecheckable" do
|
||||||
|
expect { livecheck.skip_conditions(c_discontinued) }
|
||||||
|
.to output("test_discontinued : discontinued\n").to_stdout
|
||||||
|
.and not_to_output.to_stderr
|
||||||
|
end
|
||||||
|
|
||||||
it "skips a disabled formula without a livecheckable" do
|
it "skips a disabled formula without a livecheckable" do
|
||||||
expect { livecheck.skip_conditions(f_disabled) }
|
expect { livecheck.skip_conditions(f_disabled) }
|
||||||
.to output("test_disabled : disabled\n").to_stdout
|
.to output("test_disabled : disabled\n").to_stdout
|
||||||
@ -145,6 +197,18 @@ describe Homebrew::Livecheck do
|
|||||||
.and not_to_output.to_stderr
|
.and not_to_output.to_stderr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "skips a cask containing `version :latest` without a livecheckable" do
|
||||||
|
expect { livecheck.skip_conditions(c_latest) }
|
||||||
|
.to output("test_latest : latest\n").to_stdout
|
||||||
|
.and not_to_output.to_stderr
|
||||||
|
end
|
||||||
|
|
||||||
|
it "skips a cask containing an unversioned URL without a livecheckable" do
|
||||||
|
expect { livecheck.skip_conditions(c_unversioned) }
|
||||||
|
.to output("test_unversioned : unversioned\n").to_stdout
|
||||||
|
.and not_to_output.to_stderr
|
||||||
|
end
|
||||||
|
|
||||||
it "skips a HEAD-only formula if not installed" do
|
it "skips a HEAD-only formula if not installed" do
|
||||||
expect { livecheck.skip_conditions(f_head_only) }
|
expect { livecheck.skip_conditions(f_head_only) }
|
||||||
.to output("test_head_only : HEAD only formula must be installed to be livecheckable\n").to_stdout
|
.to output("test_head_only : HEAD only formula must be installed to be livecheckable\n").to_stdout
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user