Skip to content
Snippets Groups Projects
Unverified Commit 9c914106 authored by nandahkrishna's avatar nandahkrishna
Browse files

dev-cmd/bump: increase test coverage

parent 95c6e92d
No related branches found
No related tags found
No related merge requests found
......@@ -41,18 +41,8 @@ module Homebrew
next
end
current_version = formula.stable.version.to_s
package_data = Repology.single_package_query(formula.name)
repology_latest = if package_data.present?
Repology.latest_version(package_data.values.first)
else
"not found"
end
livecheck_latest = livecheck_result(formula)
pull_requests = retrieve_pull_requests(formula)
display(formula, current_version, repology_latest, livecheck_latest, pull_requests)
retrieve_and_display_info(formula, package_data&.values&.first)
end
else
outdated_packages = Repology.parse_api_response(requested_limit)
......@@ -71,11 +61,7 @@ module Homebrew
next
end
current_version = formula.stable.version.to_s
repology_latest = Repology.latest_version(repositories)
livecheck_latest = livecheck_result(formula)
pull_requests = retrieve_pull_requests(formula)
display(formula, current_version, repology_latest, livecheck_latest, pull_requests)
retrieve_and_display_info(formula, repositories)
break if requested_limit && i >= requested_limit
end
......@@ -110,12 +96,18 @@ module Homebrew
pull_requests
end
def up_to_date?(current_version, repology_latest, livecheck_latest)
current_version == repology_latest &&
current_version == livecheck_latest
end
def retrieve_and_display_info(formula, repositories)
current_version = formula.stable.version.to_s
repology_latest = if repositories.present?
Repology.latest_version(repositories)
else
"not found"
end
livecheck_latest = livecheck_result(formula)
pull_requests = retrieve_pull_requests(formula)
def display(formula, current_version, repology_latest, livecheck_latest, pull_requests)
title = if current_version == repology_latest &&
current_version == livecheck_latest
"#{formula} is up to date!"
......
......@@ -27,5 +27,19 @@ describe "brew bump" do
.and not_to_output.to_stderr
.and be_a_success
end
it "returns no data and prints a message for HEAD-only formulae" do
content = <<~RUBY
desc "HEAD-only test formula"
homepage "https://brew.sh"
head "https://github.com/Homebrew/brew.git"
RUBY
setup_test_formula("headonly", content)
expect { brew "bump", "headonly" }
.to output(/Formula is HEAD-only./).to_stdout
.and not_to_output.to_stderr
.and be_a_success
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment