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

ruby-grape / grape / 25973033231 / 24
97%
master: 97%

Build:
DEFAULT BRANCH: master
Ran 16 May 2026 09:11PM UTC
Files 163
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

16 May 2026 09:10PM UTC coverage: 62.579% (-0.02%) from 62.6%
25973033231.24

push

github

web-flow
Introduce Grape::Validations::CoerceOptions value object (#2722)

`ValidationsSpec#coerce_options` returned an ad-hoc
`{ type:, method:, message: }` Hash that flowed (deep-frozen) into
`CoerceValidator` as its `options` argument and was poked at by
`ParamsScope#check_coerce_with` / `#validate_coerce`. Unlike most
validator options, this Hash is *never written by the user* — it is
assembled internally from the parsed `type:` / `coerce_with:` /
`coerce_message` declaration — so it has a fixed shape and no public
contract to preserve.

Replace it with a `Grape::Validations::CoerceOptions` Data value object
(`Data.define(:type, :coerce_method, :message)`, all defaulting nil).
The member is `coerce_method`, not `method`, to avoid shadowing
`Object#method` (`Lint/DataDefineOverride`); it also matches
`ValidationsSpec`'s existing `coerce_method` vocabulary.

- `ValidationsSpec#coerce_options` builds the value object.
- `ParamsScope#check_coerce_with` / `#validate_coerce` read `.type` /
  `.coerce_method` instead of `[:type]` / `[:method]`.
- `CoerceValidator` reads `@options.type` / `@options.coerce_method`.
  `Base#message` can't see a custom message off a Data (it probes
  Hash-like `key?`), so `CoerceValidator#initialize` restores
  `@exception_message` from `@options.message`, preserving
  `type: { value:, message: }` behaviour.

`Grape::Util::DeepFreeze` returns the Data as-is (its `else` branch);
`Base.new` already freezes the whole validator instance, and the Data
is structurally immutable. No user-facing contract changes — users
never construct or read this Hash; no spec hand-builds it.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

370 of 1167 branches covered (31.71%)

Branch coverage included in aggregate %.

2595 of 3571 relevant lines covered (72.67%)

7.95 hits per line

Source Files on job run-4.0-gemfiles/hashie.gemfile - 25973033231.24
  • Tree
  • List 163
  • Changed 4
  • Source Changed 3
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 25973033231
  • 2d224ab6 on github
  • Prev Job for on master (#25972968115.15)
  • Next Job for on master (#25973567226.6)
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