Skip to content

Instantly share code, notes, and snippets.

@shri-zz
Created March 18, 2009 05:45
Show Gist options
  • Save shri-zz/80965 to your computer and use it in GitHub Desktop.
Save shri-zz/80965 to your computer and use it in GitHub Desktop.
def location e
#
# shri - Add this line since backtrace is sometimes nil (bug)
#
if not e.backtrace then return "" end
last_before_assertion = ""
e.backtrace.reverse_each do |s|
break if s =~ /in .(assert|refute|flunk|pass|fail|raise)/
last_before_assertion = s
end
last_before_assertion.sub(/:in .*$/, '')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment