File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def initialize(notification)
1515 end
1616
1717 def line
18- example . location . split ( ':' ) [ 1 ]
18+ location [ 1 ]
1919 end
2020
2121 def annotation
@@ -25,7 +25,7 @@ def annotation
2525
2626 def path
2727 # TODO: use `delete_prefix` when dropping ruby 2.4 support
28- File . realpath ( raw_path ) . sub ( /\A #{ workspace } #{ File ::SEPARATOR } / , '' )
28+ File . realpath ( location [ 0 ] ) . sub ( /\A #{ workspace } #{ File ::SEPARATOR } / , '' )
2929 end
3030
3131 private
@@ -42,8 +42,12 @@ def message
4242 end
4343 end
4444
45- def raw_path
46- example . location . split ( ':' ) [ 0 ]
45+ def location
46+ if @notification . respond_to? ( :exception )
47+ @notification . exception . backtrace . first . split ( ':' )
48+ else
49+ example . location . split ( ':' )
50+ end
4751 end
4852
4953 def workspace
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require_relative './test_class.rb'
4+
5+ RSpec . describe RSpec ::Github ::Formatter do
6+ it 'creates an error annotation for crashing specs' do
7+ expect ( TestClass . crash ) . to eq true
8+ end
9+ end
Original file line number Diff line number Diff line change 1+ class TestClass
2+ def self . crash
3+ raise 'Ay!'
4+ end
5+ end
You can’t perform that action at this time.
0 commit comments