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 have(:no) to README #46

Merged
merged 1 commit into from Aug 31, 2020
Merged

Add have(:no) to README #46

merged 1 commit into from Aug 31, 2020

Conversation

vassilevsky
Copy link
Contributor

@vassilevsky vassilevsky commented Aug 31, 2020

Hello :)

I was searching today for a natural way to express the expectation of an empty Rails association.

First I wrote this, hoping it would work:

expect(bird).not_to have.feathers

This did not work :)

I dived into the source and discovered that I could do this:

expect(bird).to have(:no).feathers

This is also a good way to make the expectation sound like natural English :)

So I thought that it's worth mentioning in the README.

@JonRowe JonRowe merged commit e652e36 into rspec:main Aug 31, 2020
@JonRowe
Copy link
Member

JonRowe commented Aug 31, 2020

Thanks, an excellent documentation contribution 👍

@pirj
Copy link
Member

pirj commented Aug 31, 2020

Thanks! Didn't know this was possible 👍

@vassilevsky vassilevsky deleted the patch-1 branch September 1, 2020 16:19
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.

None yet

3 participants