diff --git a/Library/Homebrew/test/livecheck/strategy/apache_spec.rb b/Library/Homebrew/test/livecheck/strategy/apache_spec.rb index 7bd4d9ae1e..f7c3ebc7d5 100644 --- a/Library/Homebrew/test/livecheck/strategy/apache_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/apache_spec.rb @@ -10,11 +10,11 @@ describe Homebrew::Livecheck::Strategy::Apache do let(:non_apache_url) { "https://brew.sh/test" } describe "::match?" do - it "returns true if the argument provided is an Apache URL" do + it "returns true for an Apache URL" do expect(apache.match?(apache_url)).to be true end - it "returns false if the argument provided is not an Apache URL" do + it "returns false for a non-Apache URL" do expect(apache.match?(non_apache_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/bitbucket_spec.rb b/Library/Homebrew/test/livecheck/strategy/bitbucket_spec.rb index f5c2df857f..341f8240f1 100644 --- a/Library/Homebrew/test/livecheck/strategy/bitbucket_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/bitbucket_spec.rb @@ -10,11 +10,11 @@ describe Homebrew::Livecheck::Strategy::Bitbucket do let(:non_bitbucket_url) { "https://brew.sh/test" } describe "::match?" do - it "returns true if the argument provided is a Bitbucket URL" do + it "returns true for a Bitbucket URL" do expect(bitbucket.match?(bitbucket_url)).to be true end - it "returns false if the argument provided is not a Bitbucket URL" do + it "returns false for a non-Bitbucket URL" do expect(bitbucket.match?(non_bitbucket_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/cpan_spec.rb b/Library/Homebrew/test/livecheck/strategy/cpan_spec.rb index b119216c86..29af780d20 100644 --- a/Library/Homebrew/test/livecheck/strategy/cpan_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/cpan_spec.rb @@ -11,12 +11,12 @@ describe Homebrew::Livecheck::Strategy::Cpan do let(:non_cpan_url) { "https://brew.sh/test" } describe "::match?" do - it "returns true if the argument provided is a CPAN URL" do + it "returns true for a CPAN URL" do expect(cpan.match?(cpan_url_no_subdirectory)).to be true expect(cpan.match?(cpan_url_with_subdirectory)).to be true end - it "returns false if the argument provided is not a CPAN URL" do + it "returns false for a non-CPAN URL" do expect(cpan.match?(non_cpan_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/electron_builder_spec.rb b/Library/Homebrew/test/livecheck/strategy/electron_builder_spec.rb index d76f53d670..801636563b 100644 --- a/Library/Homebrew/test/livecheck/strategy/electron_builder_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/electron_builder_spec.rb @@ -6,8 +6,8 @@ require "livecheck/strategy" describe Homebrew::Livecheck::Strategy::ElectronBuilder do subject(:electron_builder) { described_class } - let(:valid_url) { "https://www.example.com/example/latest-mac.yml" } - let(:invalid_url) { "https://brew.sh/test" } + let(:yaml_url) { "https://www.example.com/example/latest-mac.yml" } + let(:non_yaml_url) { "https://brew.sh/test" } let(:electron_builder_yaml) { <<~EOS @@ -29,12 +29,12 @@ describe Homebrew::Livecheck::Strategy::ElectronBuilder do let(:versions) { ["1.2.3"] } describe "::match?" do - it "returns true for any URL pointing to a YAML file" do - expect(electron_builder.match?(valid_url)).to be true + it "returns true for a YAML file URL" do + expect(electron_builder.match?(yaml_url)).to be true end - it "returns false for a URL not pointing to a YAML file" do - expect(electron_builder.match?(invalid_url)).to be false + it "returns false for non-YAML URL" do + expect(electron_builder.match?(non_yaml_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/git_spec.rb b/Library/Homebrew/test/livecheck/strategy/git_spec.rb index 2a5f9e03b1..cb1a0106a1 100644 --- a/Library/Homebrew/test/livecheck/strategy/git_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/git_spec.rb @@ -39,11 +39,11 @@ describe Homebrew::Livecheck::Strategy::Git do end describe "::match?" do - it "returns true if the argument provided is a Git repository" do + it "returns true for a Git repository URL" do expect(git.match?(git_url)).to be true end - it "returns false if the argument provided is not a Git repository" do + it "returns false for a non-Git URL" do expect(git.match?(non_git_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/github_latest_spec.rb b/Library/Homebrew/test/livecheck/strategy/github_latest_spec.rb index d15088049a..e744b04839 100644 --- a/Library/Homebrew/test/livecheck/strategy/github_latest_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/github_latest_spec.rb @@ -14,19 +14,19 @@ describe Homebrew::Livecheck::Strategy::GithubLatest do let(:non_github_url) { "https://brew.sh/test" } describe "::match?" do - it "returns true if the argument provided is a GitHub release artifact URL" do + it "returns true for a GitHub release artifact URL" do expect(github_latest.match?(github_release_artifact_url)).to be true end - it "returns true if the argument provided is a GitHub tag archive URL" do + it "returns true for a GitHub tag archive URL" do expect(github_latest.match?(github_tag_archive_url)).to be true end - it "returns true if the argument provided is a GitHub repository upload URL" do + it "returns true for a GitHub repository upload URL" do expect(github_latest.match?(github_repository_upload_url)).to be true end - it "returns false if the argument provided is not a GitHub URL" do + it "returns false for a non-GitHub URL" do expect(github_latest.match?(non_github_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/gnome_spec.rb b/Library/Homebrew/test/livecheck/strategy/gnome_spec.rb index 4edf101613..394a5da473 100644 --- a/Library/Homebrew/test/livecheck/strategy/gnome_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/gnome_spec.rb @@ -10,11 +10,11 @@ describe Homebrew::Livecheck::Strategy::Gnome do let(:non_gnome_url) { "https://brew.sh/test" } describe "::match?" do - it "returns true if the argument provided is a GNOME URL" do + it "returns true for a GNOME URL" do expect(gnome.match?(gnome_url)).to be true end - it "returns false if the argument provided is not a GNOME URL" do + it "returns false for a non-GNOME URL" do expect(gnome.match?(non_gnome_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/gnu_spec.rb b/Library/Homebrew/test/livecheck/strategy/gnu_spec.rb index 63e28de011..a235eade20 100644 --- a/Library/Homebrew/test/livecheck/strategy/gnu_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/gnu_spec.rb @@ -11,15 +11,15 @@ describe Homebrew::Livecheck::Strategy::Gnu do let(:non_gnu_url) { "https://brew.sh/test" } describe "::match?" do - it "returns true if the argument provided is a non-Savannah GNU URL" do + it "returns true for a [non-Savannah] GNU URL" do expect(gnu.match?(gnu_url)).to be true end - it "returns false if the argument provided is a Savannah GNU URL" do + it "returns false for a Savannah GNU URL" do expect(gnu.match?(savannah_gnu_url)).to be false end - it "returns false if the argument provided is not a GNU URL" do + it "returns false for a non-GNU URL (not nongnu.org)" do expect(gnu.match?(non_gnu_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/hackage_spec.rb b/Library/Homebrew/test/livecheck/strategy/hackage_spec.rb index 7a393294a7..f9eb06a35b 100644 --- a/Library/Homebrew/test/livecheck/strategy/hackage_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/hackage_spec.rb @@ -11,12 +11,12 @@ describe Homebrew::Livecheck::Strategy::Hackage do let(:non_hackage_url) { "https://brew.sh/test" } describe "::match?" do - it "returns true if the argument provided is a Hackage URL" do + it "returns true for a Hackage URL" do expect(hackage.match?(hackage_url)).to be true expect(hackage.match?(hackage_downloads_url)).to be true end - it "returns false if the argument provided is not a Hackage URL" do + it "returns false for a non-Hackage URL" do expect(hackage.match?(non_hackage_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/header_match_spec.rb b/Library/Homebrew/test/livecheck/strategy/header_match_spec.rb index 65b34c5ff4..7ce7ccf37d 100644 --- a/Library/Homebrew/test/livecheck/strategy/header_match_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/header_match_spec.rb @@ -6,7 +6,8 @@ require "livecheck/strategy" describe Homebrew::Livecheck::Strategy::HeaderMatch do subject(:header_match) { described_class } - let(:url) { "https://www.example.com/" } + let(:http_url) { "https://brew.sh/blog/" } + let(:non_http_url) { "ftp://brew.sh/" } let(:versions) { versions = { @@ -47,8 +48,12 @@ describe Homebrew::Livecheck::Strategy::HeaderMatch do } describe "::match?" do - it "returns true for any URL" do - expect(header_match.match?(url)).to be true + it "returns true for an HTTP URL" do + expect(header_match.match?(http_url)).to be true + end + + it "returns false for a non-HTTP URL" do + expect(header_match.match?(non_http_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/launchpad_spec.rb b/Library/Homebrew/test/livecheck/strategy/launchpad_spec.rb index 150c547784..c55a2144b6 100644 --- a/Library/Homebrew/test/livecheck/strategy/launchpad_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/launchpad_spec.rb @@ -10,11 +10,11 @@ describe Homebrew::Livecheck::Strategy::Launchpad do let(:non_launchpad_url) { "https://brew.sh/test" } describe "::match?" do - it "returns true if the argument provided is a Launchpad URL" do + it "returns true for a Launchpad URL" do expect(launchpad.match?(launchpad_url)).to be true end - it "returns false if the argument provided is not a Launchpad URL" do + it "returns false for a non-Launchpad URL" do expect(launchpad.match?(non_launchpad_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/npm_spec.rb b/Library/Homebrew/test/livecheck/strategy/npm_spec.rb index 2ed3280633..d07f28367d 100644 --- a/Library/Homebrew/test/livecheck/strategy/npm_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/npm_spec.rb @@ -11,12 +11,12 @@ describe Homebrew::Livecheck::Strategy::Npm do let(:non_npm_url) { "https://brew.sh/test" } describe "::match?" do - it "returns true if the argument provided is an npm URL" do + it "returns true for an npm URL" do expect(npm.match?(npm_url)).to be true expect(npm.match?(npm_scoped_url)).to be true end - it "returns false if the argument provided is not an npm URL" do + it "returns false for a non-npm URL" do expect(npm.match?(non_npm_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/page_match_spec.rb b/Library/Homebrew/test/livecheck/strategy/page_match_spec.rb index b9222ff2fc..b7225ba3de 100644 --- a/Library/Homebrew/test/livecheck/strategy/page_match_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/page_match_spec.rb @@ -6,7 +6,9 @@ require "livecheck/strategy" describe Homebrew::Livecheck::Strategy::PageMatch do subject(:page_match) { described_class } - let(:url) { "https://brew.sh/blog/" } + let(:http_url) { "https://brew.sh/blog/" } + let(:non_http_url) { "ftp://brew.sh/" } + let(:regex) { %r{href=.*?/homebrew[._-]v?(\d+(?:\.\d+)+)/?["' >]}i } let(:content) { @@ -50,7 +52,7 @@ describe Homebrew::Livecheck::Strategy::PageMatch do "1.9.0" => Version.new("1.9.0"), }, regex: regex, - url: url, + url: http_url, } } @@ -61,8 +63,12 @@ describe Homebrew::Livecheck::Strategy::PageMatch do } describe "::match?" do - it "returns true for any URL" do - expect(page_match.match?(url)).to be true + it "returns true for an HTTP URL" do + expect(page_match.match?(http_url)).to be true + end + + it "returns false for a non-HTTP URL" do + expect(page_match.match?(non_http_url)).to be false end end @@ -100,7 +106,7 @@ describe Homebrew::Livecheck::Strategy::PageMatch do describe "::find_versions?" do it "finds versions in provided_content" do - expect(page_match.find_versions(url, regex, provided_content: content)) + expect(page_match.find_versions(http_url, regex, provided_content: content)) .to eq(find_versions_cached_return_hash) end end diff --git a/Library/Homebrew/test/livecheck/strategy/pypi_spec.rb b/Library/Homebrew/test/livecheck/strategy/pypi_spec.rb index e8a4ba1b87..9f373829de 100644 --- a/Library/Homebrew/test/livecheck/strategy/pypi_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/pypi_spec.rb @@ -10,11 +10,11 @@ describe Homebrew::Livecheck::Strategy::Pypi do let(:non_pypi_url) { "https://brew.sh/test" } describe "::match?" do - it "returns true if the argument provided is a PyPI URL" do + it "returns true for a PyPI URL" do expect(pypi.match?(pypi_url)).to be true end - it "returns false if the argument provided is not a PyPI URL" do + it "returns false for a non-PyPI URL" do expect(pypi.match?(non_pypi_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/sourceforge_spec.rb b/Library/Homebrew/test/livecheck/strategy/sourceforge_spec.rb index c37c9cdc2e..94e4c0167b 100644 --- a/Library/Homebrew/test/livecheck/strategy/sourceforge_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/sourceforge_spec.rb @@ -10,11 +10,11 @@ describe Homebrew::Livecheck::Strategy::Sourceforge do let(:non_sourceforge_url) { "https://brew.sh/test" } describe "::match?" do - it "returns true if the argument provided is a SourceForge URL" do + it "returns true for a SourceForge URL" do expect(sourceforge.match?(sourceforge_url)).to be true end - it "returns false if the argument provided is not a SourceForge URL" do + it "returns false for a non-SourceForge URL" do expect(sourceforge.match?(non_sourceforge_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/sparkle_spec.rb b/Library/Homebrew/test/livecheck/strategy/sparkle_spec.rb index 0931c98ab2..1a572c827d 100644 --- a/Library/Homebrew/test/livecheck/strategy/sparkle_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/sparkle_spec.rb @@ -7,7 +7,8 @@ require "bundle_version" describe Homebrew::Livecheck::Strategy::Sparkle do subject(:sparkle) { described_class } - let(:url) { "https://www.example.com/example/appcast.xml" } + let(:appcast_url) { "https://www.example.com/example/appcast.xml" } + let(:non_http_url) { "ftp://brew.sh/" } let(:appcast_data) { { @@ -25,7 +26,7 @@ describe Homebrew::Livecheck::Strategy::Sparkle do Example Changelog - #{url} + #{appcast_url} Most recent changes with links to updates. en @@ -52,8 +53,12 @@ describe Homebrew::Livecheck::Strategy::Sparkle do let(:versions) { [item.bundle_version.nice_version] } describe "::match?" do - it "returns true for any URL" do - expect(sparkle.match?(url)).to be true + it "returns true for an HTTP URL" do + expect(sparkle.match?(appcast_url)).to be true + end + + it "returns false for a non-HTTP URL" do + expect(sparkle.match?(non_http_url)).to be false end end diff --git a/Library/Homebrew/test/livecheck/strategy/xorg_spec.rb b/Library/Homebrew/test/livecheck/strategy/xorg_spec.rb index 664797732b..2eee435f49 100644 --- a/Library/Homebrew/test/livecheck/strategy/xorg_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/xorg_spec.rb @@ -10,11 +10,11 @@ describe Homebrew::Livecheck::Strategy::Xorg do let(:non_xorg_url) { "https://brew.sh/test" } describe "::match?" do - it "returns true if the argument provided is an X.Org URL" do + it "returns true for an X.Org URL" do expect(xorg.match?(xorg_url)).to be true end - it "returns false if the argument provided is not an X.Org URL" do + it "returns false for a non-X.Org URL" do expect(xorg.match?(non_xorg_url)).to be false end end