Created
February 17, 2015 20:27
-
-
Save joshmcarthur/09db3280097084165a1a to your computer and use it in GitHub Desktop.
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
# Like rspec --format doc, (which minitest doesn't have) | |
# | |
# usage: minidoc test/integration/robs_cool_potatoes_test.rb | |
minidoc() { | |
rscript=' | |
red = "\e[0;31m" | |
purple = "\e[0;35m" | |
green = "\e[0;32m" | |
blue = "\e[0;34m" | |
none = "\e[0m" | |
should_test = /^(\s*should)/ | |
context_test = /^(\s*context)/ | |
if $_ =~ should_test || $_ =~ context_test | |
coloured_line = $_.gsub(context_test,"#{green}\\1#{none}").gsub(should_test,"#{blue}\\1#{none}") | |
puts coloured_line | |
end' | |
cat -n "$1" | ruby -n -e "$rscript" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment