Created
August 29, 2008 15:59
-
-
Save pjb3/7991 to your computer and use it in GitHub Desktop.
This file contains 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
#Throw this in spec helper | |
def block_should(matcher, &block) | |
block.should matcher | |
end | |
def block_should_not(matcher, &block) | |
block.should_not matcher | |
end | |
#Use it like this | |
block_should change(Thing, :count).by(-1) do | |
@thing.destroy | |
end | |
#Which is just a little cleaner version of this | |
lambda do | |
@thing.destroy | |
end.should change(Thing, :count).by(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment