rspec-core 3.12.1 → 3.13.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/Changelog.md +33 -1
- data/README.md +5 -0
- data/lib/rspec/core/configuration.rb +30 -2
- data/lib/rspec/core/configuration_options.rb +6 -1
- data/lib/rspec/core/formatters/exception_presenter.rb +27 -6
- data/lib/rspec/core/formatters/json_formatter.rb +7 -6
- data/lib/rspec/core/notifications.rb +2 -0
- data/lib/rspec/core/ordering.rb +40 -1
- data/lib/rspec/core/output_wrapper.rb +2 -2
- data/lib/rspec/core/project_initializer/spec/spec_helper.rb +1 -1
- data/lib/rspec/core/reporter.rb +1 -1
- data/lib/rspec/core/runner.rb +5 -1
- data/lib/rspec/core/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +7 -7
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74e1ccff0acb0f5e68bb6ed4c4552b0313d28e348f414d37e09b5741321c6153
|
4
|
+
data.tar.gz: 017cac1b0c789c1a75dc9bb782a415608284ef2e9fcaba87087e5745040abeb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e16148576b7e0405cf5de89771fc303a7ae20166250f5d29b5c651bc5a7757a7da183081eccf762050cc85b2e8f2618d7a4104f5957da9e5d6709b17b780d81a
|
7
|
+
data.tar.gz: e8a969ee3e5154e6873a5b180ae71a24cc0ae5c62cf5c2642fafab7be5814c2e37987256cbf908421ee1eacfd0ebe0476f254108845df2cdc921cf2fbebd3741
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,5 +1,37 @@
|
|
1
1
|
### Development
|
2
|
-
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.12.
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.12.3...main)
|
3
|
+
|
4
|
+
### 3.13.0 / 2024-02-04
|
5
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.12.3...v3.13.0)
|
6
|
+
|
7
|
+
Enhancements:
|
8
|
+
|
9
|
+
* Support the `--backtrace` flag when using the JSON formatter. (Matt Larraz, #2980)
|
10
|
+
* Ignore commented out lines in CLI config files (e.g. `.rspec`). (Junichi Ito, #2984)
|
11
|
+
* Add `pending_failure_output` config option to allow skipping backtraces or
|
12
|
+
muting pending specs output. (Phil Pirozhkov, #2957)
|
13
|
+
* Process `--dry-run` before configuration flags that read files so that introspecting
|
14
|
+
it returns the correct value. (Xenor Chang, #3008)
|
15
|
+
* Allow specifying custom ordering strategies via `--order`. (Jon Rowe, #3025)
|
16
|
+
* Use the improved `syntax_suggest` output for `SyntaxError` when available.
|
17
|
+
(Richard Schneeman, #3015, #3026)
|
18
|
+
* Add config option (`RSpec::Core::Configuration#full_cause_backtrace`) to print the
|
19
|
+
entire backtrace of an exception cause. (David Taylor, #3046)
|
20
|
+
|
21
|
+
### 3.12.3 / 2024-02-04
|
22
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.12.2...v3.12.3)
|
23
|
+
|
24
|
+
Bug fixes:
|
25
|
+
|
26
|
+
* Use `__send__` in output wrapper to avoid issues with IO objects that implement `send`
|
27
|
+
like `Socket`. (Richard Platel, #3045)
|
28
|
+
|
29
|
+
### 3.12.2 / 2023-04-18
|
30
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.12.1...v3.12.2)
|
31
|
+
|
32
|
+
Bug fixes:
|
33
|
+
|
34
|
+
* Remove link to outdated documentation in generated output. (Jon Rowe, #3035)
|
3
35
|
|
4
36
|
### 3.12.1 / 2023-02-03
|
5
37
|
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.12.0...v3.12.1)
|
data/README.md
CHANGED
@@ -116,6 +116,11 @@ pretty much the same as `shared_examples` and `include_examples`, providing
|
|
116
116
|
more accurate naming when you share hooks, `let` declarations, helper methods,
|
117
117
|
etc, but no examples.
|
118
118
|
|
119
|
+
If you want to reuse shared examples or contexts across your RSpec suite you can
|
120
|
+
define them in a stand alone _*.rb_ files (_spec/support/shared_examples/definition.rb_
|
121
|
+
for example). But you will have to manually `require` them (there is no autoloading of
|
122
|
+
_spec/support/_ directory unless you set it up yourself).
|
123
|
+
|
119
124
|
## Metadata
|
120
125
|
|
121
126
|
rspec-core stores a metadata hash with every example and group, which
|
@@ -453,11 +453,30 @@ module RSpec
|
|
453
453
|
add_setting :threadsafe
|
454
454
|
|
455
455
|
# @macro add_setting
|
456
|
-
# Maximum count of failed source lines to display in the failure reports
|
457
|
-
# (
|
456
|
+
# Maximum count of failed source lines to display in the failure reports
|
457
|
+
# (defaults to `10`).
|
458
458
|
# return [Integer]
|
459
459
|
add_setting :max_displayed_failure_line_count
|
460
460
|
|
461
|
+
# @macro full_cause_backtrace
|
462
|
+
# Display the full backtrace of an exceptions cause (defaults to `false`).
|
463
|
+
# return [Boolean]
|
464
|
+
add_setting :full_cause_backtrace
|
465
|
+
|
466
|
+
# @macro add_setting
|
467
|
+
# Format the output for pending examples. Can be set to:
|
468
|
+
# - :full (default) - pending examples appear similarly to failures
|
469
|
+
# - :no_backtrace - same as above, but with no backtrace
|
470
|
+
# - :skip - do not show the section at all
|
471
|
+
# return [Symbol]
|
472
|
+
add_read_only_setting :pending_failure_output
|
473
|
+
def pending_failure_output=(mode)
|
474
|
+
raise ArgumentError,
|
475
|
+
"`pending_failure_output` can be set to :full, :no_backtrace, " \
|
476
|
+
"or :skip" unless [:full, :no_backtrace, :skip].include?(mode)
|
477
|
+
@pending_failure_output = mode
|
478
|
+
end
|
479
|
+
|
461
480
|
# Determines which bisect runner implementation gets used to run subsets
|
462
481
|
# of the suite during a bisection. Your choices are:
|
463
482
|
#
|
@@ -557,8 +576,10 @@ module RSpec
|
|
557
576
|
@derived_metadata_blocks = FilterableItemRepository::QueryOptimized.new(:any?)
|
558
577
|
@threadsafe = true
|
559
578
|
@max_displayed_failure_line_count = 10
|
579
|
+
@full_cause_backtrace = false
|
560
580
|
@world = World::Null
|
561
581
|
@shared_context_metadata_behavior = :trigger_inclusion
|
582
|
+
@pending_failure_output = :full
|
562
583
|
|
563
584
|
define_built_in_hooks
|
564
585
|
end
|
@@ -2120,6 +2141,13 @@ module RSpec
|
|
2120
2141
|
suggestions = DidYouMean.new(relative_file).call
|
2121
2142
|
reporter.notify_non_example_exception(ex, "An error occurred while loading #{relative_file}.#{suggestions}")
|
2122
2143
|
RSpec.world.wants_to_quit = true
|
2144
|
+
rescue SyntaxError => ex
|
2145
|
+
relative_file = Metadata.relative_path(file)
|
2146
|
+
reporter.notify_non_example_exception(
|
2147
|
+
ex,
|
2148
|
+
"While loading #{relative_file} a `raise SyntaxError` occurred, RSpec will now quit."
|
2149
|
+
)
|
2150
|
+
RSpec.world.rspec_is_quitting = true
|
2123
2151
|
rescue Support::AllExceptionsExceptOnesWeMustNotRescue => ex
|
2124
2152
|
relative_file = Metadata.relative_path(file)
|
2125
2153
|
reporter.notify_non_example_exception(ex, "An error occurred while loading #{relative_file}.")
|
@@ -79,6 +79,10 @@ module RSpec
|
|
79
79
|
# deprecation (or otherwise access the reporter).
|
80
80
|
:deprecation_stream,
|
81
81
|
|
82
|
+
# In order for `RSpec.configuration.dry_run?` to return `true` during
|
83
|
+
# processing the `requires` option, it must be parsed before it.
|
84
|
+
:dry_run,
|
85
|
+
|
82
86
|
# load paths depend on nothing, but must be set before `requires`
|
83
87
|
# to support load-path-relative requires.
|
84
88
|
:libs,
|
@@ -169,7 +173,8 @@ module RSpec
|
|
169
173
|
def args_from_options_file(path)
|
170
174
|
return [] unless path && File.exist?(path)
|
171
175
|
config_string = options_file_as_erb_string(path)
|
172
|
-
|
176
|
+
config_lines = config_string.split(/\n+/).reject { |s| s =~ /\A\s*#/ }
|
177
|
+
FlatMap.flat_map(config_lines, &:shellsplit)
|
173
178
|
end
|
174
179
|
|
175
180
|
def options_file_as_erb_string(path)
|
@@ -56,7 +56,12 @@ module RSpec
|
|
56
56
|
end
|
57
57
|
|
58
58
|
unless last_cause.backtrace.nil? || last_cause.backtrace.empty?
|
59
|
-
|
59
|
+
lines = backtrace_formatter.format_backtrace(last_cause.backtrace, example.metadata)
|
60
|
+
lines = [lines[0]] unless RSpec.configuration.full_cause_backtrace # rubocop:disable Metrics/BlockNesting
|
61
|
+
|
62
|
+
lines.each do |line|
|
63
|
+
cause << (" #{line}")
|
64
|
+
end
|
60
65
|
end
|
61
66
|
end
|
62
67
|
|
@@ -175,10 +180,22 @@ module RSpec
|
|
175
180
|
end
|
176
181
|
|
177
182
|
# rubocop:disable Lint/RescueException
|
178
|
-
|
179
|
-
exception
|
180
|
-
|
181
|
-
|
183
|
+
if SyntaxError.instance_methods.include?(:detailed_message)
|
184
|
+
def exception_message_string(exception)
|
185
|
+
case exception
|
186
|
+
when SyntaxError then exception.detailed_message.to_s
|
187
|
+
else
|
188
|
+
exception.message.to_s
|
189
|
+
end
|
190
|
+
rescue Exception => other
|
191
|
+
"A #{exception.class} for which `exception.message.to_s` raises #{other.class}."
|
192
|
+
end
|
193
|
+
else
|
194
|
+
def exception_message_string(exception)
|
195
|
+
exception.message.to_s
|
196
|
+
rescue Exception => other
|
197
|
+
"A #{exception.class} for which `exception.message.to_s` raises #{other.class}."
|
198
|
+
end
|
182
199
|
end
|
183
200
|
# rubocop:enable Lint/RescueException
|
184
201
|
|
@@ -312,10 +329,14 @@ module RSpec
|
|
312
329
|
]
|
313
330
|
}
|
314
331
|
elsif @execution_result.status == :pending
|
315
|
-
{
|
332
|
+
options = {
|
316
333
|
:message_color => RSpec.configuration.pending_color,
|
317
334
|
:detail_formatter => PENDING_DETAIL_FORMATTER
|
318
335
|
}
|
336
|
+
if RSpec.configuration.pending_failure_output == :no_backtrace
|
337
|
+
options[:backtrace_formatter] = EmptyBacktraceFormatter
|
338
|
+
end
|
339
|
+
options
|
319
340
|
end
|
320
341
|
end
|
321
342
|
|
@@ -32,15 +32,16 @@ module RSpec
|
|
32
32
|
@output_hash[:summary_line] = summary.totals_line
|
33
33
|
end
|
34
34
|
|
35
|
-
def stop(
|
36
|
-
@output_hash[:examples] =
|
37
|
-
format_example(example).tap do |hash|
|
38
|
-
e = example.exception
|
35
|
+
def stop(group_notification)
|
36
|
+
@output_hash[:examples] = group_notification.notifications.map do |notification|
|
37
|
+
format_example(notification.example).tap do |hash|
|
38
|
+
e = notification.example.exception
|
39
|
+
|
39
40
|
if e
|
40
|
-
hash[:exception] =
|
41
|
+
hash[:exception] = {
|
41
42
|
:class => e.class.name,
|
42
43
|
:message => e.message,
|
43
|
-
:backtrace =>
|
44
|
+
:backtrace => notification.formatted_backtrace,
|
44
45
|
}
|
45
46
|
end
|
46
47
|
end
|
@@ -120,6 +120,8 @@ module RSpec::Core
|
|
120
120
|
# @return [String] The list of pending examples, fully formatted in the
|
121
121
|
# way that RSpec's built-in formatters emit.
|
122
122
|
def fully_formatted_pending_examples(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
123
|
+
return if RSpec.configuration.pending_failure_output == :skip
|
124
|
+
|
123
125
|
formatted = "\nPending: (Failures listed here are expected and do not affect your suite's status)\n".dup
|
124
126
|
|
125
127
|
pending_notifications.each_with_index do |notification, index|
|
data/lib/rspec/core/ordering.rb
CHANGED
@@ -78,6 +78,30 @@ module RSpec
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
# @private
|
82
|
+
# A strategy which delays looking up the ordering until needed
|
83
|
+
class Delayed
|
84
|
+
def initialize(registry, name)
|
85
|
+
@registry = registry
|
86
|
+
@name = name
|
87
|
+
end
|
88
|
+
|
89
|
+
def order(list)
|
90
|
+
strategy.order(list)
|
91
|
+
end
|
92
|
+
|
93
|
+
private
|
94
|
+
|
95
|
+
def strategy
|
96
|
+
@strategy ||= lookup_strategy
|
97
|
+
end
|
98
|
+
|
99
|
+
def lookup_strategy
|
100
|
+
raise "Undefined ordering strategy #{@name.inspect}" unless @registry.has_strategy?(@name)
|
101
|
+
@registry.fetch(@name)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
81
105
|
# @private
|
82
106
|
# Stores the different ordering strategies.
|
83
107
|
class Registry
|
@@ -99,6 +123,10 @@ module RSpec
|
|
99
123
|
@strategies.fetch(name, &fallback)
|
100
124
|
end
|
101
125
|
|
126
|
+
def has_strategy?(name)
|
127
|
+
@strategies.key?(name)
|
128
|
+
end
|
129
|
+
|
102
130
|
def register(sym, strategy)
|
103
131
|
@strategies[sym] = strategy
|
104
132
|
end
|
@@ -143,9 +171,20 @@ module RSpec
|
|
143
171
|
:defined
|
144
172
|
elsif order == 'recently-modified'
|
145
173
|
:recently_modified
|
174
|
+
else
|
175
|
+
order.to_sym
|
146
176
|
end
|
147
177
|
|
148
|
-
|
178
|
+
if ordering_name
|
179
|
+
strategy =
|
180
|
+
if ordering_registry.has_strategy?(ordering_name)
|
181
|
+
ordering_registry.fetch(ordering_name)
|
182
|
+
else
|
183
|
+
Delayed.new(ordering_registry, ordering_name)
|
184
|
+
end
|
185
|
+
|
186
|
+
register_ordering(:global, strategy)
|
187
|
+
end
|
149
188
|
end
|
150
189
|
|
151
190
|
def force(hash)
|
@@ -15,13 +15,13 @@ module RSpec
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def method_missing(name, *args, &block)
|
18
|
-
output.
|
18
|
+
output.__send__(name, *args, &block)
|
19
19
|
end
|
20
20
|
|
21
21
|
# Redirect calls for IO interface methods
|
22
22
|
IO.instance_methods(false).each do |method|
|
23
23
|
define_method(method) do |*args, &block|
|
24
|
-
output.
|
24
|
+
output.__send__(method, *args, &block)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -61,7 +61,7 @@ RSpec.configure do |config|
|
|
61
61
|
|
62
62
|
# Limits the available syntax to the non-monkey patched syntax that is
|
63
63
|
# recommended. For more details, see:
|
64
|
-
# https://
|
64
|
+
# https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
|
65
65
|
config.disable_monkey_patching!
|
66
66
|
|
67
67
|
# This setting enables warnings. It's recommended, but in some cases may
|
data/lib/rspec/core/reporter.rb
CHANGED
@@ -30,7 +30,7 @@ module RSpec::Core
|
|
30
30
|
# Registers a listener to a list of notifications. The reporter will send
|
31
31
|
# notification of events to all registered listeners.
|
32
32
|
#
|
33
|
-
# @param listener [Object] An
|
33
|
+
# @param listener [Object] An object that wishes to be notified of reporter
|
34
34
|
# events
|
35
35
|
# @param notifications [Array] Array of symbols represents the events a
|
36
36
|
# listener wishes to subscribe too
|
data/lib/rspec/core/runner.rb
CHANGED
@@ -182,7 +182,11 @@ module RSpec
|
|
182
182
|
exit!(1)
|
183
183
|
else
|
184
184
|
RSpec.world.wants_to_quit = true
|
185
|
-
|
185
|
+
|
186
|
+
$stderr.puts(
|
187
|
+
"\nRSpec is shutting down and will print the summary report... Interrupt again to force quit " \
|
188
|
+
"(warning: at_exit hooks will be skipped if you force quit)."
|
189
|
+
)
|
186
190
|
end
|
187
191
|
end
|
188
192
|
|
data/lib/rspec/core/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Baker
|
@@ -46,7 +46,7 @@ cert_chain:
|
|
46
46
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
47
47
|
F3MdtaDehhjC
|
48
48
|
-----END CERTIFICATE-----
|
49
|
-
date:
|
49
|
+
date: 2024-02-04 00:00:00.000000000 Z
|
50
50
|
dependencies:
|
51
51
|
- !ruby/object:Gem::Dependency
|
52
52
|
name: rspec-support
|
@@ -54,14 +54,14 @@ dependencies:
|
|
54
54
|
requirements:
|
55
55
|
- - "~>"
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: 3.
|
57
|
+
version: 3.13.0
|
58
58
|
type: :runtime
|
59
59
|
prerelease: false
|
60
60
|
version_requirements: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
62
|
- - "~>"
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: 3.
|
64
|
+
version: 3.13.0
|
65
65
|
- !ruby/object:Gem::Dependency
|
66
66
|
name: cucumber
|
67
67
|
requirement: !ruby/object:Gem::Requirement
|
@@ -267,7 +267,7 @@ licenses:
|
|
267
267
|
- MIT
|
268
268
|
metadata:
|
269
269
|
bug_tracker_uri: https://github.com/rspec/rspec-core/issues
|
270
|
-
changelog_uri: https://github.com/rspec/rspec-core/blob/v3.
|
270
|
+
changelog_uri: https://github.com/rspec/rspec-core/blob/v3.13.0/Changelog.md
|
271
271
|
documentation_uri: https://rspec.info/documentation/
|
272
272
|
mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
|
273
273
|
source_code_uri: https://github.com/rspec/rspec-core
|
@@ -287,8 +287,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
287
|
- !ruby/object:Gem::Version
|
288
288
|
version: '0'
|
289
289
|
requirements: []
|
290
|
-
rubygems_version: 3.
|
290
|
+
rubygems_version: 3.4.10
|
291
291
|
signing_key:
|
292
292
|
specification_version: 4
|
293
|
-
summary: rspec-core-3.
|
293
|
+
summary: rspec-core-3.13.0
|
294
294
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|