rspec-core 3.9.3 → 3.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30e931022769b69911776a8c64de53481785df0074e84693b5e4031c20a53bb2
4
- data.tar.gz: 9d5f23168383bff0e8f3152d9e111ed7600ee1cefb9ccaeb6c1a0fa384dfe3b1
3
+ metadata.gz: 0117b5c68702f84872a6b528a286040ebad81a5201912cf75add518b16391fd8
4
+ data.tar.gz: 6a744e765c464099b304f42223079af2133ee5e278ffa3f3f3c5118f0ccdae54
5
5
  SHA512:
6
- metadata.gz: 50a9d24a978ca5c0e13bccb4b10343aeac24d2895692d0a2c7d3a6ab429213ede9b9406d4deca6d7cb496f91919eb38fe711ca0294eb94d26e60e4c07abb2e4b
7
- data.tar.gz: e412bad1efb696f88065ba2adab372ef8e613ece6f70dd8bf193daeab5e3c8ea41978d3d2b3f5829c4a11c3eb3e2f01428f979d8b75f1f658dc4dcb78fdbf263
6
+ metadata.gz: d659433a8e529d32ef874d0e6c6d100a5482f1dbb1bcc00a65daccbdfd23fd16307f6938b01fada58609ea828f7215992574dd7fda7f1c2873763f9abbf77574
7
+ data.tar.gz: bdec2aae3e9a5a0c34ccba2bb97a3f4480fa8400f605bb0625b609ebb90a3abf77bfcdbe247f0137d00a2d69f26c3e9ee1565a7a653afe3d14376b3eb97f6ac4
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,13 @@
1
+ ### 3.10.0 / 2020-10-30
2
+ [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.9.3...v3.10.0)
3
+
4
+ Enhancements:
5
+
6
+ * Memoize `RSpec::Core::Formatters::ExceptionPresenter#exception_lines` to improve performance
7
+ with slow exception messages. (Maxime Lapointe, #2743)
8
+ * Add configuration for an error exit code (to disambiguate errored builds from failed builds
9
+ by exit status). (Dana Sherson, #2749)
10
+
1
11
  # 3.9.3 / 2020-09-30
2
12
  [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.9.2...v3.9.3)
3
13
 
@@ -242,6 +242,11 @@ module RSpec
242
242
  # @return [Integer]
243
243
  add_setting :failure_exit_code
244
244
 
245
+ # @macro add_setting
246
+ # The exit code to return if there are any errors outside examples (default: failure_exit_code)
247
+ # @return [Integer]
248
+ add_setting :error_exit_code
249
+
245
250
  # @macro add_setting
246
251
  # Whether or not to fail when there are no RSpec examples (default: false).
247
252
  # @return [Boolean]
@@ -523,6 +528,7 @@ module RSpec
523
528
  @pattern = '**{,/*/**}/*_spec.rb'
524
529
  @exclude_pattern = ''
525
530
  @failure_exit_code = 1
531
+ @error_exit_code = nil # so it can be overridden by failure exit code
526
532
  @fail_if_no_examples = false
527
533
  @spec_files_loaded = false
528
534
 
@@ -51,6 +51,7 @@ module RSpec
51
51
  argv << "--order" << @submitted_options[:order] if @submitted_options[:order]
52
52
 
53
53
  add_failure_exit_code(argv)
54
+ add_error_exit_code(argv)
54
55
  add_full_description(argv)
55
56
  add_filter(argv, :inclusion, @filter_manager.inclusions)
56
57
  add_filter(argv, :exclusion, @filter_manager.exclusions)
@@ -67,6 +68,12 @@ module RSpec
67
68
  argv << "--failure-exit-code" << @submitted_options[:failure_exit_code].to_s
68
69
  end
69
70
 
71
+ def add_error_exit_code(argv)
72
+ return unless @submitted_options[:error_exit_code]
73
+
74
+ argv << "--error-exit-code" << @submitted_options[:error_exit_code].to_s
75
+ end
76
+
70
77
  def add_full_description(argv)
71
78
  return unless @submitted_options[:full_description]
72
79
 
@@ -183,12 +183,14 @@ module RSpec
183
183
  # rubocop:enable Lint/RescueException
184
184
 
185
185
  def exception_lines
186
- lines = []
187
- lines << "#{exception_class_name}:" unless exception_class_name =~ /RSpec/
188
- encoded_string(exception_message_string(exception)).split("\n").each do |line|
189
- lines << (line.empty? ? line : " #{line}")
186
+ @exception_lines ||= begin
187
+ lines = []
188
+ lines << "#{exception_class_name}:" unless exception_class_name =~ /RSpec/
189
+ encoded_string(exception_message_string(exception)).split("\n").each do |line|
190
+ lines << (line.empty? ? line : " #{line}")
191
+ end
192
+ lines
190
193
  end
191
- lines
192
194
  end
193
195
 
194
196
  def extra_failure_lines
@@ -37,7 +37,7 @@ module RSpec
37
37
  runner, options.args, formatter
38
38
  )
39
39
 
40
- success ? 0 : runner.configuration.failure_exit_code
40
+ runner.exit_code(success)
41
41
  end
42
42
 
43
43
  private
@@ -95,6 +95,11 @@ module RSpec::Core
95
95
  options[:failure_exit_code] = code
96
96
  end
97
97
 
98
+ parser.on('--error-exit-code CODE', Integer,
99
+ 'Override the exit code used when there are errors loading or running specs outside of examples.') do |code|
100
+ options[:error_exit_code] = code
101
+ end
102
+
98
103
  parser.on('-X', '--[no-]drb', 'Run examples via DRb.') do |use_drb|
99
104
  options[:drb] = use_drb
100
105
  options[:runner] = RSpec::Core::Invocations::DRbWithFallback.new if use_drb
@@ -84,7 +84,7 @@ module RSpec
84
84
  # @param out [IO] output stream
85
85
  def run(err, out)
86
86
  setup(err, out)
87
- return @configuration.reporter.exit_early(@configuration.failure_exit_code) if RSpec.world.wants_to_quit
87
+ return @configuration.reporter.exit_early(exit_code) if RSpec.world.wants_to_quit
88
88
 
89
89
  run_specs(@world.ordered_example_groups).tap do
90
90
  persist_example_statuses
@@ -112,7 +112,7 @@ module RSpec
112
112
  # failed.
113
113
  def run_specs(example_groups)
114
114
  examples_count = @world.example_count(example_groups)
115
- success = @configuration.reporter.report(examples_count) do |reporter|
115
+ examples_passed = @configuration.reporter.report(examples_count) do |reporter|
116
116
  @configuration.with_suite_hooks do
117
117
  if examples_count == 0 && @configuration.fail_if_no_examples
118
118
  return @configuration.failure_exit_code
@@ -120,9 +120,9 @@ module RSpec
120
120
 
121
121
  example_groups.map { |g| g.run(reporter) }.all?
122
122
  end
123
- end && !@world.non_example_failure
123
+ end
124
124
 
125
- success ? 0 : @configuration.failure_exit_code
125
+ exit_code(examples_passed)
126
126
  end
127
127
 
128
128
  # @private
@@ -186,6 +186,14 @@ module RSpec
186
186
  end
187
187
  end
188
188
 
189
+ # @private
190
+ def exit_code(examples_passed=false)
191
+ return @configuration.error_exit_code || @configuration.failure_exit_code if @world.non_example_failure
192
+ return @configuration.failure_exit_code unless examples_passed
193
+
194
+ 0
195
+ end
196
+
189
197
  private
190
198
 
191
199
  def persist_example_statuses
@@ -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.9.3'
6
+ STRING = '3.10.0'
7
7
  end
8
8
  end
9
9
  end
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.9.3
4
+ version: 3.10.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: 2020-09-30 00:00:00.000000000 Z
49
+ date: 2020-10-30 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.9.3
57
+ version: 3.10.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.9.3
64
+ version: 3.10.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.9.3/Changelog.md
270
+ changelog_uri: https://github.com/rspec/rspec-core/blob/v3.10.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
@@ -290,5 +290,5 @@ requirements: []
290
290
  rubygems_version: 3.1.3
291
291
  signing_key:
292
292
  specification_version: 4
293
- summary: rspec-core-3.9.3
293
+ summary: rspec-core-3.10.0
294
294
  test_files: []
metadata.gz.sig CHANGED
Binary file