• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ruby-grape / grape / 25862770726 / 3
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: robust_mounted_app_comparison
DEFAULT BRANCH: master
Ran 14 May 2026 01:31PM UTC
Files 158
Run time 12s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

14 May 2026 01:29PM UTC coverage: 95.718% (-0.02%) from 95.738%
25862770726.3

Pull #2716

github

ericproulx
Refactor DSL::Routing#version: guard clause + explicit kwargs

Two changes that touch the same method:

1. Lift the body out of `if args.any? ... end` into a
   `return @versions&.last if args.empty?` guard, so the main flow sits
   at top indentation instead of one level inside an `if`.

2. Replace `**options` with explicit kwargs `(using:, cascade:,
   parameter:, strict:, vendor:)` and bake the defaults into the
   signature (matching `Versioner::Base::DEFAULT_OPTIONS`). The
   per-call `reverse_merge(using: :path)` is gone, and
   `version_options` now stores a fully-resolved hash instead of a
   sparse one. `Versioner::Base::DEFAULT_OPTIONS` is left untouched so
   anyone mounting the middleware directly (some middleware specs do)
   still gets the same safe defaults.

`version_options` is read for exactly these five keys across the
codebase, and nothing else: `:using` (endpoint.rb, path.rb), and
`:cascade`/`:parameter`/`:strict`/`:vendor` (Versioner::Base#initialize,
plus `:cascade` in API::Instance#cascade?). Any other kwarg passed to
`.version` was previously swallowed by the splat with no effect.

Spec fixtures that passed `format:` to `.version` are updated:

- `spec/shared/versioning_examples.rb`: `**macro_options` →
  `**macro_options.except(:format)` at the 14 call sites. `:format`
  stays in `macro_options` so the test helper (`versioned_helpers.rb`)
  can still build the `HTTP_ACCEPT` header.
- `spec/grape/exceptions/invalid_accept_header_spec.rb`: drop
  `format: :json` from 8 direct `.version` calls (it was never read
  on the lib side, and these tests build their Accept header inline).
- `spec/grape/dsl/routing_spec.rb`: the `:version_options` assertion
  now expects the full resolved hash.

No production behaviour change beyond `.version` raising
`ArgumentError` for genuinely unknown kwargs (previously silently
ignored).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull Request #2716: Lift DSL::Routing#version body into a guard clause

1051 of 1159 branches covered (90.68%)

Branch coverage included in aggregate %.

3420 of 3512 relevant lines covered (97.38%)

1006.05 hits per line

Source Files on job run-3.3-Gemfile - 25862770726.3
  • Tree
  • List 158
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 25862770726
  • bfe3768d on github
  • Prev Job for on refactor/version-guard-clause (#25854383996.23)
  • Next Job for on refactor/version-guard-clause (#25862839113.24)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc