Last active
December 18, 2017 16:55
-
-
Save kieraneglin/90c6e559eb4fe21cdb5529aa730fbcda to your computer and use it in GitHub Desktop.
assert_differences new syntax example
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
assert_differences(['User.count', 'Post.count'], by: [-1, -5]) do | |
# Logic... | |
end | |
assert_differences('User.count', by: -1) do | |
# Logic... (although you should be using assert_difference in this case) | |
end | |
assert_differences(-> { User.count }, by: -1) do | |
# I can do lambdas too! | |
end | |
assert_differences('User.count', by: -5, message: 'No can do, kiddo') do | |
# Logic which shows your message on failure | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment