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

ruby-grape / grape / 25863247528 / 17
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: robust_mounted_app_comparison
DEFAULT BRANCH: master
Ran 14 May 2026 01:41PM UTC
Files 159
Run time 6s
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:39PM UTC coverage: 95.718% (-0.02%) from 95.738%
25863247528.17

Pull #2716

github

ericproulx
Refactor DSL::Routing#version: guard clause, explicit kwargs, value object

Three 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.

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.

3. Store a `Grape::DSL::VersionOptions` value object (built on
   `Data.define`) on the inheritable setting instead of a Hash. The
   public `.version` DSL still accepts and resolves kwargs the same
   way — the value object is an internal-only representation. Internal
   readers (`Path`, `Endpoint#build_stack`, `API::Instance#cascade?`)
   read fields by accessor; the versioner middleware boundary still
   takes a Hash, so we call `.to_h` on the way in. The middleware's
   own `DEFAULT_OPTIONS[:version_options]` is left untouched so
   direct-mount callers (some middleware specs) still get the same
   safe defaults.

`version_options` is read for exactly these five keys across the
codebase: `: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 updated:

- `spec/shared/versioning_examples.rb`: 14 call sites changed
  `**macro_options` → `**macro_options.except(:format)`. The `:format`
  key 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`: dropped
  `format: :json` from 8 direct `.version` calls (never read on the
  lib side).
- `spec/grape/dsl/routing_spec.rb`: the `:version_options` assertion
  now expects a `VersionOptions` instance with the full default set.
- `spec/g... (continued)
Pull Request #2716: Refactor DSL::Routing#version: guard clause, explicit kwargs, value object

1047 of 1155 branches covered (90.65%)

Branch coverage included in aggregate %.

3424 of 3516 relevant lines covered (97.38%)

1007.02 hits per line

Source Files on job run-3.3-gemfiles/rack_3_0.gemfile - 25863247528.17
  • Tree
  • List 159
  • Changed 4
  • Source Changed 4
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 25863247528
  • 3117fe81 on github
  • Prev Job for on refactor/version-guard-clause (#25854383996.31)
  • Next Job for on refactor/version-guard-clause (#25863793057.3)
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