File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ class Backtrace
2
2
include Mongoid ::Document
3
3
include Mongoid ::Timestamps
4
4
5
- IN_APP_PATH = %r{^\[ PROJECT_ROOT\] (?!(\ / vendor))/?}
6
- GEMS_PATH = %r{\[ GEM_ROOT\] \ / gems\ / ([^\ / ]+)}
5
+ IN_APP_PATH = %r{^(?: \[ |/) PROJECT_ROOT\] ? (?!(/vendor))/?}
6
+ GEMS_PATH = %r{(?: \[ |/) GEM_ROOT\] ? /gems/([^/]+)}
7
7
8
8
field :fingerprint
9
9
field :lines
Original file line number Diff line number Diff line change 11
11
file : '[PROJECT_ROOT]/path/to/file/ea315ea4.rb' ,
12
12
method : :instance_eval )
13
13
end
14
+ let ( :backtrace_line_in_app_slashes ) do
15
+ described_class . new (
16
+ number : 884 ,
17
+ file : '/PROJECT_ROOT/path/to/file/ea315ea4.rb' ,
18
+ method : :instance_eval )
19
+ end
14
20
let ( :backtrace_line_no_file ) do
15
21
described_class . new ( number : 884 , method : :instance_eval )
16
22
end
47
53
end
48
54
end
49
55
56
+ describe '#decorated_path' do
57
+ it 'parses old backtrace format with square brackets' do
58
+ expect ( backtrace_line_in_app . decorated_path ) . to eq 'path/to/file/'
59
+ end
60
+
61
+ it 'parses new backtrace format with slashes' do
62
+ expect ( backtrace_line_in_app_slashes . decorated_path ) . to eq 'path/to/file/'
63
+ end
64
+ end
65
+
50
66
describe '#link_to_source_file' do
51
67
it 'adds a link to the source file' do
52
68
link = backtrace_line_in_app . link_to_source_file ( app ) { 'mytext' }
You can’t perform that action at this time.
0 commit comments