-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add a post on how the composable matchers work. #69
Conversation
Overall content is good, I'm leaving comments on style. |
|
||
In an RSpec expectation expression like `expect(object_1).to eq(object_2)` | ||
there are two primary objects at play, the **target** and the **matcher**. The | ||
**target** object is created by "expect" and basically wraps the passed object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove all occurrences of "basically", it doesn't add anything.
tl;dr see how many words you can remove from each sentence without changing its meaning :) |
``` | ||
case 3 | ||
when (1...18) | ||
puts "hello" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extremly minor quibble but this should probably only be indented two spaces?
Pretty much 👍 to all @xaviershay's comments, its pretty much a writing style thing tho |
Thanks for putting this together, @samphippen. It looks like your local branch wasn't very current when you committed this so this branch is missing lots of improvements from master. Mind rebasing against Also, our markdown engine uses I'll go review the content now. |
* regexes | ||
* ranges | ||
|
||
Conceptually, this protocol represents a "match". That is, the object that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also found it useful to explain this protocol in terms of it defining a category to which some objects belong and some don't -- e.g. /foo/
defines a category to which strings containing the substring "foo" belong and all other objects do not belong. Not sure if that's a better or worse way to describe it but it's kinda nice to not use the "match" terminology for everything.
@JonRowe I was just cleaning up my PRs, but yeah if you've got some time (I don't). The other thing is, this post was really meant to help explain it to a friend and I sent it to him and that sort of served it's purpose. If you think this is close, totally feel free to finish it :) |
I took a stab at making the changes to this, care to re-review @xaviershay / @myronmarston ? |
|
||
Conceptually, this protocol represents a "match", but can be thought of as | ||
categorising instances of objects. That is, the object that implements the | ||
`===` declares whether or not it belongs in the same category as the other |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the object that implements the
===
declares...
This should be "the object that implements the ===
method declares..." or "the object that implements ===
declares..."
Also, IMO, this explanation is inverted. The object that implements ===
defines the category to which the passed object may (or may not) belong, but as written, "declares whether or not it belongs in the same category as the other object" reads like the inverse.
Thanks, @JonRowe. I left some more feedback. I don't think it's quite in a publishable state yet. Up to you if you want to keep working on it. |
d5f4da8
to
791f05b
Compare
I've taken your suggestions into consideration, want to try another read through? |
Ping @myronmarston :) |
Hey @myronmarston did you ever have a chance to re-read this? |
when (1...18) | ||
puts "hello" | ||
end | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. It's been hard for me to feel motivated to spend time on this. This still feels pretty rough, honestly, and not up to the level of polish of what we publish. Writing is hard :(. |
No description provided.