Skip to content

Test Object#with returns the block's result - #57554

Merged
fatkodima merged 1 commit into
rails:mainfrom
hammadxcm:test-object-with-block-return
Jun 3, 2026
Merged

fatkodima merged 1 commit into
rails:mainfrom
hammadxcm:test-object-with-block-return

Conversation

@hammadxcm

Copy link
Copy Markdown
Contributor

Object#with yields self to the block and returns the block's value. The existing test only proved the block receives self (it returned an attribute that happened to equal the value just set), so the return value of #with itself was never asserted.

This adds coverage confirming an arbitrary block result flows out. No production code changes — test-only.

Object#with yields self to the block and returns the block's value.
The existing test only proved the block receives self (it returned an
attribute that happened to equal the set value); none asserted that an
arbitrary block result flows out.

Add coverage for the return value.
@fatkodima
fatkodima merged commit 68dcf1d into rails:main Jun 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants