rspec-core 3.1.7 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.yardopts +1 -0
- data/Changelog.md +84 -0
- data/README.md +10 -1
- data/lib/rspec/core.rb +28 -8
- data/lib/rspec/core/backport_random.rb +12 -9
- data/lib/rspec/core/configuration.rb +350 -112
- data/lib/rspec/core/configuration_options.rb +14 -7
- data/lib/rspec/core/dsl.rb +7 -4
- data/lib/rspec/core/example.rb +86 -50
- data/lib/rspec/core/example_group.rb +247 -86
- data/lib/rspec/core/filter_manager.rb +38 -93
- data/lib/rspec/core/flat_map.rb +4 -4
- data/lib/rspec/core/formatters.rb +10 -6
- data/lib/rspec/core/formatters/base_formatter.rb +7 -4
- data/lib/rspec/core/formatters/base_text_formatter.rb +12 -12
- data/lib/rspec/core/formatters/console_codes.rb +8 -7
- data/lib/rspec/core/formatters/deprecation_formatter.rb +5 -3
- data/lib/rspec/core/formatters/documentation_formatter.rb +10 -4
- data/lib/rspec/core/formatters/helpers.rb +6 -4
- data/lib/rspec/core/formatters/html_formatter.rb +13 -8
- data/lib/rspec/core/formatters/html_printer.rb +26 -10
- data/lib/rspec/core/formatters/profile_formatter.rb +10 -7
- data/lib/rspec/core/formatters/protocol.rb +27 -18
- data/lib/rspec/core/formatters/snippet_extractor.rb +14 -7
- data/lib/rspec/core/hooks.rb +252 -211
- data/lib/rspec/core/memoized_helpers.rb +16 -16
- data/lib/rspec/core/metadata.rb +67 -28
- data/lib/rspec/core/metadata_filter.rb +151 -24
- data/lib/rspec/core/minitest_assertions_adapter.rb +5 -2
- data/lib/rspec/core/mocking_adapters/flexmock.rb +1 -1
- data/lib/rspec/core/mocking_adapters/mocha.rb +8 -8
- data/lib/rspec/core/notifications.rb +155 -94
- data/lib/rspec/core/option_parser.rb +16 -10
- data/lib/rspec/core/pending.rb +11 -9
- data/lib/rspec/core/project_initializer.rb +1 -1
- data/lib/rspec/core/project_initializer/spec/spec_helper.rb +10 -8
- data/lib/rspec/core/rake_task.rb +37 -52
- data/lib/rspec/core/reporter.rb +30 -7
- data/lib/rspec/core/ruby_project.rb +12 -4
- data/lib/rspec/core/runner.rb +5 -8
- data/lib/rspec/core/sandbox.rb +37 -0
- data/lib/rspec/core/shared_example_group.rb +41 -15
- data/lib/rspec/core/test_unit_assertions_adapter.rb +3 -3
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/warnings.rb +2 -2
- data/lib/rspec/core/world.rb +12 -28
- metadata +44 -31
- metadata.gz.sig +0 -0
@@ -1,9 +1,9 @@
|
|
1
1
|
begin
|
2
|
-
# Only the minitest 5.x gem includes the minitest.rb and assertions.rb files
|
2
|
+
# Only the minitest 5.x gem includes the minitest.rb and assertions.rb files.
|
3
3
|
require 'minitest'
|
4
4
|
require 'minitest/assertions'
|
5
5
|
rescue LoadError
|
6
|
-
# We must be using Ruby Core's MiniTest or the Minitest gem 4.x
|
6
|
+
# We must be using Ruby Core's MiniTest or the Minitest gem 4.x.
|
7
7
|
require 'minitest/unit'
|
8
8
|
Minitest = MiniTest
|
9
9
|
end
|
@@ -13,6 +13,9 @@ module RSpec
|
|
13
13
|
# @private
|
14
14
|
module MinitestAssertionsAdapter
|
15
15
|
include ::Minitest::Assertions
|
16
|
+
# Need to forcefully include Pending after Minitest::Assertions
|
17
|
+
# to make sure our own #skip method beats Minitest's.
|
18
|
+
include ::RSpec::Core::Pending
|
16
19
|
|
17
20
|
# Minitest 5.x requires this accessor to be available. See
|
18
21
|
# https://github.com/seattlerb/minitest/blob/38f0a5fcbd9c37c3f80a3eaad4ba84d3fc9947a0/lib/minitest/assertions.rb#L8
|
@@ -2,22 +2,22 @@
|
|
2
2
|
# hoops here.
|
3
3
|
#
|
4
4
|
# mocha >= '0.13.0':
|
5
|
-
# require 'mocha/api' is required
|
6
|
-
# require 'mocha/object' raises a LoadError b/c the file no longer exists
|
5
|
+
# require 'mocha/api' is required.
|
6
|
+
# require 'mocha/object' raises a LoadError b/c the file no longer exists.
|
7
7
|
# mocha < '0.13.0', >= '0.9.7'
|
8
|
-
# require 'mocha/api' is required
|
9
|
-
# require 'mocha/object' is required
|
8
|
+
# require 'mocha/api' is required.
|
9
|
+
# require 'mocha/object' is required.
|
10
10
|
# mocha < '0.9.7':
|
11
|
-
# require 'mocha/api' raises a LoadError b/c the file does not yet exist
|
12
|
-
# require 'mocha/standalone' is required
|
13
|
-
# require 'mocha/object' is required
|
11
|
+
# require 'mocha/api' raises a LoadError b/c the file does not yet exist.
|
12
|
+
# require 'mocha/standalone' is required.
|
13
|
+
# require 'mocha/object' is required.
|
14
14
|
begin
|
15
15
|
require 'mocha/api'
|
16
16
|
|
17
17
|
begin
|
18
18
|
require 'mocha/object'
|
19
19
|
rescue LoadError
|
20
|
-
# Mocha >= 0.13.0 no longer contains this file nor needs it to be loaded
|
20
|
+
# Mocha >= 0.13.0 no longer contains this file nor needs it to be loaded.
|
21
21
|
end
|
22
22
|
rescue LoadError
|
23
23
|
require 'mocha/standalone'
|
@@ -32,17 +32,25 @@ module RSpec::Core
|
|
32
32
|
# end
|
33
33
|
#
|
34
34
|
# @attr example [RSpec::Core::Example] the current example
|
35
|
-
ExampleNotification = Struct.new(:example)
|
35
|
+
ExampleNotification = Struct.new(:example)
|
36
|
+
class ExampleNotification
|
36
37
|
# @private
|
37
38
|
def self.for(example)
|
38
|
-
|
39
|
+
execution_result = example.execution_result
|
40
|
+
|
41
|
+
if execution_result.pending_fixed?
|
39
42
|
PendingExampleFixedNotification.new(example)
|
40
|
-
elsif
|
43
|
+
elsif execution_result.example_skipped?
|
44
|
+
SkippedExampleNotification.new(example)
|
45
|
+
elsif execution_result.status == :pending
|
46
|
+
PendingExampleFailedAsExpectedNotification.new(example)
|
47
|
+
elsif execution_result.status == :failed
|
41
48
|
FailedExampleNotification.new(example)
|
42
49
|
else
|
43
50
|
new(example)
|
44
51
|
end
|
45
52
|
end
|
53
|
+
|
46
54
|
private_class_method :new
|
47
55
|
end
|
48
56
|
|
@@ -59,35 +67,42 @@ module RSpec::Core
|
|
59
67
|
@reporter = reporter
|
60
68
|
end
|
61
69
|
|
62
|
-
# @return [Array
|
70
|
+
# @return [Array<RSpec::Core::Example>] list of examples
|
63
71
|
def examples
|
64
72
|
@reporter.examples
|
65
73
|
end
|
66
74
|
|
67
|
-
# @return [Array
|
75
|
+
# @return [Array<RSpec::Core::Example>] list of failed examples
|
68
76
|
def failed_examples
|
69
77
|
@reporter.failed_examples
|
70
78
|
end
|
71
79
|
|
72
|
-
# @return [Array
|
80
|
+
# @return [Array<RSpec::Core::Example>] list of pending examples
|
73
81
|
def pending_examples
|
74
82
|
@reporter.pending_examples
|
75
83
|
end
|
76
84
|
|
77
|
-
# @return [Array
|
85
|
+
# @return [Array<RSpec::Core::Notifications::ExampleNotification>]
|
78
86
|
# returns examples as notifications
|
79
87
|
def notifications
|
80
88
|
@notifications ||= format_examples(examples)
|
81
89
|
end
|
82
90
|
|
83
|
-
# @return [Array
|
91
|
+
# @return [Array<RSpec::Core::Notifications::FailedExampleNotification>]
|
84
92
|
# returns failed examples as notifications
|
85
93
|
def failure_notifications
|
86
94
|
@failed_notifications ||= format_examples(failed_examples)
|
87
95
|
end
|
88
96
|
|
89
|
-
# @return [
|
90
|
-
#
|
97
|
+
# @return [Array<RSpec::Core::Notifications::SkippedExampleNotification,
|
98
|
+
# RSpec::Core::Notifications::PendingExampleFailedAsExpectedNotification>]
|
99
|
+
# returns pending examples as notifications
|
100
|
+
def pending_notifications
|
101
|
+
@pending_notifications ||= format_examples(pending_examples)
|
102
|
+
end
|
103
|
+
|
104
|
+
# @return [String] The list of failed examples, fully formatted in the way
|
105
|
+
# that RSpec's built-in formatters emit.
|
91
106
|
def fully_formatted_failed_examples(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
92
107
|
formatted = "\nFailures:\n"
|
93
108
|
|
@@ -98,18 +113,13 @@ module RSpec::Core
|
|
98
113
|
formatted
|
99
114
|
end
|
100
115
|
|
101
|
-
# @return [String] The list of pending examples, fully formatted in the
|
102
|
-
# RSpec's built-in formatters emit.
|
116
|
+
# @return [String] The list of pending examples, fully formatted in the
|
117
|
+
# way that RSpec's built-in formatters emit.
|
103
118
|
def fully_formatted_pending_examples(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
104
|
-
formatted = "\nPending
|
105
|
-
|
106
|
-
pending_examples.each do |example|
|
107
|
-
formatted_caller = RSpec.configuration.backtrace_formatter.backtrace_line(example.location)
|
119
|
+
formatted = "\nPending: (Failures listed here are expected and do not affect your suite's status)\n"
|
108
120
|
|
109
|
-
|
110
|
-
|
111
|
-
" # #{colorizer.wrap(example.execution_result.pending_message, :detail)}\n" \
|
112
|
-
" # #{colorizer.wrap(formatted_caller, :detail)}\n"
|
121
|
+
pending_notifications.each_with_index do |notification, index|
|
122
|
+
formatted << notification.fully_formatted(index.next, colorizer)
|
113
123
|
end
|
114
124
|
|
115
125
|
formatted
|
@@ -151,24 +161,24 @@ module RSpec::Core
|
|
151
161
|
|
152
162
|
# Returns the message generated for this failure line by line.
|
153
163
|
#
|
154
|
-
# @return [Array
|
164
|
+
# @return [Array<String>] The example failure message
|
155
165
|
def message_lines
|
156
|
-
|
166
|
+
add_shared_group_lines(failure_lines, NullColorizer)
|
157
167
|
end
|
158
168
|
|
159
169
|
# Returns the message generated for this failure colorized line by line.
|
160
170
|
#
|
161
171
|
# @param colorizer [#wrap] An object to colorize the message_lines by
|
162
|
-
# @return [Array
|
172
|
+
# @return [Array<String>] The example failure message colorized
|
163
173
|
def colorized_message_lines(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
164
|
-
|
165
|
-
colorizer.wrap line,
|
174
|
+
add_shared_group_lines(failure_lines, colorizer).map do |line|
|
175
|
+
colorizer.wrap line, message_color
|
166
176
|
end
|
167
177
|
end
|
168
178
|
|
169
179
|
# Returns the failures formatted backtrace.
|
170
180
|
#
|
171
|
-
# @return [Array
|
181
|
+
# @return [Array<String>] the examples backtrace lines
|
172
182
|
def formatted_backtrace
|
173
183
|
backtrace_formatter.format_backtrace(exception.backtrace, example.metadata)
|
174
184
|
end
|
@@ -176,7 +186,7 @@ module RSpec::Core
|
|
176
186
|
# Returns the failures colorized formatted backtrace.
|
177
187
|
#
|
178
188
|
# @param colorizer [#wrap] An object to colorize the message_lines by
|
179
|
-
# @return [Array
|
189
|
+
# @return [Array<String>] the examples colorized backtrace lines
|
180
190
|
def colorized_formatted_backtrace(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
181
191
|
formatted_backtrace.map do |backtrace_info|
|
182
192
|
colorizer.wrap "# #{backtrace_info}", RSpec.configuration.detail_color
|
@@ -186,17 +196,7 @@ module RSpec::Core
|
|
186
196
|
# @return [String] The failure information fully formatted in the way that
|
187
197
|
# RSpec's built-in formatters emit.
|
188
198
|
def fully_formatted(failure_number, colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
189
|
-
|
190
|
-
|
191
|
-
colorized_message_lines(colorizer).each do |line|
|
192
|
-
formatted << RSpec::Support::EncodedString.new(" #{line}\n", encoding_of(formatted))
|
193
|
-
end
|
194
|
-
|
195
|
-
colorized_formatted_backtrace(colorizer).each do |line|
|
196
|
-
formatted << RSpec::Support::EncodedString.new(" #{line}\n", encoding_of(formatted))
|
197
|
-
end
|
198
|
-
|
199
|
-
formatted
|
199
|
+
"\n #{failure_number}) #{description}\n#{formatted_message_and_backtrace(colorizer)}"
|
200
200
|
end
|
201
201
|
|
202
202
|
private
|
@@ -232,29 +232,12 @@ module RSpec::Core
|
|
232
232
|
end
|
233
233
|
end
|
234
234
|
|
235
|
-
def
|
236
|
-
|
237
|
-
lines << colorizer.wrap(
|
235
|
+
def add_shared_group_lines(lines, colorizer)
|
236
|
+
example.metadata[:shared_group_inclusion_backtrace].each do |frame|
|
237
|
+
lines << colorizer.wrap(frame.description, RSpec.configuration.default_color)
|
238
238
|
end
|
239
|
-
lines
|
240
|
-
end
|
241
|
-
|
242
|
-
def shared_group
|
243
|
-
@shared_group ||= group_and_parent_groups.find { |group| group.metadata[:shared_group_name] }
|
244
|
-
end
|
245
239
|
|
246
|
-
|
247
|
-
@shared_group_line ||=
|
248
|
-
if shared_group
|
249
|
-
"Shared Example Group: \"#{shared_group.metadata[:shared_group_name]}\"" \
|
250
|
-
" called from #{backtrace_formatter.backtrace_line(shared_group.location)}"
|
251
|
-
else
|
252
|
-
""
|
253
|
-
end
|
254
|
-
end
|
255
|
-
|
256
|
-
def group_and_parent_groups
|
257
|
-
example.example_group.parent_groups + [example.example_group]
|
240
|
+
lines
|
258
241
|
end
|
259
242
|
|
260
243
|
def read_failed_line
|
@@ -276,11 +259,29 @@ module RSpec::Core
|
|
276
259
|
end
|
277
260
|
|
278
261
|
def find_failed_line
|
279
|
-
|
262
|
+
example_path = example.metadata[:absolute_file_path].downcase
|
280
263
|
exception.backtrace.find do |line|
|
281
|
-
|
282
|
-
|
264
|
+
next unless (line_path = line[/(.+?):(\d+)(|:\d+)/, 1])
|
265
|
+
File.expand_path(line_path).downcase == example_path
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
def formatted_message_and_backtrace(colorizer)
|
270
|
+
formatted = ""
|
271
|
+
|
272
|
+
colorized_message_lines(colorizer).each do |line|
|
273
|
+
formatted << RSpec::Support::EncodedString.new(" #{line}\n", encoding_of(formatted))
|
283
274
|
end
|
275
|
+
|
276
|
+
colorized_formatted_backtrace(colorizer).each do |line|
|
277
|
+
formatted << RSpec::Support::EncodedString.new(" #{line}\n", encoding_of(formatted))
|
278
|
+
end
|
279
|
+
|
280
|
+
formatted
|
281
|
+
end
|
282
|
+
|
283
|
+
def message_color
|
284
|
+
RSpec.configuration.failure_color
|
284
285
|
end
|
285
286
|
end
|
286
287
|
|
@@ -292,7 +293,7 @@ module RSpec::Core
|
|
292
293
|
class PendingExampleFixedNotification < FailedExampleNotification
|
293
294
|
public_class_method :new
|
294
295
|
|
295
|
-
# Returns the examples description
|
296
|
+
# Returns the examples description.
|
296
297
|
#
|
297
298
|
# @return [String] The example description
|
298
299
|
def description
|
@@ -301,7 +302,7 @@ module RSpec::Core
|
|
301
302
|
|
302
303
|
# Returns the message generated for this failure line by line.
|
303
304
|
#
|
304
|
-
# @return [Array
|
305
|
+
# @return [Array<String>] The example failure message
|
305
306
|
def message_lines
|
306
307
|
["Expected pending '#{example.execution_result.pending_message}' to fail. No Error was raised."]
|
307
308
|
end
|
@@ -309,15 +310,70 @@ module RSpec::Core
|
|
309
310
|
# Returns the message generated for this failure colorized line by line.
|
310
311
|
#
|
311
312
|
# @param colorizer [#wrap] An object to colorize the message_lines by
|
312
|
-
# @return [Array
|
313
|
+
# @return [Array<String>] The example failure message colorized
|
313
314
|
def colorized_message_lines(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
314
315
|
message_lines.map { |line| colorizer.wrap(line, RSpec.configuration.fixed_color) }
|
315
316
|
end
|
316
317
|
end
|
317
318
|
|
318
|
-
#
|
319
|
-
|
320
|
-
|
319
|
+
# @private
|
320
|
+
module PendingExampleNotificationMethods
|
321
|
+
private
|
322
|
+
|
323
|
+
def fully_formatted_header(pending_number, colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
324
|
+
colorizer.wrap("\n #{pending_number}) #{example.full_description}\n", :pending) <<
|
325
|
+
colorizer.wrap(" # #{example.execution_result.pending_message}\n", :detail)
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
# The `PendingExampleFailedAsExpectedNotification` extends `FailedExampleNotification` with
|
330
|
+
# things useful for pending specs that fail as expected.
|
331
|
+
#
|
332
|
+
# @attr [RSpec::Core::Example] example the current example
|
333
|
+
# @see ExampleNotification
|
334
|
+
class PendingExampleFailedAsExpectedNotification < FailedExampleNotification
|
335
|
+
include PendingExampleNotificationMethods
|
336
|
+
public_class_method :new
|
337
|
+
|
338
|
+
# @return [Exception] The exception that occurred while the pending example was executed
|
339
|
+
def exception
|
340
|
+
example.execution_result.pending_exception
|
341
|
+
end
|
342
|
+
|
343
|
+
# @return [String] The pending detail fully formatted in the way that
|
344
|
+
# RSpec's built-in formatters emit.
|
345
|
+
def fully_formatted(pending_number, colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
346
|
+
fully_formatted_header(pending_number, colorizer) << formatted_message_and_backtrace(colorizer)
|
347
|
+
end
|
348
|
+
|
349
|
+
private
|
350
|
+
|
351
|
+
def message_color
|
352
|
+
RSpec.configuration.pending_color
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
# The `SkippedExampleNotification` extends `ExampleNotification` with
|
357
|
+
# things useful for specs that are skipped.
|
358
|
+
#
|
359
|
+
# @attr [RSpec::Core::Example] example the current example
|
360
|
+
# @see ExampleNotification
|
361
|
+
class SkippedExampleNotification < ExampleNotification
|
362
|
+
include PendingExampleNotificationMethods
|
363
|
+
public_class_method :new
|
364
|
+
|
365
|
+
# @return [String] The pending detail fully formatted in the way that
|
366
|
+
# RSpec's built-in formatters emit.
|
367
|
+
def fully_formatted(pending_number, colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
368
|
+
formatted_caller = RSpec.configuration.backtrace_formatter.backtrace_line(example.location)
|
369
|
+
fully_formatted_header(pending_number, colorizer) << colorizer.wrap(" # #{formatted_caller}\n", :detail)
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
# The `GroupNotification` represents notifications sent by the reporter
|
374
|
+
# which contain information about the currently running (or soon to be)
|
375
|
+
# example group. It is used by formatters to access information about that
|
376
|
+
# group.
|
321
377
|
#
|
322
378
|
# @example
|
323
379
|
# def example_group_started(notification)
|
@@ -333,11 +389,12 @@ module RSpec::Core
|
|
333
389
|
MessageNotification = Struct.new(:message)
|
334
390
|
|
335
391
|
# The `SeedNotification` holds the seed used to randomize examples and
|
336
|
-
#
|
392
|
+
# whether that seed has been used or not.
|
337
393
|
#
|
338
394
|
# @attr seed [Fixnum] the seed used to randomize ordering
|
339
|
-
# @attr used [Boolean]
|
340
|
-
SeedNotification = Struct.new(:seed, :used)
|
395
|
+
# @attr used [Boolean] whether the seed has been used or not
|
396
|
+
SeedNotification = Struct.new(:seed, :used)
|
397
|
+
class SeedNotification
|
341
398
|
# @api
|
342
399
|
# @return [Boolean] has the seed been used?
|
343
400
|
def seed_used?
|
@@ -348,7 +405,7 @@ module RSpec::Core
|
|
348
405
|
# @return [String] The seed information fully formatted in the way that
|
349
406
|
# RSpec's built-in formatters emit.
|
350
407
|
def fully_formatted
|
351
|
-
"\nRandomized with seed #{seed}\n
|
408
|
+
"\nRandomized with seed #{seed}\n"
|
352
409
|
end
|
353
410
|
end
|
354
411
|
|
@@ -357,13 +414,13 @@ module RSpec::Core
|
|
357
414
|
# of the test run.
|
358
415
|
#
|
359
416
|
# @attr duration [Float] the time taken (in seconds) to run the suite
|
360
|
-
# @attr examples [Array
|
361
|
-
# @attr failed_examples [Array
|
362
|
-
# @attr pending_examples [Array
|
417
|
+
# @attr examples [Array<RSpec::Core::Example>] the examples run
|
418
|
+
# @attr failed_examples [Array<RSpec::Core::Example>] the failed examples
|
419
|
+
# @attr pending_examples [Array<RSpec::Core::Example>] the pending examples
|
363
420
|
# @attr load_time [Float] the number of seconds taken to boot RSpec
|
364
421
|
# and load the spec files
|
365
|
-
SummaryNotification = Struct.new(:duration, :examples, :failed_examples, :pending_examples, :load_time)
|
366
|
-
|
422
|
+
SummaryNotification = Struct.new(:duration, :examples, :failed_examples, :pending_examples, :load_time)
|
423
|
+
class SummaryNotification
|
367
424
|
# @api
|
368
425
|
# @return [Fixnum] the number of examples run
|
369
426
|
def example_count
|
@@ -420,18 +477,19 @@ module RSpec::Core
|
|
420
477
|
def colorized_rerun_commands(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
421
478
|
"\nFailed examples:\n\n" +
|
422
479
|
failed_examples.map do |example|
|
423
|
-
colorizer.wrap("rspec #{example.
|
424
|
-
colorizer.wrap("# #{example.full_description}",
|
480
|
+
colorizer.wrap("rspec #{example.rerun_argument}", RSpec.configuration.failure_color) + " " +
|
481
|
+
colorizer.wrap("# #{example.full_description}", RSpec.configuration.detail_color)
|
425
482
|
end.join("\n")
|
426
483
|
end
|
427
484
|
|
428
|
-
# @return [String] a formatted version of the time it took to run the
|
485
|
+
# @return [String] a formatted version of the time it took to run the
|
486
|
+
# suite
|
429
487
|
def formatted_duration
|
430
488
|
Formatters::Helpers.format_duration(duration)
|
431
489
|
end
|
432
490
|
|
433
|
-
# @return [String] a formatted version of the time it took to boot RSpec
|
434
|
-
# load the spec files
|
491
|
+
# @return [String] a formatted version of the time it took to boot RSpec
|
492
|
+
# and load the spec files
|
435
493
|
def formatted_load_time
|
436
494
|
Formatters::Helpers.format_duration(load_time)
|
437
495
|
end
|
@@ -451,16 +509,16 @@ module RSpec::Core
|
|
451
509
|
end
|
452
510
|
end
|
453
511
|
|
454
|
-
# The `ProfileNotification` holds information about the results of running
|
455
|
-
#
|
512
|
+
# The `ProfileNotification` holds information about the results of running a
|
513
|
+
# test suite when profiling is enabled. It is used by formatters to provide
|
456
514
|
# information at the end of the test run for profiling information.
|
457
515
|
#
|
458
516
|
# @attr duration [Float] the time taken (in seconds) to run the suite
|
459
|
-
# @attr examples [Array
|
517
|
+
# @attr examples [Array<RSpec::Core::Example>] the examples run
|
460
518
|
# @attr number_of_examples [Fixnum] the number of examples to profile
|
461
|
-
ProfileNotification = Struct.new(:duration, :examples, :number_of_examples)
|
462
|
-
|
463
|
-
# @return [Array
|
519
|
+
ProfileNotification = Struct.new(:duration, :examples, :number_of_examples)
|
520
|
+
class ProfileNotification
|
521
|
+
# @return [Array<RSpec::Core::Example>] the slowest examples
|
464
522
|
def slowest_examples
|
465
523
|
@slowest_examples ||=
|
466
524
|
examples.sort_by do |example|
|
@@ -485,7 +543,7 @@ module RSpec::Core
|
|
485
543
|
end
|
486
544
|
end
|
487
545
|
|
488
|
-
# @return [Array
|
546
|
+
# @return [Array<RSpec::Core::Example>] the slowest example groups
|
489
547
|
def slowest_groups
|
490
548
|
@slowest_groups ||= calculate_slowest_groups
|
491
549
|
end
|
@@ -517,14 +575,17 @@ module RSpec::Core
|
|
517
575
|
end
|
518
576
|
|
519
577
|
# The `DeprecationNotification` is issued by the reporter when a deprecated
|
520
|
-
# part of RSpec is encountered. It represents information about the
|
521
|
-
# call site.
|
578
|
+
# part of RSpec is encountered. It represents information about the
|
579
|
+
# deprecated call site.
|
522
580
|
#
|
523
581
|
# @attr message [String] A custom message about the deprecation
|
524
|
-
# @attr deprecated [String] A custom message about the deprecation (alias of
|
582
|
+
# @attr deprecated [String] A custom message about the deprecation (alias of
|
583
|
+
# message)
|
525
584
|
# @attr replacement [String] An optional replacement for the deprecation
|
526
|
-
# @attr call_site [String] An optional call site from which the deprecation
|
527
|
-
|
585
|
+
# @attr call_site [String] An optional call site from which the deprecation
|
586
|
+
# was issued
|
587
|
+
DeprecationNotification = Struct.new(:deprecated, :message, :replacement, :call_site)
|
588
|
+
class DeprecationNotification
|
528
589
|
private_class_method :new
|
529
590
|
|
530
591
|
# @api
|