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

Add a post on how the composable matchers work. #69

Closed
wants to merge 5 commits into from

Conversation

fables-tales
Copy link
Member

No description provided.

@xaviershay
Copy link
Member

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
Copy link
Member

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.

@xaviershay
Copy link
Member

tl;dr see how many words you can remove from each sentence without changing its meaning :)

```
case 3
when (1...18)
puts "hello"
Copy link
Member

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?

@JonRowe
Copy link
Member

JonRowe commented May 11, 2015

Pretty much 👍 to all @xaviershay's comments, its pretty much a writing style thing tho

@myronmarston
Copy link
Member

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 source? It'll help me be able to view the blog post on a local server to see how it renders (and that's probably something you should check, too).

Also, our markdown engine uses ~~~ ruby instead of triple backticks for fencing code blocks so they are rendering funny currently. Please update that as well.

I'll go review the content now.

* regexes
* ranges

Conceptually, this protocol represents a "match". That is, the object that
Copy link
Member

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.

@fables-tales
Copy link
Member Author

@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 :)

@JonRowe
Copy link
Member

JonRowe commented Sep 22, 2015

I took a stab at making the changes to this, care to re-review @xaviershay / @myronmarston ?

@JonRowe JonRowe reopened this Sep 22, 2015

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
Copy link
Member

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.

@myronmarston
Copy link
Member

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.

@JonRowe JonRowe force-pushed the composable-matchers-post branch from d5f4da8 to 791f05b Compare October 27, 2015 23:17
@JonRowe
Copy link
Member

JonRowe commented Oct 27, 2015

I've taken your suggestions into consideration, want to try another read through?

@JonRowe
Copy link
Member

JonRowe commented Nov 18, 2015

Ping @myronmarston :)

@JonRowe
Copy link
Member

JonRowe commented Jan 18, 2016

Hey @myronmarston did you ever have a chance to re-read this?

when (1...18)
puts "hello"
end
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't rendering right:

screen shot 2016-01-19 at 11 33 19 pm

@myronmarston
Copy link
Member

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 :(.

@JonRowe JonRowe closed this Feb 5, 2016
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.

4 participants