Created
July 3, 2014 23:04
-
-
Save shyam-habarakada/545bf49b9423ac2f228b to your computer and use it in GitHub Desktop.
A simple rails assert method
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
def assert(message = 'assertion failed') | |
unless block_given? and yield | |
if Rails.env.development? or Rails.env.test? | |
raise message | |
else | |
Rails.logger.warn "(assert) #{message}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment