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

Allow pattern matching in ResultMatcher #21

Merged

Conversation

michaelherold
Copy link
Contributor

A gotcha that has bitten my team several times is that you cannot
pattern match against the wrapped value of a result in the
ResultMatcher.

Since the basic matcher documentation shows an example where you
can pattern match against the patterns that you specify in your case
block, this is easy to assume that it's a built-in for the
ResultMatcher.

Adding pattern matching is a simple change that makes the whole of the
ResultMatcher more flexible and more in-line with the examples in the
rest of the documentation.

A gotcha that has bitten my team several times is that you cannot
pattern match against the wrapped value of a result in the
ResultMatcher.

Since the [basic matcher documentation][1] shows an example where you
can pattern match against the patterns that you specify in your case
block, this is easy to assume that it's a built-in for the
ResultMatcher.

Adding pattern matching is a simple change that makes the whole of the
ResultMatcher more flexible and more in-line with the examples in the
rest of the documentation.

[1]: https://dry-rb.org/gems/dry-matcher/
@flash-gordon
Copy link
Member

Thanks, it's on our list of things to do before retiring dry-transaction (see dry-rb/dry-transaction#127). I'm merging this PR now, I'll do a few more tweaks to make pattern matching even more flexible.

@flash-gordon flash-gordon merged commit 86f51f4 into dry-rb:master Jul 13, 2019
@michaelherold
Copy link
Contributor Author

Thanks for the additional context! I hadn't seen that you were planning to deprecate dry-transaction.

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