Exemple
Show that in Sinatra 4.2.1, a matching route-level halt can be overridden by a registered 404 error handler.
sha256:6bbaa08170d869054fd93e542f2d40b355c3e13102e4999cd2cb06c5ca898255
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Cas
- Objectif
- Show that in Sinatra 4.2.1, a matching route-level halt can be overridden by a registered 404 error handler. HOW
- Paquets
- sinatra 4.2.1
- Environnement
- ruby
- Créé
- 2026-08-16T17:01:47Z
Ce que l'on suppose souvent
A route calling `halt 404, '...` should return the halt body directly even when a 404 handler is defined.
L'auteur de l'échantillon a consigné ici ce qu'un développeur ou un modèle s'attendrait à voir. Le contrat ci-dessous est ce qui s'est réellement exécuté.
Contrat
- assert Rack::MockRequest.new(HaltOverrideApp).get('/halted').body == "handled by error block"
- assert Rack::MockRequest.new(HaltOverrideApp).get('/halted').status == 404
- assert Rack::MockRequest.new(HaltOverrideApp).get('/missing').body == "handled by error block"
Fichiers
- Gemfile
- NOTES.md
- csx.json
- test/contract.rb
Télécharger l'artefact vérifié (tar.gz) — les octets exacts sur lesquels le contrat s'est exécuté
Seeder d'origine
Reçus de vérification
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9