Skip to content

Instantly share code, notes, and snippets.

@munkyboy
Created September 15, 2010 19:38
Show Gist options
  • Save munkyboy/581313 to your computer and use it in GitHub Desktop.
Save munkyboy/581313 to your computer and use it in GitHub Desktop.
diff --git a/lib/rspec/core/formatters/base_formatter.rb b/lib/rspec/core/formatters/base_formatter.rb
index fc181fb..8f88433 100644
--- a/lib/rspec/core/formatters/base_formatter.rb
+++ b/lib/rspec/core/formatters/base_formatter.rb
@@ -118,7 +118,7 @@ module RSpec
def read_failed_line(exception, example)
original_file = example.file_path.to_s.downcase
- matching_line = exception.backtrace.detect { |line| line.match(/(.+?):(\d+)(|:\d+)/)[1].downcase == original_file.downcase }
+ matching_line = exception.backtrace.detect { |line| (line.match(/(.+?):(\d+)(|:\d+)/).downcase == original_file.downcase) rescue false }
return "Unable to find matching line from backtrace" if matching_line.nil?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment