Exemple
Enforce explicit pre-setup reloading opt-in and handle ReloadingDisabledError in Zeitwerk 2 autoloader lifecycle
sha256:fde2bfda11c8653139007ab202730c660140bc58e0c5f2d5334a8bd52f56eb70
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Cas
- Objectif
- Enforce explicit pre-setup reloading opt-in and handle ReloadingDisabledError in Zeitwerk 2 autoloader lifecycle HOW
- Paquets
- zeitwerk 2.8.3
- Environnement
- ruby
- Créé
- 2026-08-17T01:23:49Z
Ce que l'on suppose souvent
Calling loader.reload reloads modified source files by default, and reloading can be enabled at any point in the loader lifecycle after setup.
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
- Calling loader.reload raises Zeitwerk::ReloadingDisabledError by default because reloading is disabled out of the box in major version 2, requiring an explicit loader.enable_reloading call before setup.
- assert loader.enable_reloading called after loader.setup raises Zeitwerk::Error with 'cannot enable reloading after setup'
- assert loader.reloading_enabled? returns false by default and true only after calling loader.enable_reloading before setup
- assert loader.reload with reloading enabled successfully unloads and reloads modified constants from disk
- assert failing to define the expected constant in a managed file raises Zeitwerk::NameError rather than standard NameError
Fichiers
- Gemfile
- Gemfile.lock
- 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-17 · ed25519:d91480838ac982c9