@@ -12,14 +12,13 @@ def initialize(exception, example, options={})
12
12
@exception = exception
13
13
@example = example
14
14
@message_color = options . fetch ( :message_color ) { RSpec . configuration . failure_color }
15
- @description = options . fetch ( :description_formatter ) { Proc . new { example . full_description } } . call ( self )
15
+ @description = options . fetch ( :description ) { example . full_description }
16
16
@detail_formatter = options . fetch ( :detail_formatter ) { Proc . new { } }
17
17
@extra_detail_formatter = options . fetch ( :extra_detail_formatter ) { Proc . new { } }
18
18
@backtrace_formatter = options . fetch ( :backtrace_formatter ) { RSpec . configuration . backtrace_formatter }
19
19
@indentation = options . fetch ( :indentation , 2 )
20
20
@skip_shared_group_trace = options . fetch ( :skip_shared_group_trace , false )
21
21
@failure_lines = options [ :failure_lines ]
22
- @extra_failure_lines = Array ( example . metadata [ :extra_failure_lines ] )
23
22
end
24
23
25
24
def message_lines
@@ -88,10 +87,6 @@ def fully_formatted_lines(failure_number, colorizer)
88
87
lines
89
88
end
90
89
91
- def failure_slash_error_line
92
- @failure_slash_error_line ||= "Failure/Error: #{ read_failed_line . strip } "
93
- end
94
-
95
90
private
96
91
97
92
def final_exception ( exception )
@@ -143,17 +138,28 @@ def exception_class_name(exception=@exception)
143
138
end
144
139
145
140
def failure_lines
146
- @failure_lines ||= begin
147
- lines = [ ]
148
- lines << failure_slash_error_line unless ( description == failure_slash_error_line )
149
- lines << "#{ exception_class_name } :" unless exception_class_name =~ /RSpec/
150
- encoded_string ( exception . message . to_s ) . split ( "\n " ) . each do |line |
151
- lines << ( line . empty? ? line : " #{ line } " )
152
- end
153
- unless @extra_failure_lines . empty?
154
- lines << ''
155
- lines . concat ( @extra_failure_lines )
156
- lines << ''
141
+ @failure_lines ||= [ failure_slash_error_line ] + exception_lines + extra_failure_lines
142
+ end
143
+
144
+ def failure_slash_error_line
145
+ "Failure/Error: #{ read_failed_line . strip } "
146
+ end
147
+
148
+ def exception_lines
149
+ lines = [ ]
150
+ lines << "#{ exception_class_name } :" unless exception_class_name =~ /RSpec/
151
+ encoded_string ( exception . message . to_s ) . split ( "\n " ) . each do |line |
152
+ lines << ( line . empty? ? line : " #{ line } " )
153
+ end
154
+ lines
155
+ end
156
+
157
+ def extra_failure_lines
158
+ @extra_failure_lines ||= begin
159
+ lines = Array ( example . metadata [ :extra_failure_lines ] )
160
+ unless lines . empty?
161
+ lines . unshift ( '' )
162
+ lines . push ( '' )
157
163
end
158
164
lines
159
165
end
@@ -239,9 +245,9 @@ def options
239
245
def pending_options
240
246
if @execution_result . pending_fixed?
241
247
{
242
- :description_formatter => Proc . new { "#{ @example . full_description } FIXED" } ,
243
- :message_color => RSpec . configuration . fixed_color ,
244
- :failure_lines => [
248
+ :description => "#{ @example . full_description } FIXED" ,
249
+ :message_color => RSpec . configuration . fixed_color ,
250
+ :failure_lines => [
245
251
"Expected pending '#{ @execution_result . pending_message } ' to fail. No Error was raised."
246
252
]
247
253
}
@@ -264,8 +270,6 @@ def with_multiple_error_options_as_needed(exception, options)
264
270
options [ :message_color ] )
265
271
)
266
272
267
- options [ :description_formatter ] &&= Proc . new { }
268
-
269
273
return options unless exception . aggregation_metadata [ :hide_backtrace ]
270
274
options [ :backtrace_formatter ] = EmptyBacktraceFormatter
271
275
options
@@ -303,7 +307,7 @@ def sub_failure_list_formatter(exception, message_color)
303
307
FlatMap . flat_map ( exception . all_exceptions . each_with_index ) do |failure , index |
304
308
options = with_multiple_error_options_as_needed (
305
309
failure ,
306
- :description_formatter => :failure_slash_error_line . to_proc ,
310
+ :description => nil ,
307
311
:indentation => 0 ,
308
312
:message_color => message_color || RSpec . configuration . failure_color ,
309
313
:skip_shared_group_trace => true
0 commit comments