Added resources' tests for use_homebrew_curl? method (brew tests --only=livecheck/livecheck)
This commit is contained in:
parent
7ae71097ee
commit
e15f0b22b9
@ -155,6 +155,7 @@ describe Homebrew::Livecheck do
|
||||
homepage "https://brew.sh"
|
||||
url "https://brew.sh/test-0.0.1.tgz"
|
||||
head "https://github.com/Homebrew/brew.git"
|
||||
|
||||
resource "foo" do
|
||||
url "https://brew.sh/foo-1.0.tar.gz"
|
||||
sha256 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
|
||||
@ -254,6 +255,27 @@ describe Homebrew::Livecheck do
|
||||
end
|
||||
end
|
||||
|
||||
let(:f_r_homebrew_curl) do
|
||||
formula("test_homebrew_curl") do
|
||||
desc "Test homebrew_curl formula"
|
||||
homepage "https://brew.sh"
|
||||
url "https://brew.sh/test-0.0.1.tgz"
|
||||
head "https://github.com/Homebrew/brew.git"
|
||||
|
||||
resource "foo" do
|
||||
url "https://brew.sh/foo-1.0.tar.gz", using: :homebrew_curl
|
||||
sha256 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
|
||||
|
||||
livecheck do
|
||||
url "https://brew.sh/test/releases"
|
||||
regex(/foo[._-]v?(\d+(?:\.\d+)+)\.t/i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
let(:r_homebrew_curl) { f_r_homebrew_curl.resources.first }
|
||||
|
||||
let(:c_homebrew_curl) do
|
||||
Cask::CaskLoader.load(+<<-RUBY)
|
||||
cask "test" do
|
||||
@ -286,6 +308,13 @@ describe Homebrew::Livecheck do
|
||||
expect(livecheck.use_homebrew_curl?(c_homebrew_curl, example_url)).to be(false)
|
||||
end
|
||||
|
||||
it "returns `false` if a `using: homebrew_curl` is present in a resource url" do
|
||||
expect(livecheck.use_homebrew_curl?(r_homebrew_curl, livecheck_url)).to be(false)
|
||||
expect(livecheck.use_homebrew_curl?(r_homebrew_curl, homepage_url)).to be(false)
|
||||
expect(livecheck.use_homebrew_curl?(r_homebrew_curl, stable_url)).to be(false)
|
||||
expect(livecheck.use_homebrew_curl?(r_homebrew_curl, example_url)).to be(false)
|
||||
end
|
||||
|
||||
it "returns `false` if a `using: homebrew_curl` URL is not present" do
|
||||
expect(livecheck.use_homebrew_curl?(f, livecheck_url)).to be(false)
|
||||
expect(livecheck.use_homebrew_curl?(f, homepage_url)).to be(false)
|
||||
@ -299,6 +328,7 @@ describe Homebrew::Livecheck do
|
||||
|
||||
it "returns `false` if URL string does not contain a domain" do
|
||||
expect(livecheck.use_homebrew_curl?(f_homebrew_curl, "test")).to be(false)
|
||||
expect(livecheck.use_homebrew_curl?(r_homebrew_curl, "test")).to be(false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user