Skip to content

Instantly share code, notes, and snippets.

Created January 21, 2009 19:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dbrady/50122 to your computer and use it in GitHub Desktop.
# What is existence?
class Be
def initialize
def matches?(actual)
defined? actual
def failure_message
"expected the expression to exist, but it didn't"
def negative_failure_message
"expected the expression to not exist, but it did"
# Now you can say things like
# Zen.should be
def be
# Note that if Zen does not exist, you won't get a failure message,
# you'll get an undefined constant exception. A pity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment