Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Can API.mock be called with a block? #517

Closed
qr8r opened this issue Sep 18, 2021 · 2 comments
Closed

[Question] Can API.mock be called with a block? #517

qr8r opened this issue Sep 18, 2021 · 2 comments

Comments

@qr8r
Copy link

qr8r commented Sep 18, 2021

There are places in the documentation which show the mock method being called with a block

https://github.com/freerange/mocha/blob/main/lib/mocha/api.rb#L202-L206

I love the idea of this syntax. It doesn't seem to work for me however, and reading the source code it doesn't look like that method is capturing the block or yielding when it is called?

Is the documentation wrong?

@qr8r
Copy link
Author

qr8r commented Sep 18, 2021

I guess this is deprecated behaviour
#418

@floehopper
Copy link
Member

I guess this is deprecated behaviour
#418

Yes, it is deprecated behaviour and the documentation is out-of-date. See #290 for details. Thanks for drawing this to our attention. I've opened a new issue to capture updating the docs.

Would using Object#tap help you do what you want?

Anyway, we're not going to reinstate this deprecated behaviour and so I'm going to close this issue. Hope that's OK.

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

No branches or pull requests

2 participants