rspec-core 3.12.2 → 3.13.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e105bb79ced0094703c116de121aced72afd16f580c3faba5aa9da6c7d84316d
4
- data.tar.gz: 7f5df2dec8edeb01d39c2296331d5a24aa2b8c2f4122763045edf4d27531df56
3
+ metadata.gz: 2a6e69a31520af7fc44f9215cc15c68579ff0c4e0068069cd214f6a1f6e347c4
4
+ data.tar.gz: 12bec6fc73dd01cf153b4385fe2fa9b6e5b627281cd0ce7bd3a5d3010a6ad701
5
5
  SHA512:
6
- metadata.gz: 64d5b3ad7ccd921c553ef73c7870d4118d5ad6de826a5ed26190983d802455c1caf80f62a9982aad70492ba40b568d2e84fb19f8ffde6940ecf37100953a20d7
7
- data.tar.gz: 04ac5e2f690218999a7a936319d7e4f2a995cc796364d9c3af5a0db6065d271be0e2445c5f7038b85ccfe4bf03ae7d263600e4de36cca4c8e6e241e51fcb4bbb
6
+ metadata.gz: 73cf249da659f2e7d7f9ff2480c3c602990449364bfe1d976f122538da6c06321cc3f458a0153bcb70c7bd22aef485e52a81fef7d5f85dc9d5221484cfca5697
7
+ data.tar.gz: febfcb38337060e428a5d8c0acd5d2a087896b88815c49d4b6bb0f005330358f6000e1f4688e644117341f5e80ab2134d343c7d7fbb8ee3271f4ddb6f667fb0f
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...3-12-maintenance)
2
+ [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.13.1...3-13-maintenance)
3
+
4
+ ### 3.13.1 / 2024-09-02
5
+ [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.13.0...v3.13.1)
6
+
7
+ Bug fixes:
8
+
9
+ * Sort ids to run as the original order to fix `--bisect`. (Maki Kawahara, #3093)
10
+
11
+ ### 3.13.0 / 2024-02-04
12
+ [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.12.3...v3.13.0)
13
+
14
+ Enhancements:
15
+
16
+ * Support the `--backtrace` flag when using the JSON formatter. (Matt Larraz, #2980)
17
+ * Ignore commented out lines in CLI config files (e.g. `.rspec`). (Junichi Ito, #2984)
18
+ * Add `pending_failure_output` config option to allow skipping backtraces or
19
+ muting pending specs output. (Phil Pirozhkov, #2957)
20
+ * Process `--dry-run` before configuration flags that read files so that introspecting
21
+ it returns the correct value. (Xenor Chang, #3008)
22
+ * Allow specifying custom ordering strategies via `--order`. (Jon Rowe, #3025)
23
+ * Use the improved `syntax_suggest` output for `SyntaxError` when available.
24
+ (Richard Schneeman, #3015, #3026)
25
+ * Add config option (`RSpec::Core::Configuration#full_cause_backtrace`) to print the
26
+ entire backtrace of an exception cause. (David Taylor, #3046)
27
+
28
+ ### 3.12.3 / 2024-02-04
29
+ [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.12.2...v3.12.3)
30
+
31
+ Bug fixes:
32
+
33
+ * Use `__send__` in output wrapper to avoid issues with IO objects that implement `send`
34
+ like `Socket`. (Richard Platel, #3045)
3
35
 
4
36
  ### 3.12.2 / 2023-04-18
5
37
  [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.12.1...v3.12.2)
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
@@ -136,7 +136,7 @@ module RSpec
136
136
  end
137
137
 
138
138
  def get_expected_failures_for?(ids)
139
- ids_to_run = ids + failed_example_ids
139
+ ids_to_run = all_example_ids & (ids + failed_example_ids)
140
140
  notify(
141
141
  :bisect_individual_run_start,
142
142
  :command => shell_command.repro_command_from(ids_to_run),
@@ -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
- # (default `10`).
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
@@ -1743,8 +1764,9 @@ module RSpec
1743
1764
  # @private
1744
1765
  RAISE_ERROR_WARNING_NOTIFIER = lambda { |message| raise message }
1745
1766
 
1746
- # Turns warnings into errors. This can be useful when
1767
+ # Turns RSpec warnings into errors. This can be useful when
1747
1768
  # you want RSpec to run in a 'strict' no warning situation.
1769
+ # (Note this does not capture or raise on Ruby warnings).
1748
1770
  #
1749
1771
  # @example
1750
1772
  #
@@ -2120,6 +2142,13 @@ module RSpec
2120
2142
  suggestions = DidYouMean.new(relative_file).call
2121
2143
  reporter.notify_non_example_exception(ex, "An error occurred while loading #{relative_file}.#{suggestions}")
2122
2144
  RSpec.world.wants_to_quit = true
2145
+ rescue SyntaxError => ex
2146
+ relative_file = Metadata.relative_path(file)
2147
+ reporter.notify_non_example_exception(
2148
+ ex,
2149
+ "While loading #{relative_file} a `raise SyntaxError` occurred, RSpec will now quit."
2150
+ )
2151
+ RSpec.world.rspec_is_quitting = true
2123
2152
  rescue Support::AllExceptionsExceptOnesWeMustNotRescue => ex
2124
2153
  relative_file = Metadata.relative_path(file)
2125
2154
  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
- FlatMap.flat_map(config_string.split(/\n+/), &:shellsplit)
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
- cause << (" #{backtrace_formatter.format_backtrace(last_cause.backtrace, example.metadata).first}")
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
- def exception_message_string(exception)
179
- exception.message.to_s
180
- rescue Exception => other
181
- "A #{exception.class} for which `exception.message.to_s` raises #{other.class}."
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(notification)
36
- @output_hash[:examples] = notification.examples.map do |example|
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 => e.backtrace,
44
+ :backtrace => notification.formatted_backtrace,
44
45
  }
45
46
  end
46
47
  end
@@ -461,7 +461,7 @@ module RSpec
461
461
  # TODO: consider making this an error in RSpec 4. For SemVer reasons,
462
462
  # we are only warning in RSpec 3.
463
463
  RSpec.warn_with "WARNING: `around(:context)` hooks are not supported and " \
464
- "behave like `around(:example)."
464
+ "behave like `around(:example)`."
465
465
  end
466
466
 
467
467
  hook = HOOK_TYPES[position][scope].new(block, options)
@@ -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|
@@ -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
- register_ordering(:global, ordering_registry.fetch(ordering_name)) if ordering_name
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.send(name, *args, &block)
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.send(method, *args, &block)
24
+ output.__send__(method, *args, &block)
25
25
  end
26
26
  end
27
27
  end
@@ -59,7 +59,7 @@ module RSpec
59
59
  # executed. If you need to consider hooks as pending as well you can use
60
60
  # the pending metadata as an alternative, e.g.
61
61
  # `it "does something", pending: "message"`.
62
- def pending(message=nil)
62
+ def pending(message=nil, &_block)
63
63
  current_example = RSpec.current_example
64
64
 
65
65
  if block_given?
@@ -182,7 +182,11 @@ module RSpec
182
182
  exit!(1)
183
183
  else
184
184
  RSpec.world.wants_to_quit = true
185
- $stderr.puts "\nRSpec is shutting down and will print the summary report... Interrupt again to force quit."
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
 
@@ -3,7 +3,7 @@ module RSpec
3
3
  # Version information for RSpec Core.
4
4
  module Version
5
5
  # Current version of RSpec Core, in semantic versioning format.
6
- STRING = '3.12.2'
6
+ STRING = '3.13.1'
7
7
  end
8
8
  end
9
9
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.2
4
+ version: 3.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Baker
8
8
  - David Chelimsky
9
9
  - Chad Humphries
10
10
  - Myron Marston
11
- autorequire:
12
11
  bindir: exe
13
12
  cert_chain:
14
13
  - |
@@ -46,7 +45,7 @@ cert_chain:
46
45
  ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
47
46
  F3MdtaDehhjC
48
47
  -----END CERTIFICATE-----
49
- date: 2023-04-18 00:00:00.000000000 Z
48
+ date: 2024-09-03 00:00:00.000000000 Z
50
49
  dependencies:
51
50
  - !ruby/object:Gem::Dependency
52
51
  name: rspec-support
@@ -54,14 +53,14 @@ dependencies:
54
53
  requirements:
55
54
  - - "~>"
56
55
  - !ruby/object:Gem::Version
57
- version: 3.12.0
56
+ version: 3.13.0
58
57
  type: :runtime
59
58
  prerelease: false
60
59
  version_requirements: !ruby/object:Gem::Requirement
61
60
  requirements:
62
61
  - - "~>"
63
62
  - !ruby/object:Gem::Version
64
- version: 3.12.0
63
+ version: 3.13.0
65
64
  - !ruby/object:Gem::Dependency
66
65
  name: cucumber
67
66
  requirement: !ruby/object:Gem::Requirement
@@ -267,11 +266,10 @@ licenses:
267
266
  - MIT
268
267
  metadata:
269
268
  bug_tracker_uri: https://github.com/rspec/rspec-core/issues
270
- changelog_uri: https://github.com/rspec/rspec-core/blob/v3.12.2/Changelog.md
269
+ changelog_uri: https://github.com/rspec/rspec-core/blob/v3.13.1/Changelog.md
271
270
  documentation_uri: https://rspec.info/documentation/
272
271
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
273
272
  source_code_uri: https://github.com/rspec/rspec-core
274
- post_install_message:
275
273
  rdoc_options:
276
274
  - "--charset=UTF-8"
277
275
  require_paths:
@@ -287,8 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
285
  - !ruby/object:Gem::Version
288
286
  version: '0'
289
287
  requirements: []
290
- rubygems_version: 3.4.10
291
- signing_key:
288
+ rubygems_version: 3.6.0.dev
292
289
  specification_version: 4
293
- summary: rspec-core-3.12.2
290
+ summary: rspec-core-3.13.1
294
291
  test_files: []
metadata.gz.sig CHANGED
Binary file