rspec-core 3.8.0 → 3.12.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.
Files changed (41) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data/Changelog.md +154 -0
  4. data/README.md +20 -20
  5. data/lib/rspec/core/bisect/fork_runner.rb +6 -2
  6. data/lib/rspec/core/bisect/server.rb +1 -1
  7. data/lib/rspec/core/bisect/utilities.rb +12 -1
  8. data/lib/rspec/core/configuration.rb +126 -30
  9. data/lib/rspec/core/did_you_mean.rb +46 -0
  10. data/lib/rspec/core/drb.rb +7 -0
  11. data/lib/rspec/core/example.rb +18 -5
  12. data/lib/rspec/core/example_group.rb +36 -16
  13. data/lib/rspec/core/example_status_persister.rb +2 -2
  14. data/lib/rspec/core/filter_manager.rb +1 -1
  15. data/lib/rspec/core/formatters/console_codes.rb +17 -9
  16. data/lib/rspec/core/formatters/documentation_formatter.rb +35 -3
  17. data/lib/rspec/core/formatters/exception_presenter.rb +40 -12
  18. data/lib/rspec/core/formatters/failure_list_formatter.rb +23 -0
  19. data/lib/rspec/core/formatters/helpers.rb +9 -1
  20. data/lib/rspec/core/formatters/html_printer.rb +1 -3
  21. data/lib/rspec/core/formatters/html_snippet_extractor.rb +2 -2
  22. data/lib/rspec/core/formatters.rb +12 -2
  23. data/lib/rspec/core/hooks.rb +43 -21
  24. data/lib/rspec/core/invocations.rb +1 -1
  25. data/lib/rspec/core/memoized_helpers.rb +60 -15
  26. data/lib/rspec/core/metadata.rb +2 -3
  27. data/lib/rspec/core/metadata_filter.rb +1 -1
  28. data/lib/rspec/core/option_parser.rb +27 -13
  29. data/lib/rspec/core/ordering.rb +12 -1
  30. data/lib/rspec/core/pending.rb +8 -16
  31. data/lib/rspec/core/project_initializer/spec/spec_helper.rb +2 -4
  32. data/lib/rspec/core/rake_task.rb +22 -2
  33. data/lib/rspec/core/reporter.rb +9 -1
  34. data/lib/rspec/core/runner.rb +16 -3
  35. data/lib/rspec/core/shared_example_group.rb +4 -2
  36. data/lib/rspec/core/version.rb +1 -1
  37. data/lib/rspec/core/world.rb +17 -5
  38. data/lib/rspec/core.rb +27 -0
  39. data.tar.gz.sig +0 -0
  40. metadata +21 -15
  41. metadata.gz.sig +0 -0
@@ -84,6 +84,8 @@ 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(exit_code) if RSpec.world.wants_to_quit
88
+
87
89
  run_specs(@world.ordered_example_groups).tap do
88
90
  persist_example_statuses
89
91
  end
@@ -95,7 +97,10 @@ module RSpec
95
97
  # @param out [IO] output stream
96
98
  def setup(err, out)
97
99
  configure(err, out)
100
+ return if RSpec.world.wants_to_quit
101
+
98
102
  @configuration.load_spec_files
103
+ ensure
99
104
  @world.announce_filters
100
105
  end
101
106
 
@@ -107,7 +112,7 @@ module RSpec
107
112
  # failed.
108
113
  def run_specs(example_groups)
109
114
  examples_count = @world.example_count(example_groups)
110
- success = @configuration.reporter.report(examples_count) do |reporter|
115
+ examples_passed = @configuration.reporter.report(examples_count) do |reporter|
111
116
  @configuration.with_suite_hooks do
112
117
  if examples_count == 0 && @configuration.fail_if_no_examples
113
118
  return @configuration.failure_exit_code
@@ -115,9 +120,9 @@ module RSpec
115
120
 
116
121
  example_groups.map { |g| g.run(reporter) }.all?
117
122
  end
118
- end && !@world.non_example_failure
123
+ end
119
124
 
120
- success ? 0 : @configuration.failure_exit_code
125
+ exit_code(examples_passed)
121
126
  end
122
127
 
123
128
  # @private
@@ -181,6 +186,14 @@ module RSpec
181
186
  end
182
187
  end
183
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
+
184
197
  private
185
198
 
186
199
  def persist_example_statuses
@@ -1,3 +1,5 @@
1
+ RSpec::Support.require_rspec_support "with_keywords_when_needed"
2
+
1
3
  module RSpec
2
4
  module Core
3
5
  # Represents some functionality that is shared with multiple example groups.
@@ -33,7 +35,7 @@ module RSpec
33
35
  klass.update_inherited_metadata(@metadata) unless @metadata.empty?
34
36
 
35
37
  SharedExampleGroupInclusionStackFrame.with_frame(@description, inclusion_line) do
36
- klass.class_exec(*args, &@definition)
38
+ RSpec::Support::WithKeywordsWhenNeeded.class_exec(klass, *args, &@definition)
37
39
  klass.class_exec(&customization_block) if customization_block
38
40
  end
39
41
  end
@@ -76,7 +78,7 @@ module RSpec
76
78
  # end
77
79
  # end
78
80
  #
79
- # describe Account do
81
+ # RSpec.describe Account do
80
82
  # it_behaves_like "auditable" do
81
83
  # let(:auditable) { Account.new }
82
84
  # end
@@ -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.8.0'
6
+ STRING = '3.12.2'
7
7
  end
8
8
  end
9
9
  end
@@ -5,11 +5,18 @@ module RSpec
5
5
  # Internal container for global non-configuration data.
6
6
  class World
7
7
  # @private
8
- attr_reader :example_groups, :filtered_examples
8
+ attr_reader :example_groups, :filtered_examples, :example_group_counts_by_spec_file
9
9
 
10
10
  # Used internally to determine what to do when a SIGINT is received.
11
11
  attr_accessor :wants_to_quit
12
12
 
13
+ # Used internally to signify that a SystemExit occurred in
14
+ # `Configuration#load_file_handling_errors`, and thus examples cannot
15
+ # be counted accurately. Specifically, we cannot accurately report
16
+ # "No examples found".
17
+ # @private
18
+ attr_accessor :rspec_is_quitting
19
+
13
20
  # Used internally to signal that a failure outside of an example
14
21
  # has occurred, and that therefore the exit status should indicate
15
22
  # the run failed.
@@ -17,6 +24,8 @@ module RSpec
17
24
  attr_accessor :non_example_failure
18
25
 
19
26
  def initialize(configuration=RSpec.configuration)
27
+ @wants_to_quit = false
28
+ @rspec_is_quitting = false
20
29
  @configuration = configuration
21
30
  configuration.world = self
22
31
  @example_groups = []
@@ -53,6 +62,7 @@ module RSpec
53
62
  example_groups.clear
54
63
  @sources_by_path.clear if defined?(@sources_by_path)
55
64
  @syntax_highlighter = nil
65
+ @example_group_counts_by_spec_file = Hash.new(0)
56
66
  end
57
67
 
58
68
  # @private
@@ -182,10 +192,12 @@ module RSpec
182
192
  return unless example_count.zero?
183
193
 
184
194
  example_groups.clear
185
- if filter_manager.empty?
186
- report_filter_message("No examples found.")
187
- elsif exclusion_filter.empty? || inclusion_filter.empty?
188
- report_filter_message(everything_filtered_message)
195
+ unless rspec_is_quitting
196
+ if filter_manager.empty?
197
+ report_filter_message("No examples found.")
198
+ elsif exclusion_filter.empty? || inclusion_filter.empty?
199
+ report_filter_message(everything_filtered_message)
200
+ end
189
201
  end
190
202
  end
191
203
 
data/lib/rspec/core.rb CHANGED
@@ -129,6 +129,32 @@ module RSpec
129
129
  RSpec::Support.thread_local_data[:current_example] = example
130
130
  end
131
131
 
132
+ # Set the current scope rspec is executing in
133
+ # @api private
134
+ def self.current_scope=(scope)
135
+ RSpec::Support.thread_local_data[:current_scope] = scope
136
+ end
137
+ RSpec.current_scope = :suite
138
+
139
+ # Get the current RSpec execution scope
140
+ #
141
+ # Returns (in order of lifecycle):
142
+ # * `:suite` as an initial value, this is outside of the test lifecycle.
143
+ # * `:before_suite_hook` during `before(:suite)` hooks.
144
+ # * `:before_context_hook` during `before(:context)` hooks.
145
+ # * `:before_example_hook` during `before(:example)` hooks and `around(:example)` before `example.run`.
146
+ # * `:example` within the example run.
147
+ # * `:after_example_hook` during `after(:example)` hooks and `around(:example)` after `example.run`.
148
+ # * `:after_context_hook` during `after(:context)` hooks.
149
+ # * `:after_suite_hook` during `after(:suite)` hooks.
150
+ # * `:suite` as a final value, again this is outside of the test lifecycle.
151
+ #
152
+ # Reminder, `:context` hooks have `:all` alias and `:example` hooks have `:each` alias.
153
+ # @return [Symbol]
154
+ def self.current_scope
155
+ RSpec::Support.thread_local_data[:current_scope]
156
+ end
157
+
132
158
  # @private
133
159
  # Internal container for global non-configuration data.
134
160
  def self.world
@@ -139,6 +165,7 @@ module RSpec
139
165
  module Core
140
166
  autoload :ExampleStatusPersister, "rspec/core/example_status_persister"
141
167
  autoload :Profiler, "rspec/core/profiler"
168
+ autoload :DidYouMean, "rspec/core/did_you_mean"
142
169
 
143
170
  # @private
144
171
  # This avoids issues with reporting time caused by examples that
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.8.0
4
+ version: 3.12.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: 2018-08-04 00:00:00.000000000 Z
49
+ date: 2023-04-18 00:00:00.000000000 Z
50
50
  dependencies:
51
51
  - !ruby/object:Gem::Dependency
52
52
  name: rspec-support
@@ -54,26 +54,26 @@ dependencies:
54
54
  requirements:
55
55
  - - "~>"
56
56
  - !ruby/object:Gem::Version
57
- version: 3.8.0
57
+ version: 3.12.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.8.0
64
+ version: 3.12.0
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: cucumber
67
67
  requirement: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - "~>"
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
71
  version: '1.3'
72
72
  type: :development
73
73
  prerelease: false
74
74
  version_requirements: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - "~>"
76
+ - - ">="
77
77
  - !ruby/object:Gem::Version
78
78
  version: '1.3'
79
79
  - !ruby/object:Gem::Dependency
@@ -96,14 +96,14 @@ dependencies:
96
96
  requirements:
97
97
  - - "~>"
98
98
  - !ruby/object:Gem::Version
99
- version: 0.6.2
99
+ version: 0.14.9
100
100
  type: :development
101
101
  prerelease: false
102
102
  version_requirements: !ruby/object:Gem::Requirement
103
103
  requirements:
104
104
  - - "~>"
105
105
  - !ruby/object:Gem::Version
106
- version: 0.6.2
106
+ version: 0.14.9
107
107
  - !ruby/object:Gem::Dependency
108
108
  name: coderay
109
109
  requirement: !ruby/object:Gem::Requirement
@@ -199,6 +199,7 @@ files:
199
199
  - lib/rspec/core/bisect/utilities.rb
200
200
  - lib/rspec/core/configuration.rb
201
201
  - lib/rspec/core/configuration_options.rb
202
+ - lib/rspec/core/did_you_mean.rb
202
203
  - lib/rspec/core/drb.rb
203
204
  - lib/rspec/core/dsl.rb
204
205
  - lib/rspec/core/example.rb
@@ -216,6 +217,7 @@ files:
216
217
  - lib/rspec/core/formatters/deprecation_formatter.rb
217
218
  - lib/rspec/core/formatters/documentation_formatter.rb
218
219
  - lib/rspec/core/formatters/exception_presenter.rb
220
+ - lib/rspec/core/formatters/failure_list_formatter.rb
219
221
  - lib/rspec/core/formatters/fallback_message_formatter.rb
220
222
  - lib/rspec/core/formatters/helpers.rb
221
223
  - lib/rspec/core/formatters/html_formatter.rb
@@ -263,8 +265,13 @@ files:
263
265
  homepage: https://github.com/rspec/rspec-core
264
266
  licenses:
265
267
  - MIT
266
- metadata: {}
267
- post_install_message:
268
+ metadata:
269
+ 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
271
+ documentation_uri: https://rspec.info/documentation/
272
+ mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
273
+ source_code_uri: https://github.com/rspec/rspec-core
274
+ post_install_message:
268
275
  rdoc_options:
269
276
  - "--charset=UTF-8"
270
277
  require_paths:
@@ -280,9 +287,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
287
  - !ruby/object:Gem::Version
281
288
  version: '0'
282
289
  requirements: []
283
- rubyforge_project:
284
- rubygems_version: 2.6.13
285
- signing_key:
290
+ rubygems_version: 3.4.10
291
+ signing_key:
286
292
  specification_version: 4
287
- summary: rspec-core-3.8.0
293
+ summary: rspec-core-3.12.2
288
294
  test_files: []
metadata.gz.sig CHANGED
Binary file