Last active
July 26, 2017 05:17
-
-
Save yujinakayama/5ec82ca591906b6058be to your computer and use it in GitHub Desktop.
Example of switching positive/negative in compound expectations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe 'some destructive method' do | |
| it 'destroys only relevant things' do | |
| expect { do_something_destructive }.to change { things_to_destroy.reload.count }.to(0) | |
| .and.not_to change { things_not_to_destroy.reload.count } | |
| # ^^^^^^^ This is what I want to do and just a fictional syntax. | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's what you can do that works: