Repository navigation
Conversation
Move the remove/redefine/restore steps from #1871 into one helper, so each test only states what the stub does.
Documentation previewCommit: |
without_singleton_method only removes the method and restores it after the block. Each test defines its replacement inside the block, so there is no separate proc argument.
st0012
marked this pull request as ready for review
November 11, 2026 01:04
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for this test-only refactor.
No open issues 🎉
What changed in this PR
Refactors the Ruby colorizer tests to centralize temporary singleton-method replacement, continuing the warning-suppression work from #1871. Only test code changes.
Changes:
- Adds
without_singleton_methodto remove a method, yield the original, and restore it throughensure. - Updates both deferred token stream tests to use the helper while preserving their existing assertions.
| File | Description |
|---|---|
test/rdoc/parser/ruby_colorizer_test.rb |
Adds the helper and replaces duplicated setup and cleanup in two tests. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1871. The two deferred token stream tests now use a
without_singleton_methodhelper. It removes the method, yields the original, and restores the original after the block. Each test defines its replacement inside the block, so redefining the method there gives no warning.Only test code changes.