rspec-core 3.9.2 → 3.10.2
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 +51 -0
- data/README.md +3 -3
- data/lib/rspec/core/bisect/fork_runner.rb +6 -3
- data/lib/rspec/core/bisect/utilities.rb +12 -1
- data/lib/rspec/core/configuration.rb +16 -7
- data/lib/rspec/core/drb.rb +7 -0
- data/lib/rspec/core/example.rb +11 -4
- data/lib/rspec/core/example_group.rb +4 -1
- data/lib/rspec/core/formatters/exception_presenter.rb +17 -7
- data/lib/rspec/core/formatters.rb +8 -2
- data/lib/rspec/core/hooks.rb +14 -9
- data/lib/rspec/core/invocations.rb +1 -1
- data/lib/rspec/core/option_parser.rb +8 -0
- data/lib/rspec/core/pending.rb +8 -16
- data/lib/rspec/core/project_initializer/spec/spec_helper.rb +2 -4
- data/lib/rspec/core/runner.rb +12 -4
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +10 -10
- 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: 4c462ef57abbfae97ff1b4fa21937c229704f11d76d98f9d364cac49845421ad
|
|
4
|
+
data.tar.gz: 96a6cff188d2268a7c3ee96a64d5d12bbc3fca390e821b1f155d7e963745ea79
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62f270716ca47f5ee3388a95f89d71d4b0e9bdf0fd1f7c6806332af2a9191028c6694b38e9792e8ad1c791fb277161b29ba4f92486303eaf6c2b986ae7616b3b
|
|
7
|
+
data.tar.gz: 5eaf0e7f745c9885d9fba59bf26303588632a4294ea004131bca55496121a60185154848492e5b31eafc9186f19c7903365da829fbcf8334f043ad707263076c
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/Changelog.md
CHANGED
|
@@ -1,3 +1,54 @@
|
|
|
1
|
+
### Development
|
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.10.2...3-10-maintenance)
|
|
3
|
+
|
|
4
|
+
### 3.10.2 / 2022-01-27
|
|
5
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.10.1...v3.10.2)
|
|
6
|
+
|
|
7
|
+
Bug fixes:
|
|
8
|
+
|
|
9
|
+
* Ensure bisect communication uses consistent encoding. (Mike Jarema, #2852)
|
|
10
|
+
* Fix exception presenter when the root cause exception has nil backtrace.
|
|
11
|
+
(Zinovyev Ivan, #2903)
|
|
12
|
+
* Fix `inspect` output of `RSpec::Core::Example::Procsy` to namespace correctly.
|
|
13
|
+
(Keiko Kaneko, #2915)
|
|
14
|
+
* Ensure formatters not exposing `#output` will not crash duplicate check.
|
|
15
|
+
(@niceking, #2916)
|
|
16
|
+
|
|
17
|
+
### 3.10.1 / 2020-12-27
|
|
18
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.10.0...v3.10.1)
|
|
19
|
+
|
|
20
|
+
Bug fixes:
|
|
21
|
+
|
|
22
|
+
* RSpec warning output was missing deprecations from Ruby, these are now included.
|
|
23
|
+
(Jon Rowe, #2811)
|
|
24
|
+
|
|
25
|
+
### 3.10.0 / 2020-10-30
|
|
26
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.9.3...v3.10.0)
|
|
27
|
+
|
|
28
|
+
Enhancements:
|
|
29
|
+
|
|
30
|
+
* Memoize `RSpec::Core::Formatters::ExceptionPresenter#exception_lines` to improve performance
|
|
31
|
+
with slow exception messages. (Maxime Lapointe, #2743)
|
|
32
|
+
* Add configuration for an error exit code (to disambiguate errored builds from failed builds
|
|
33
|
+
by exit status). (Dana Sherson, #2749)
|
|
34
|
+
|
|
35
|
+
### 3.9.3 / 2020-09-30
|
|
36
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.9.2...v3.9.3)
|
|
37
|
+
|
|
38
|
+
Bug Fixes:
|
|
39
|
+
|
|
40
|
+
* Declare `ruby2_keywords` on `method_missing` for other gems. (Jon Rowe, #2731)
|
|
41
|
+
* Ensure custom error codes are returned from bisect runs. (Jon Rowe, #2732)
|
|
42
|
+
* Ensure `RSpec::Core::Configuration` predicate config methods return booleans.
|
|
43
|
+
(Marc-André Lafortune, #2736)
|
|
44
|
+
* Prevent `rspec --bisect` from generating zombie processes while executing
|
|
45
|
+
bisect runs. (Benoit Tigeot, Jon Rowe, #2739)
|
|
46
|
+
* Predicates for pending examples, (in `RSpec::Core::Example`, `#pending?`, `#skipped?` and
|
|
47
|
+
`#pending_fixed?`) now return boolean values rather than truthy values.
|
|
48
|
+
(Marc-André Lafortune, #2756, #2758)
|
|
49
|
+
* Exceptions which have a message which cannot be cast to a string will no longer
|
|
50
|
+
cause a crash. (Jon Rowe, #2761)
|
|
51
|
+
|
|
1
52
|
### 3.9.2 / 2020-05-02
|
|
2
53
|
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.9.1...v3.9.2)
|
|
3
54
|
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# rspec-core [](https://github.com/rspec/rspec-core/actions) [](https://codeclimate.com/github/rspec/rspec-core)
|
|
2
2
|
|
|
3
3
|
rspec-core provides the structure for writing executable examples of how your
|
|
4
4
|
code should behave, and an `rspec` command with tools to constrain which
|
|
@@ -10,12 +10,12 @@ examples get run and tailor the output.
|
|
|
10
10
|
gem install rspec-core # for rspec-core only
|
|
11
11
|
rspec --help
|
|
12
12
|
|
|
13
|
-
Want to run against the `
|
|
13
|
+
Want to run against the `main` branch? You'll need to include the dependent
|
|
14
14
|
RSpec repos as well. Add the following to your `Gemfile`:
|
|
15
15
|
|
|
16
16
|
```ruby
|
|
17
17
|
%w[rspec rspec-core rspec-expectations rspec-mocks rspec-support].each do |lib|
|
|
18
|
-
gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => '
|
|
18
|
+
gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => 'main'
|
|
19
19
|
end
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -6,7 +6,7 @@ module RSpec
|
|
|
6
6
|
module Core
|
|
7
7
|
module Bisect
|
|
8
8
|
# A Bisect runner that runs requested subsets of the suite by forking
|
|
9
|
-
# sub-processes. The
|
|
9
|
+
# sub-processes. The main process bootstraps RSpec and the application
|
|
10
10
|
# environment (including preloading files specified via `--require`) so
|
|
11
11
|
# that the individual spec runs do not have to re-pay that cost. Each
|
|
12
12
|
# spec run happens in a forked process, ensuring that the spec files are
|
|
@@ -91,9 +91,12 @@ module RSpec
|
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def dispatch_specs(run_descriptor)
|
|
94
|
-
fork { run_specs(run_descriptor) }
|
|
94
|
+
pid = fork { run_specs(run_descriptor) }
|
|
95
95
|
# We don't use Process.waitpid here as it was causing bisects to
|
|
96
|
-
# block due to the file descriptor limit on OSX / Linux.
|
|
96
|
+
# block due to the file descriptor limit on OSX / Linux. We need
|
|
97
|
+
# to detach the process to avoid having zombie processes
|
|
98
|
+
# consuming slots in the kernel process table during bisect runs.
|
|
99
|
+
Process.detach(pid)
|
|
97
100
|
end
|
|
98
101
|
|
|
99
102
|
private
|
|
@@ -29,11 +29,22 @@ module RSpec
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
# Wraps a pipe to support sending objects between a child and
|
|
32
|
-
# parent process.
|
|
32
|
+
# parent process. Where supported, encoding is explicitly
|
|
33
|
+
# set to ensure binary data is able to pass from child to
|
|
34
|
+
# parent.
|
|
33
35
|
# @private
|
|
34
36
|
class Channel
|
|
37
|
+
if String.method_defined?(:encoding)
|
|
38
|
+
MARSHAL_DUMP_ENCODING = Marshal.dump("").encoding
|
|
39
|
+
end
|
|
40
|
+
|
|
35
41
|
def initialize
|
|
36
42
|
@read_io, @write_io = IO.pipe
|
|
43
|
+
|
|
44
|
+
if defined?(MARSHAL_DUMP_ENCODING) && IO.method_defined?(:set_encoding)
|
|
45
|
+
# Ensure the pipe can send any content produced by Marshal.dump
|
|
46
|
+
@write_io.set_encoding MARSHAL_DUMP_ENCODING
|
|
47
|
+
end
|
|
37
48
|
end
|
|
38
49
|
|
|
39
50
|
def send(message)
|
|
@@ -67,15 +67,17 @@ module RSpec
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
# @private
|
|
70
|
-
def self.
|
|
70
|
+
def self.define_alias(name, alias_name)
|
|
71
71
|
alias_method alias_name, name
|
|
72
72
|
alias_method "#{alias_name}=", "#{name}="
|
|
73
|
-
|
|
73
|
+
define_predicate alias_name
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
# @private
|
|
77
|
-
def self.
|
|
78
|
-
|
|
77
|
+
def self.define_predicate(name)
|
|
78
|
+
define_method "#{name}?" do
|
|
79
|
+
!!send(name)
|
|
80
|
+
end
|
|
79
81
|
end
|
|
80
82
|
|
|
81
83
|
# @private
|
|
@@ -88,7 +90,7 @@ module RSpec
|
|
|
88
90
|
add_read_only_setting name
|
|
89
91
|
|
|
90
92
|
Array(opts[:alias_with]).each do |alias_name|
|
|
91
|
-
|
|
93
|
+
define_alias(name, alias_name)
|
|
92
94
|
end
|
|
93
95
|
end
|
|
94
96
|
|
|
@@ -98,7 +100,7 @@ module RSpec
|
|
|
98
100
|
def self.add_read_only_setting(name, opts={})
|
|
99
101
|
raise "Use the instance add_setting method if you want to set a default" if opts.key?(:default)
|
|
100
102
|
define_reader name
|
|
101
|
-
|
|
103
|
+
define_predicate name
|
|
102
104
|
end
|
|
103
105
|
|
|
104
106
|
# @macro [attach] add_setting
|
|
@@ -240,6 +242,11 @@ module RSpec
|
|
|
240
242
|
# @return [Integer]
|
|
241
243
|
add_setting :failure_exit_code
|
|
242
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
|
+
|
|
243
250
|
# @macro add_setting
|
|
244
251
|
# Whether or not to fail when there are no RSpec examples (default: false).
|
|
245
252
|
# @return [Boolean]
|
|
@@ -312,7 +319,8 @@ module RSpec
|
|
|
312
319
|
# Report the times for the slowest examples (default: `false`).
|
|
313
320
|
# Use this to specify the number of examples to include in the profile.
|
|
314
321
|
# @return [Boolean]
|
|
315
|
-
|
|
322
|
+
attr_writer :profile_examples
|
|
323
|
+
define_predicate :profile_examples
|
|
316
324
|
|
|
317
325
|
# @macro add_setting
|
|
318
326
|
# Run all examples if none match the configured filters
|
|
@@ -520,6 +528,7 @@ module RSpec
|
|
|
520
528
|
@pattern = '**{,/*/**}/*_spec.rb'
|
|
521
529
|
@exclude_pattern = ''
|
|
522
530
|
@failure_exit_code = 1
|
|
531
|
+
@error_exit_code = nil # so it can be overridden by failure exit code
|
|
523
532
|
@fail_if_no_examples = false
|
|
524
533
|
@spec_files_loaded = false
|
|
525
534
|
|
data/lib/rspec/core/drb.rb
CHANGED
|
@@ -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
|
|
data/lib/rspec/core/example.rb
CHANGED
|
@@ -231,8 +231,13 @@ module RSpec
|
|
|
231
231
|
@example_group_class
|
|
232
232
|
end
|
|
233
233
|
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
def pending?
|
|
235
|
+
!!pending
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def skipped?
|
|
239
|
+
!!skip
|
|
240
|
+
end
|
|
236
241
|
|
|
237
242
|
# @api private
|
|
238
243
|
# instance_execs the block passed to the constructor in the context of
|
|
@@ -370,7 +375,7 @@ module RSpec
|
|
|
370
375
|
|
|
371
376
|
# @private
|
|
372
377
|
def inspect
|
|
373
|
-
@example.inspect.gsub('Example', '
|
|
378
|
+
@example.inspect.gsub('Example', 'Example::Procsy')
|
|
374
379
|
end
|
|
375
380
|
end
|
|
376
381
|
|
|
@@ -577,7 +582,9 @@ module RSpec
|
|
|
577
582
|
# this indicates whether or not it now passes.
|
|
578
583
|
attr_accessor :pending_fixed
|
|
579
584
|
|
|
580
|
-
|
|
585
|
+
def pending_fixed?
|
|
586
|
+
!!pending_fixed
|
|
587
|
+
end
|
|
581
588
|
|
|
582
589
|
# @return [Boolean] Indicates if the example was completely skipped
|
|
583
590
|
# (typically done via `:skip` metadata or the `skip` method). Skipped examples
|
|
@@ -701,6 +701,7 @@ module RSpec
|
|
|
701
701
|
end
|
|
702
702
|
end
|
|
703
703
|
|
|
704
|
+
# @private
|
|
704
705
|
def initialize(inspect_output=nil)
|
|
705
706
|
@__inspect_output = inspect_output || '(no description provided)'
|
|
706
707
|
super() # no args get passed
|
|
@@ -761,8 +762,9 @@ module RSpec
|
|
|
761
762
|
"on an example group (e.g. a `describe` or `context` block)."
|
|
762
763
|
end
|
|
763
764
|
|
|
764
|
-
super
|
|
765
|
+
super(name, *args)
|
|
765
766
|
end
|
|
767
|
+
ruby2_keywords :method_missing if respond_to?(:ruby2_keywords, true)
|
|
766
768
|
end
|
|
767
769
|
# rubocop:enable Metrics/ClassLength
|
|
768
770
|
|
|
@@ -781,6 +783,7 @@ module RSpec
|
|
|
781
783
|
# @return [String] the location where the shared example was included
|
|
782
784
|
attr_reader :inclusion_location
|
|
783
785
|
|
|
786
|
+
# @private
|
|
784
787
|
def initialize(shared_group_name, inclusion_location)
|
|
785
788
|
@shared_group_name = shared_group_name
|
|
786
789
|
@inclusion_location = inclusion_location
|
|
@@ -51,11 +51,11 @@ module RSpec
|
|
|
51
51
|
cause << '--- Caused by: ---'
|
|
52
52
|
cause << "#{exception_class_name(last_cause)}:" unless exception_class_name(last_cause) =~ /RSpec/
|
|
53
53
|
|
|
54
|
-
encoded_string(last_cause
|
|
54
|
+
encoded_string(exception_message_string(last_cause)).split("\n").each do |line|
|
|
55
55
|
cause << " #{line}"
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
unless last_cause.backtrace.empty?
|
|
58
|
+
unless last_cause.backtrace.nil? || last_cause.backtrace.empty?
|
|
59
59
|
cause << (" #{backtrace_formatter.format_backtrace(last_cause.backtrace, example.metadata).first}")
|
|
60
60
|
end
|
|
61
61
|
end
|
|
@@ -174,13 +174,23 @@ module RSpec
|
|
|
174
174
|
lines
|
|
175
175
|
end
|
|
176
176
|
|
|
177
|
+
# 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}."
|
|
182
|
+
end
|
|
183
|
+
# rubocop:enable Lint/RescueException
|
|
184
|
+
|
|
177
185
|
def exception_lines
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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
|
|
182
193
|
end
|
|
183
|
-
lines
|
|
184
194
|
end
|
|
185
195
|
|
|
186
196
|
def extra_failure_lines
|
|
@@ -79,7 +79,7 @@ module RSpec::Core::Formatters
|
|
|
79
79
|
|
|
80
80
|
# Register the formatter class
|
|
81
81
|
# @param formatter_class [Class] formatter class to register
|
|
82
|
-
# @param notifications [Symbol
|
|
82
|
+
# @param notifications [Array<Symbol>] one or more notifications to be
|
|
83
83
|
# registered to the specified formatter
|
|
84
84
|
#
|
|
85
85
|
# @see RSpec::Core::Formatters::BaseFormatter
|
|
@@ -194,10 +194,16 @@ module RSpec::Core::Formatters
|
|
|
194
194
|
|
|
195
195
|
def duplicate_formatter_exists?(new_formatter)
|
|
196
196
|
@formatters.any? do |formatter|
|
|
197
|
-
formatter.class == new_formatter.class &&
|
|
197
|
+
formatter.class == new_formatter.class &&
|
|
198
|
+
has_matching_output?(formatter, new_formatter)
|
|
198
199
|
end
|
|
199
200
|
end
|
|
200
201
|
|
|
202
|
+
def has_matching_output?(formatter, new_formatter)
|
|
203
|
+
return true unless formatter.respond_to?(:output) && new_formatter.respond_to?(:output)
|
|
204
|
+
formatter.output == new_formatter.output
|
|
205
|
+
end
|
|
206
|
+
|
|
201
207
|
def existing_formatter_implements?(notification)
|
|
202
208
|
@reporter.registered_listeners(notification).any?
|
|
203
209
|
end
|
data/lib/rspec/core/hooks.rb
CHANGED
|
@@ -60,9 +60,10 @@ module RSpec
|
|
|
60
60
|
# before(:example) # Declared in a parent group.
|
|
61
61
|
# before(:example) # Declared in the current group.
|
|
62
62
|
#
|
|
63
|
-
# If more than one `before` is declared within any one
|
|
64
|
-
# in the order in which they are declared. Any `around` hooks will
|
|
65
|
-
#
|
|
63
|
+
# If more than one `before` is declared within any one example group, they
|
|
64
|
+
# are run in the order in which they are declared. Any `around` hooks will
|
|
65
|
+
# execute after `before` context hooks but before any `before` example
|
|
66
|
+
# hook regardless of where they are declared.
|
|
66
67
|
#
|
|
67
68
|
# ### Conditions
|
|
68
69
|
#
|
|
@@ -263,9 +264,10 @@ module RSpec
|
|
|
263
264
|
# after(:suite) # Declared in RSpec.configure.
|
|
264
265
|
#
|
|
265
266
|
# This is the reverse of the order in which `before` hooks are run.
|
|
266
|
-
# Similarly, if more than one `after` is declared within any
|
|
267
|
-
# they are run in reverse order of that in which they are declared.
|
|
268
|
-
# `around` hooks will
|
|
267
|
+
# Similarly, if more than one `after` is declared within any example
|
|
268
|
+
# group, they are run in reverse order of that in which they are declared.
|
|
269
|
+
# Also `around` hooks will run after any `after` example hooks are
|
|
270
|
+
# invoked but before any `after` context hooks.
|
|
269
271
|
#
|
|
270
272
|
# @note The `:example` and `:context` scopes are also available as
|
|
271
273
|
# `:each` and `:all`, respectively. Use whichever you prefer.
|
|
@@ -310,7 +312,7 @@ module RSpec
|
|
|
310
312
|
#
|
|
311
313
|
# @note the syntax of `around` is similar to that of `before` and `after`
|
|
312
314
|
# but the semantics are quite different. `before` and `after` hooks are
|
|
313
|
-
# run in the context of
|
|
315
|
+
# run in the context of the examples with which they are associated,
|
|
314
316
|
# whereas `around` hooks are actually responsible for running the
|
|
315
317
|
# examples. Consequently, `around` hooks do not have direct access to
|
|
316
318
|
# resources that are made available within the examples and their
|
|
@@ -337,8 +339,11 @@ module RSpec
|
|
|
337
339
|
#
|
|
338
340
|
# ### Order
|
|
339
341
|
#
|
|
340
|
-
#
|
|
341
|
-
#
|
|
342
|
+
# The `around` hooks execute surrounding an example and its hooks.
|
|
343
|
+
#
|
|
344
|
+
# This means after any `before` context hooks, but before any `before`
|
|
345
|
+
# example hooks, and similarly after any `after` example hooks but before
|
|
346
|
+
# any `after` context hooks.
|
|
342
347
|
#
|
|
343
348
|
# They are not a synonym for `before`/`after`.
|
|
344
349
|
def around(*args, &block)
|
|
@@ -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
|
|
@@ -179,6 +184,9 @@ module RSpec::Core
|
|
|
179
184
|
end
|
|
180
185
|
|
|
181
186
|
parser.on('-w', '--warnings', 'Enable ruby warnings') do
|
|
187
|
+
if Object.const_defined?(:Warning) && Warning.respond_to?(:[]=)
|
|
188
|
+
Warning[:deprecated] = true
|
|
189
|
+
end
|
|
182
190
|
$VERBOSE = true
|
|
183
191
|
end
|
|
184
192
|
|
data/lib/rspec/core/pending.rb
CHANGED
|
@@ -38,7 +38,7 @@ module RSpec
|
|
|
38
38
|
# @param message [String] optional message to add to the summary report.
|
|
39
39
|
#
|
|
40
40
|
# @example
|
|
41
|
-
# describe "
|
|
41
|
+
# describe "some behaviour" do
|
|
42
42
|
# # reported as "Pending: no reason given"
|
|
43
43
|
# it "is pending with no message" do
|
|
44
44
|
# pending
|
|
@@ -52,21 +52,13 @@ module RSpec
|
|
|
52
52
|
# end
|
|
53
53
|
# end
|
|
54
54
|
#
|
|
55
|
-
# @note `
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
-
#
|
|
61
|
-
#
|
|
62
|
-
# end
|
|
63
|
-
#
|
|
64
|
-
# or pass `:pending => "something else getting finished"` to add a
|
|
65
|
-
# message to the summary report:
|
|
66
|
-
#
|
|
67
|
-
# it "does something", :pending => "something else getting finished" do
|
|
68
|
-
# # ...
|
|
69
|
-
# end
|
|
55
|
+
# @note When using `pending` inside an example body using this method
|
|
56
|
+
# hooks, such as `before(:example)`, have already be run. This means that
|
|
57
|
+
# a failure from the code in the `before` hook will prevent the example
|
|
58
|
+
# from being considered pending, as the example body would not be
|
|
59
|
+
# executed. If you need to consider hooks as pending as well you can use
|
|
60
|
+
# the pending metadata as an alternative, e.g.
|
|
61
|
+
# `it "does something", pending: "message"`.
|
|
70
62
|
def pending(message=nil)
|
|
71
63
|
current_example = RSpec.current_example
|
|
72
64
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# the additional setup, and require it from the spec files that actually need
|
|
13
13
|
# it.
|
|
14
14
|
#
|
|
15
|
-
# See
|
|
15
|
+
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
16
16
|
RSpec.configure do |config|
|
|
17
17
|
# rspec-expectations config goes here. You can use an alternate
|
|
18
18
|
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
@@ -61,9 +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
|
-
#
|
|
65
|
-
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
|
66
|
-
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
|
64
|
+
# https://relishapp.com/rspec/rspec-core/docs/configuration/zero-monkey-patching-mode
|
|
67
65
|
config.disable_monkey_patching!
|
|
68
66
|
|
|
69
67
|
# This setting enables warnings. It's recommended, but in some cases may
|
data/lib/rspec/core/runner.rb
CHANGED
|
@@ -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(
|
|
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
|
-
|
|
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
|
|
123
|
+
end
|
|
124
124
|
|
|
125
|
-
|
|
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
|
data/lib/rspec/core/version.rb
CHANGED
data/lib/rspec/core/world.rb
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.10.2
|
|
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:
|
|
11
|
+
autorequire:
|
|
12
12
|
bindir: exe
|
|
13
13
|
cert_chain:
|
|
14
14
|
- |
|
|
@@ -46,7 +46,7 @@ cert_chain:
|
|
|
46
46
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
|
47
47
|
F3MdtaDehhjC
|
|
48
48
|
-----END CERTIFICATE-----
|
|
49
|
-
date:
|
|
49
|
+
date: 2022-01-27 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.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.
|
|
64
|
+
version: 3.10.0
|
|
65
65
|
- !ruby/object:Gem::Dependency
|
|
66
66
|
name: cucumber
|
|
67
67
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -267,11 +267,11 @@ 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.10.2/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
|
|
274
|
-
post_install_message:
|
|
274
|
+
post_install_message:
|
|
275
275
|
rdoc_options:
|
|
276
276
|
- "--charset=UTF-8"
|
|
277
277
|
require_paths:
|
|
@@ -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.
|
|
291
|
-
signing_key:
|
|
290
|
+
rubygems_version: 3.3.3
|
|
291
|
+
signing_key:
|
|
292
292
|
specification_version: 4
|
|
293
|
-
summary: rspec-core-3.
|
|
293
|
+
summary: rspec-core-3.10.2
|
|
294
294
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|