Rails Test Helper
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
# Only outputs block if preceeded by `=` in rails views | |
# Preferred. | |
def testify(value = nil, &block) | |
return unless Rails.env.development? || Rails.env.test? | |
block_given? ? capture(&block) : value | |
end | |
# Outputs block for both `-` and `=` in rails views | |
def testify(value = nil, &block) | |
return unless Rails.env.development? || Rails.env.test? | |
if block_given? | |
block.call | |
nil | |
else | |
value | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment