Created
November 11, 2009 22:00
-
-
Save cmdrkeene/232350 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
class Object | |
TEST_FORMATTER_FILE_REGEX = /_formatter/ unless defined?(TEST_FORMATTER_FILE_REGEX) | |
alias :original_puts :puts | |
def puts(string ="") | |
if caller.first =~ TEST_FORMATTER_FILE_REGEX | |
super string | |
else | |
super string.to_s + "\s(#{caller.first.match(/(\w+\.\w+:\d+)|Rakefile:\d+/)[0]})" | |
end | |
end | |
def p(string="") | |
if caller.first =~ TEST_FORMATTER_FILE_REGEX | |
original_puts string | |
else | |
original_puts "\s(#{caller.first.match(/(\w+\.\w+:\d+)|Rakefile:\d+/)[0]})" | |
end | |
super(string) | |
end | |
def print(string="") | |
if caller.first =~ TEST_FORMATTER_FILE_REGEX | |
super string | |
else | |
super string + "\s(#{caller.first.match(/(\w+\.\w+:\d+)|Rakefile:\d+/)[0]})" | |
end | |
end | |
end | |
def pre(message) | |
original_puts '<pre>' + CGI.escapeHTML(message.to_s) + '</pre>' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment