Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit a2ac1c2

Browse files
committed
Merge pull request #419 from RobertLowe/master
Make textmate formtatter run prettier
2 parents 9189a22 + 9ec353f commit a2ac1c2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/rspec/core/formatters/snippet_extractor.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ class NullConverter; def convert(code, pre); code; end; end #:nodoc:
88

99
def snippet(error)
1010
raw_code, line = snippet_for(error.backtrace[0])
11+
12+
# skip over whiny_nils in the backtrace
13+
raw_code, line = snippet_for(error.backtrace[1]) if error.backtrace[0] =~ /active_support\/whiny_nil\.rb/
14+
1115
highlighted = @@converter.convert(raw_code, false)
1216
highlighted << "\n<span class=\"comment\"># gem install syntax to get syntax highlighting</span>" if @@converter.is_a?(NullConverter)
1317
post_process(highlighted, line)

lib/rspec/core/formatters/text_mate_formatter.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'cgi'
12
require 'rspec/core/formatters/html_formatter'
23

34
module RSpec
@@ -7,6 +8,7 @@ module Formatters
78
class TextMateFormatter < HtmlFormatter
89
def backtrace_line(line)
910
if line = super(line)
11+
line = CGI.escapeHTML(line)
1012
line.sub!(/([^:]*\.e?rb):(\d*)/) do
1113
"<a href=\"txmt://open?url=file://#{File.expand_path($1)}&line=#{$2}\">#{$1}:#{$2}</a> "
1214
end

0 commit comments

Comments
 (0)