Skip to content

Add without_singleton_method helper to colorizer tests - #1877

Open
st0012 wants to merge 2 commits into
masterfrom
claude/project-thread-kfs584
Open

st0012 wants to merge 2 commits into
masterfrom
claude/project-thread-kfs584

Conversation

@st0012

@st0012 st0012 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #1871. The two deferred token stream tests now use a without_singleton_method helper. 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.

Move the remove/redefine/restore steps from #1871 into one helper, so each test only states what the stub does.
@st0012 st0012 self-assigned this Nov 10, 2026
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Documentation preview

View the preview

Commit: e92cfbc

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 st0012 changed the title Extract singleton method stubbing in colorizer tests Add without_singleton_method helper to colorizer tests Nov 11, 2026
@st0012
st0012 marked this pull request as ready for review November 11, 2026 01:04
Copilot AI balanced review requested due to automatic review settings November 11, 2026 01:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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_method to remove a method, yield the original, and restore it through ensure.
  • 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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants