Created
May 18, 2015 18:45
-
-
Save niclasnilsson/89f9a8c28caae0c1634a 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
require 'clean_assert' | |
def add_drinking_person(name, age) | |
assert / "name != nil" / "not name.empty?" / "age >= 21" | |
puts "Adding '#{name}' of age #{age} to the list of drinkers" | |
# And some code to do it... | |
end | |
add_drinking_person("Niclas", 17) | |
# Gives: | |
# RuntimeError: Assertion 'age >= 21' not satisfied in main#add_drinking_person |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment