Improve branch test coverage - #3
Closed
dblock wants to merge 1 commit into
Closed
Conversation
Danger ReportNo issues found. |
Coverage Report for CI Build 33869124388Coverage at 99.047% (no base build to compare)Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
…d translation utilities Adds direct unit tests to exercise previously-uncovered branches: - Grape::Exceptions::Base#translate_message (Proc/Hash-pattern/plain-value branches) - Grape::Exceptions::RequestError (new spec file) - Grape::Exceptions::Validation (message omitted case) - Grape::Middleware::Base (instance-level #default_options fallback) - Grape::Middleware::Error (#resolved_backtrace fallback chain, InvalidVersionHeader precedence) - Grape::Namespace.joined_space - Grape::Router::BaseRoute#initialize (ActiveSupport::OrderedOptions wrapping) - Grape::Router::Pattern::Path#suffix (non-path versioning) - Grape::Testing (missing block / no registered hooks) - Grape::Util::Translation#translate (explicit locale / explicit default) Raises the full-matrix branch coverage from 95.58% (1278/1337) to 96.40% (1289/1337), while keeping line coverage at 100%. Not aiming for 100% branch coverage; only the easy, high-signal gaps were closed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dblock
force-pushed
the
improve-branch-coverage
branch
from
September 4, 2026 11:41
bd374a9 to
89fa6b8
Compare
Owner
Author
|
Closing in favor of a PR against ruby-grape/grape master (stacked on ruby-grape#2896). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Stacked on top of ruby-grape#2896 (which brings line coverage to 100%). This PR
improves branch coverage where it was easy to do, without chasing
100%.
Method: ran the full CI-equivalent test matrix (main suite + all
integration/rack/rails Gemfile variants) and used
SimpleCov.collateto get the true combined coverage, then added direct unit tests for
previously-uncovered branches that were easy/cheap to reach:
Grape::Exceptions::Base#translate_message— the Proc, Hash-pattern-match, and plain-value branches.Grape::Exceptions::RequestError— no spec file existed; added one.Grape::Exceptions::Validation— the "message omitted" default branch.Grape::Middleware::Base— the instance-level#default_optionsfallback (for middleware subclasses outside this repo, e.g. 3rd-party gems).Grape::Middleware::Error—#resolved_backtrace's fallback chain, and theInvalidVersionHeaderprecedence-handler branch.Grape::Namespace.joined_space.Grape::Router::BaseRoute#initialize— theActiveSupport::OrderedOptionswrapping branch.Grape::Router::Pattern::Path#suffix— the non-path (e.g. header) versioning branch.Grape::Testing— missing-block and no-registered-hooks branches.Grape::Util::Translation#translate— explicitlocale:and explicitdefault:branches.Result
Full-matrix branch coverage: 95.58% (1278/1337) → 96.40% (1289/1337).
Line coverage stays at 100%. Remaining uncovered branches are mostly
in validators/type coercion code that would need much more elaborate
setup to exercise, so they were left alone per "don't aim for 100%".
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com