From 46476b80d290f1d161abe7b40df12ead1011a1a2 Mon Sep 17 00:00:00 2001 From: Glenn Sidney Date: Sat, 1 Feb 2014 03:21:50 -0600 Subject: [PATCH] Fix clickable links in TextMate html output Right now for me running the latest RSpec, TextMate 2 alpha, Rails 4, and this bundle, when I run my specs and get html output in TextMate, the links are not clickable. I brought it up in rspec-core (https://github.com/rspec/rspec-core/issues/1276#issuecomment-33680781) and they pointed me here. This proposed change fixes the issue for me. --- Support/lib/rspec/mate/text_mate_formatter.rb | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Support/lib/rspec/mate/text_mate_formatter.rb b/Support/lib/rspec/mate/text_mate_formatter.rb index 6c4242e0d..2c01d2330 100644 --- a/Support/lib/rspec/mate/text_mate_formatter.rb +++ b/Support/lib/rspec/mate/text_mate_formatter.rb @@ -28,6 +28,44 @@ def extra_failure_content(exception) @snippet_extractor ||= RSpec::Core::Formatters::SnippetExtractor.new "
#{@snippet_extractor.snippet(backtrace)}
" end + + def example_failed(example) + # super(example) + + unless @header_red + @header_red = true + @printer.make_header_red + end + + unless @example_group_red + @example_group_red = true + @printer.make_example_group_header_red(example_group_number) + end + + @printer.move_progress(percent_done) + + exception = example.metadata[:execution_result][:exception] + exception_details = if exception + { + :message => exception.message, + :backtrace => format_backtrace(exception.backtrace, example).join("\n") + } + else + false + end + extra = extra_failure_content(exception) + + @printer.print_example_failed( + example.execution_result[:pending_fixed], + example.description, + example.execution_result[:run_time], + @failed_examples.size, + exception_details, + (extra == "") ? false : extra, + false + ) + @printer.flush + end end end end