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

Explicit documentation on Code argument constraints return type #733

Closed
geoand opened this Issue May 17, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@geoand
Contributor

geoand commented May 17, 2017

Hello,

I was playing around with the awesome argument constraints feature of Mocks, and I fell prey to an issue very similar to the one described here.
A clue to Spock's behavior is provided in a comment by Peter Niederwieser in one of the answers which I think would be a very good addition to the documentation in Argument Constraints section.
The example provided in the documentation (1 * subscriber.receive({ it.size() > 3 })) does not immediately make it clear to the reader that the value returned by the closure is actually what Spock uses to determine whether or not a mock was interacted with.

I personally think that an example like (1 * subscriber.receive({ it.size() > 3 && it.contains('a')})) would make things much more clear, as would an explicit declaration (maybe via a comment) of the use the return value of the closure.

Please let me know what you think. I can of course submit a PR if/once a solution is agreed upon.

Thanks!

@leonard84

This comment has been minimized.

Show comment
Hide comment
@leonard84

leonard84 Dec 10, 2017

Member

@geoand please feel free to submit a PR with improved documentation

Member

leonard84 commented Dec 10, 2017

@geoand please feel free to submit a PR with improved documentation

@geoand

This comment has been minimized.

Show comment
Hide comment
@geoand

geoand Dec 10, 2017

Contributor

@leonard84 Sounds good! I will most likely do that tomorrow.

Contributor

geoand commented Dec 10, 2017

@leonard84 Sounds good! I will most likely do that tomorrow.

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