Skip to content

Instantly share code, notes, and snippets.

@garmoshka-mo
Last active May 30, 2017 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garmoshka-mo/3fd0940c1869250a43b6be292cdf7449 to your computer and use it in GitHub Desktop.
Save garmoshka-mo/3fd0940c1869250a43b6be292cdf7449 to your computer and use it in GitHub Desktop.
Sane output of rspec exceptions
RSpec::Core::BacktraceFormatter.class_eval do
alias :native_format_backtrace :format_backtrace
alias :native_backtrace_line :backtrace_line
def format_backtrace(backtrace, options={})
@lines = 0
native_format_backtrace backtrace, options
end
def backtrace_line(line)
return if @lines == 3 and not ENV['TRACE']
return if line.include? '/gems/'
result = native_backtrace_line(line)
if result
@lines += 1 if @lines
result[0 .. 1] == './' ? result[2 .. -1] : result
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment