rspec-core 3.0.4 → 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 (85) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data/.document +1 -1
  4. data/.yardopts +2 -1
  5. data/Changelog.md +888 -2
  6. data/{License.txt → LICENSE.md} +6 -5
  7. data/README.md +165 -24
  8. data/lib/rspec/autorun.rb +1 -0
  9. data/lib/rspec/core/backtrace_formatter.rb +19 -20
  10. data/lib/rspec/core/bisect/coordinator.rb +62 -0
  11. data/lib/rspec/core/bisect/example_minimizer.rb +173 -0
  12. data/lib/rspec/core/bisect/fork_runner.rb +138 -0
  13. data/lib/rspec/core/bisect/server.rb +61 -0
  14. data/lib/rspec/core/bisect/shell_command.rb +126 -0
  15. data/lib/rspec/core/bisect/shell_runner.rb +73 -0
  16. data/lib/rspec/core/bisect/utilities.rb +69 -0
  17. data/lib/rspec/core/configuration.rb +1287 -246
  18. data/lib/rspec/core/configuration_options.rb +95 -35
  19. data/lib/rspec/core/did_you_mean.rb +46 -0
  20. data/lib/rspec/core/drb.rb +21 -12
  21. data/lib/rspec/core/dsl.rb +10 -6
  22. data/lib/rspec/core/example.rb +305 -113
  23. data/lib/rspec/core/example_group.rb +431 -223
  24. data/lib/rspec/core/example_status_persister.rb +235 -0
  25. data/lib/rspec/core/filter_manager.rb +86 -115
  26. data/lib/rspec/core/flat_map.rb +6 -4
  27. data/lib/rspec/core/formatters/base_bisect_formatter.rb +45 -0
  28. data/lib/rspec/core/formatters/base_formatter.rb +14 -116
  29. data/lib/rspec/core/formatters/base_text_formatter.rb +18 -21
  30. data/lib/rspec/core/formatters/bisect_drb_formatter.rb +29 -0
  31. data/lib/rspec/core/formatters/bisect_progress_formatter.rb +157 -0
  32. data/lib/rspec/core/formatters/console_codes.rb +29 -18
  33. data/lib/rspec/core/formatters/deprecation_formatter.rb +16 -16
  34. data/lib/rspec/core/formatters/documentation_formatter.rb +49 -16
  35. data/lib/rspec/core/formatters/exception_presenter.rb +525 -0
  36. data/lib/rspec/core/formatters/failure_list_formatter.rb +23 -0
  37. data/lib/rspec/core/formatters/fallback_message_formatter.rb +28 -0
  38. data/lib/rspec/core/formatters/helpers.rb +45 -15
  39. data/lib/rspec/core/formatters/html_formatter.rb +33 -28
  40. data/lib/rspec/core/formatters/html_printer.rb +30 -20
  41. data/lib/rspec/core/formatters/html_snippet_extractor.rb +120 -0
  42. data/lib/rspec/core/formatters/json_formatter.rb +18 -9
  43. data/lib/rspec/core/formatters/profile_formatter.rb +10 -9
  44. data/lib/rspec/core/formatters/progress_formatter.rb +5 -4
  45. data/lib/rspec/core/formatters/protocol.rb +182 -0
  46. data/lib/rspec/core/formatters/snippet_extractor.rb +113 -82
  47. data/lib/rspec/core/formatters/syntax_highlighter.rb +91 -0
  48. data/lib/rspec/core/formatters.rb +81 -41
  49. data/lib/rspec/core/hooks.rb +314 -244
  50. data/lib/rspec/core/invocations.rb +87 -0
  51. data/lib/rspec/core/memoized_helpers.rb +161 -51
  52. data/lib/rspec/core/metadata.rb +132 -61
  53. data/lib/rspec/core/metadata_filter.rb +224 -64
  54. data/lib/rspec/core/minitest_assertions_adapter.rb +6 -3
  55. data/lib/rspec/core/mocking_adapters/flexmock.rb +4 -2
  56. data/lib/rspec/core/mocking_adapters/mocha.rb +11 -9
  57. data/lib/rspec/core/mocking_adapters/null.rb +2 -0
  58. data/lib/rspec/core/mocking_adapters/rr.rb +3 -1
  59. data/lib/rspec/core/mocking_adapters/rspec.rb +3 -1
  60. data/lib/rspec/core/notifications.rb +192 -206
  61. data/lib/rspec/core/option_parser.rb +174 -69
  62. data/lib/rspec/core/ordering.rb +48 -35
  63. data/lib/rspec/core/output_wrapper.rb +29 -0
  64. data/lib/rspec/core/pending.rb +25 -33
  65. data/lib/rspec/core/profiler.rb +34 -0
  66. data/lib/rspec/core/project_initializer/.rspec +0 -2
  67. data/lib/rspec/core/project_initializer/spec/spec_helper.rb +59 -39
  68. data/lib/rspec/core/project_initializer.rb +5 -3
  69. data/lib/rspec/core/rake_task.rb +99 -55
  70. data/lib/rspec/core/reporter.rb +128 -15
  71. data/lib/rspec/core/ruby_project.rb +14 -6
  72. data/lib/rspec/core/runner.rb +96 -45
  73. data/lib/rspec/core/sandbox.rb +37 -0
  74. data/lib/rspec/core/set.rb +54 -0
  75. data/lib/rspec/core/shared_example_group.rb +133 -43
  76. data/lib/rspec/core/shell_escape.rb +49 -0
  77. data/lib/rspec/core/test_unit_assertions_adapter.rb +4 -4
  78. data/lib/rspec/core/version.rb +1 -1
  79. data/lib/rspec/core/warnings.rb +6 -6
  80. data/lib/rspec/core/world.rb +172 -68
  81. data/lib/rspec/core.rb +66 -21
  82. data.tar.gz.sig +0 -0
  83. metadata +93 -69
  84. metadata.gz.sig +0 -0
  85. data/lib/rspec/core/backport_random.rb +0 -336
@@ -6,8 +6,8 @@ module RSpec
6
6
  module Warnings
7
7
  # @private
8
8
  #
9
- # Used internally to print deprecation warnings
10
- def deprecate(deprecated, data = {})
9
+ # Used internally to print deprecation warnings.
10
+ def deprecate(deprecated, data={})
11
11
  RSpec.configuration.reporter.deprecation(
12
12
  {
13
13
  :deprecated => deprecated,
@@ -18,13 +18,13 @@ module RSpec
18
18
 
19
19
  # @private
20
20
  #
21
- # Used internally to print deprecation warnings
22
- def warn_deprecation(message, opts = {})
23
- RSpec.configuration.reporter.deprecation opts.merge( :message => message )
21
+ # Used internally to print deprecation warnings.
22
+ def warn_deprecation(message, opts={})
23
+ RSpec.configuration.reporter.deprecation opts.merge(:message => message)
24
24
  end
25
25
 
26
26
  # @private
27
- def warn_with(message, options = {})
27
+ def warn_with(message, options={})
28
28
  if options[:use_spec_location_as_call_site]
29
29
  message += "." unless message.end_with?(".")
30
30
 
@@ -2,44 +2,53 @@ module RSpec
2
2
  module Core
3
3
  # @api private
4
4
  #
5
- # Internal container for global non-configuration data
5
+ # Internal container for global non-configuration data.
6
6
  class World
7
+ # @private
8
+ attr_reader :example_groups, :filtered_examples, :example_group_counts_by_spec_file
7
9
 
8
- include RSpec::Core::Hooks
10
+ # Used internally to determine what to do when a SIGINT is received.
11
+ attr_accessor :wants_to_quit
9
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".
10
17
  # @private
11
- attr_reader :example_groups, :filtered_examples
18
+ attr_accessor :rspec_is_quitting
12
19
 
13
- # Used internally to determine what to do when a SIGINT is received
14
- attr_accessor :wants_to_quit
20
+ # Used internally to signal that a failure outside of an example
21
+ # has occurred, and that therefore the exit status should indicate
22
+ # the run failed.
23
+ # @private
24
+ attr_accessor :non_example_failure
15
25
 
16
26
  def initialize(configuration=RSpec.configuration)
27
+ @wants_to_quit = false
28
+ @rspec_is_quitting = false
17
29
  @configuration = configuration
30
+ configuration.world = self
18
31
  @example_groups = []
19
- @filtered_examples = Hash.new { |hash,group|
20
- hash[group] = begin
21
- examples = group.examples.dup
22
- examples = filter_manager.prune(examples)
23
- examples.uniq!
24
- examples
25
- end
26
- }
27
- end
28
-
29
- # @private
30
- # Used internally to clear remaining groups when fail_fast is set
31
- def clear_remaining_example_groups
32
- example_groups.clear
32
+ @example_group_counts_by_spec_file = Hash.new(0)
33
+ prepare_example_filtering
33
34
  end
34
35
 
35
- # @private
36
- def windows_os?
37
- RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/
36
+ # @api public
37
+ #
38
+ # Prepares filters so that they apply to example groups when they run.
39
+ #
40
+ # This is a separate method so that filters can be modified/replaced and
41
+ # examples refiltered during a process's lifetime, which can be useful for
42
+ # a custom runner.
43
+ def prepare_example_filtering
44
+ @filtered_examples = Hash.new do |hash, group|
45
+ hash[group] = filter_manager.prune(group.examples)
46
+ end
38
47
  end
39
48
 
40
49
  # @api private
41
50
  #
42
- # Apply ordering strategy from configuration to example groups
51
+ # Apply ordering strategy from configuration to example groups.
43
52
  def ordered_example_groups
44
53
  ordering_strategy = @configuration.ordering_registry.fetch(:global)
45
54
  ordering_strategy.order(@example_groups)
@@ -47,10 +56,13 @@ module RSpec
47
56
 
48
57
  # @api private
49
58
  #
50
- # Reset world to 'scratch' before running suite
59
+ # Reset world to 'scratch' before running suite.
51
60
  def reset
61
+ RSpec::ExampleGroups.remove_all_constants
52
62
  example_groups.clear
53
- @shared_example_group_registry = nil
63
+ @sources_by_path.clear if defined?(@sources_by_path)
64
+ @syntax_highlighter = nil
65
+ @example_group_counts_by_spec_file = Hash.new(0)
54
66
  end
55
67
 
56
68
  # @private
@@ -58,12 +70,22 @@ module RSpec
58
70
  @configuration.filter_manager
59
71
  end
60
72
 
73
+ # @private
74
+ def registered_example_group_files
75
+ @example_group_counts_by_spec_file.keys
76
+ end
77
+
61
78
  # @api private
62
79
  #
63
- # Register an example group
64
- def register(example_group)
65
- example_groups << example_group
66
- example_group
80
+ # Records an example group.
81
+ def record(example_group)
82
+ @configuration.on_example_group_definition_callbacks.each { |block| block.call(example_group) }
83
+ @example_group_counts_by_spec_file[example_group.metadata[:absolute_file_path]] += 1
84
+ end
85
+
86
+ # @private
87
+ def num_example_groups_defined_in(file)
88
+ @example_group_counts_by_spec_file[file]
67
89
  end
68
90
 
69
91
  # @private
@@ -81,26 +103,46 @@ module RSpec
81
103
  @configuration.exclusion_filter
82
104
  end
83
105
 
84
- # @private
85
- def configure_group(group)
86
- @configuration.configure_group(group)
87
- end
88
-
89
106
  # @api private
90
107
  #
91
- # Get count of examples to be run
108
+ # Get count of examples to be run.
92
109
  def example_count(groups=example_groups)
93
- FlatMap.flat_map(groups) {|g| g.descendants}.
94
- inject(0) {|sum, g| sum + g.filtered_examples.size}
110
+ FlatMap.flat_map(groups) { |g| g.descendants }.
111
+ inject(0) { |a, e| a + e.filtered_examples.size }
112
+ end
113
+
114
+ # @private
115
+ def all_example_groups
116
+ FlatMap.flat_map(example_groups) { |g| g.descendants }
117
+ end
118
+
119
+ # @private
120
+ def all_examples
121
+ FlatMap.flat_map(all_example_groups) { |g| g.examples }
122
+ end
123
+
124
+ # @private
125
+ # Traverses the tree of each top level group.
126
+ # For each it yields the group, then the children, recursively.
127
+ # Halts the traversal of a branch of the tree as soon as the passed block returns true.
128
+ # Note that siblings groups and their sub-trees will continue to be explored.
129
+ # This is intended to make it easy to find the top-most group that satisfies some
130
+ # condition.
131
+ def traverse_example_group_trees_until(&block)
132
+ example_groups.each do |group|
133
+ group.traverse_tree_until(&block)
134
+ end
95
135
  end
96
136
 
97
137
  # @api private
98
138
  #
99
- # Find line number of previous declaration
100
- def preceding_declaration_line(filter_line)
101
- declaration_line_numbers.sort.inject(nil) do |highest_prior_declaration_line, line|
102
- line <= filter_line ? line : highest_prior_declaration_line
139
+ # Find line number of previous declaration.
140
+ def preceding_declaration_line(absolute_file_name, filter_line)
141
+ line_numbers = descending_declaration_line_numbers_by_file.fetch(absolute_file_name) do
142
+ return nil
103
143
  end
144
+
145
+ line_numbers.find { |num| num <= filter_line }
104
146
  end
105
147
 
106
148
  # @private
@@ -108,10 +150,26 @@ module RSpec
108
150
  @configuration.reporter
109
151
  end
110
152
 
153
+ # @private
154
+ def source_from_file(path)
155
+ unless defined?(@sources_by_path)
156
+ RSpec::Support.require_rspec_support 'source'
157
+ @sources_by_path = {}
158
+ end
159
+
160
+ @sources_by_path[path] ||= Support::Source.from_file(path)
161
+ end
162
+
163
+ # @private
164
+ def syntax_highlighter
165
+ @syntax_highlighter ||= Formatters::SyntaxHighlighter.new(@configuration)
166
+ end
167
+
111
168
  # @api private
112
169
  #
113
- # Notify reporter of filters
170
+ # Notify reporter of filters.
114
171
  def announce_filters
172
+ fail_if_config_and_cli_options_invalid
115
173
  filter_announcements = []
116
174
 
117
175
  announce_inclusion_filter filter_announcements
@@ -119,34 +177,35 @@ module RSpec
119
177
 
120
178
  unless filter_manager.empty?
121
179
  if filter_announcements.length == 1
122
- reporter.message("Run options: #{filter_announcements[0]}")
180
+ report_filter_message("Run options: #{filter_announcements[0]}")
123
181
  else
124
- reporter.message("Run options:\n #{filter_announcements.join("\n ")}")
182
+ report_filter_message("Run options:\n #{filter_announcements.join("\n ")}")
125
183
  end
126
184
  end
127
185
 
128
- if @configuration.run_all_when_everything_filtered? && example_count.zero?
129
- reporter.message("#{everything_filtered_message}; ignoring #{inclusion_filter.description}")
186
+ if @configuration.run_all_when_everything_filtered? && example_count.zero? && !@configuration.only_failures?
187
+ report_filter_message("#{everything_filtered_message}; ignoring #{inclusion_filter.description}")
130
188
  filtered_examples.clear
131
189
  inclusion_filter.clear
132
190
  end
133
191
 
134
- if example_count.zero?
135
- example_groups.clear
192
+ return unless example_count.zero?
193
+
194
+ example_groups.clear
195
+ unless rspec_is_quitting
136
196
  if filter_manager.empty?
137
- reporter.message("No examples found.")
138
- elsif exclusion_filter.empty?
139
- message = everything_filtered_message
140
- if @configuration.run_all_when_everything_filtered?
141
- message << "; ignoring #{inclusion_filter.description}"
142
- end
143
- reporter.message(message)
144
- elsif inclusion_filter.empty?
145
- reporter.message(everything_filtered_message)
197
+ report_filter_message("No examples found.")
198
+ elsif exclusion_filter.empty? || inclusion_filter.empty?
199
+ report_filter_message(everything_filtered_message)
146
200
  end
147
201
  end
148
202
  end
149
203
 
204
+ # @private
205
+ def report_filter_message(message)
206
+ reporter.message(message) unless @configuration.silence_filter_announcements?
207
+ end
208
+
150
209
  # @private
151
210
  def everything_filtered_message
152
211
  "\nAll examples were filtered out"
@@ -154,30 +213,75 @@ module RSpec
154
213
 
155
214
  # @api private
156
215
  #
157
- # Add inclusion filters to announcement message
216
+ # Add inclusion filters to announcement message.
158
217
  def announce_inclusion_filter(announcements)
159
- unless inclusion_filter.empty?
160
- announcements << "include #{inclusion_filter.description}"
161
- end
218
+ return if inclusion_filter.empty?
219
+
220
+ announcements << "include #{inclusion_filter.description}"
162
221
  end
163
222
 
164
223
  # @api private
165
224
  #
166
- # Add exclusion filters to announcement message
225
+ # Add exclusion filters to announcement message.
167
226
  def announce_exclusion_filter(announcements)
168
- unless exclusion_filter.empty?
169
- announcements << "exclude #{exclusion_filter.description}"
170
- end
227
+ return if exclusion_filter.empty?
228
+
229
+ announcements << "exclude #{exclusion_filter.description}"
171
230
  end
172
231
 
173
232
  private
174
233
 
175
- def declaration_line_numbers
176
- @line_numbers ||= example_groups.inject([]) do |lines, g|
177
- lines + g.declaration_line_numbers
234
+ def descending_declaration_line_numbers_by_file
235
+ @descending_declaration_line_numbers_by_file ||= begin
236
+ declaration_locations = FlatMap.flat_map(example_groups, &:declaration_locations)
237
+ hash_of_arrays = Hash.new { |h, k| h[k] = [] }
238
+
239
+ # TODO: change `inject` to `each_with_object` when we drop 1.8.7 support.
240
+ line_nums_by_file = declaration_locations.inject(hash_of_arrays) do |hash, (file_name, line_number)|
241
+ hash[file_name] << line_number
242
+ hash
243
+ end
244
+
245
+ line_nums_by_file.each_value do |list|
246
+ list.sort!
247
+ list.reverse!
248
+ end
178
249
  end
179
250
  end
180
251
 
252
+ def fail_if_config_and_cli_options_invalid
253
+ return unless @configuration.only_failures_but_not_configured?
254
+
255
+ reporter.abort_with(
256
+ "\nTo use `--only-failures`, you must first set " \
257
+ "`config.example_status_persistence_file_path`.",
258
+ 1 # exit code
259
+ )
260
+ end
261
+
262
+ # @private
263
+ # Provides a null implementation for initial use by configuration.
264
+ module Null
265
+ def self.non_example_failure; end
266
+ def self.non_example_failure=(_); end
267
+
268
+ def self.registered_example_group_files
269
+ []
270
+ end
271
+
272
+ def self.traverse_example_group_trees_until
273
+ end
274
+
275
+ # :nocov:
276
+ def self.example_groups
277
+ []
278
+ end
279
+
280
+ def self.all_example_groups
281
+ []
282
+ end
283
+ # :nocov:
284
+ end
181
285
  end
182
286
  end
183
287
  end
data/lib/rspec/core.rb CHANGED
@@ -1,5 +1,6 @@
1
+ # rubocop:disable Style/GlobalVars
1
2
  $_rspec_core_load_started_at = Time.now
2
- require 'rbconfig'
3
+ # rubocop:enable Style/GlobalVars
3
4
 
4
5
  require "rspec/support"
5
6
  RSpec::Support.require_rspec_support "caller_filter"
@@ -10,6 +11,7 @@ RSpec::Support.define_optimized_require_for_rspec(:core) { |f| require_relative
10
11
  version
11
12
  warnings
12
13
 
14
+ set
13
15
  flat_map
14
16
  filter_manager
15
17
  dsl
@@ -29,6 +31,7 @@ RSpec::Support.define_optimized_require_for_rspec(:core) { |f| require_relative
29
31
  option_parser
30
32
  configuration_options
31
33
  runner
34
+ invocations
32
35
  example
33
36
  shared_example_group
34
37
  example_group
@@ -40,18 +43,39 @@ module RSpec
40
43
 
41
44
  extend RSpec::Core::Warnings
42
45
 
43
- # Used to ensure examples get reloaded between multiple runs in
44
- # the same process.
46
+ class << self
47
+ # Setters for shared global objects
48
+ # @api private
49
+ attr_writer :configuration, :world
50
+ end
51
+
52
+ # Used to ensure examples get reloaded and user configuration gets reset to
53
+ # defaults between multiple runs in the same process.
45
54
  #
46
55
  # Users must invoke this if they want to have the configuration reset when
47
- # they use runner multiple times within the same process.
56
+ # they use the runner multiple times within the same process. Users must deal
57
+ # themselves with re-configuration of RSpec before run.
48
58
  def self.reset
59
+ RSpec::ExampleGroups.remove_all_constants
49
60
  @world = nil
50
61
  @configuration = nil
51
62
  end
52
63
 
53
- # Returns the global [Configuration](RSpec/Core/Configuration) object. While you
54
- # _can_ use this method to access the configuration, the more common
64
+ # Used to ensure examples get reloaded between multiple runs in the same
65
+ # process and ensures user configuration is persisted.
66
+ #
67
+ # Users must invoke this if they want to clear all examples but preserve
68
+ # current configuration when they use the runner multiple times within the
69
+ # same process.
70
+ def self.clear_examples
71
+ world.reset
72
+ configuration.reset_reporter
73
+ configuration.start_time = ::RSpec::Core::Time.now
74
+ configuration.reset_filters
75
+ end
76
+
77
+ # Returns the global [Configuration](RSpec/Core/Configuration) object. While
78
+ # you _can_ use this method to access the configuration, the more common
55
79
  # convention is to use [RSpec.configure](RSpec#configure-class_method).
56
80
  #
57
81
  # @example
@@ -59,12 +83,7 @@ module RSpec
59
83
  # @see RSpec.configure
60
84
  # @see Core::Configuration
61
85
  def self.configuration
62
- @configuration ||= begin
63
- config = RSpec::Core::Configuration.new
64
- config.expose_dsl_globally = true
65
- config
66
- end
67
-
86
+ @configuration ||= RSpec::Core::Configuration.new
68
87
  end
69
88
 
70
89
  # Yields the global configuration to a block.
@@ -101,30 +120,53 @@ module RSpec
101
120
  # end
102
121
  #
103
122
  def self.current_example
104
- thread_local_metadata[:current_example]
123
+ RSpec::Support.thread_local_data[:current_example]
105
124
  end
106
125
 
107
126
  # Set the current example being executed.
108
127
  # @api private
109
128
  def self.current_example=(example)
110
- thread_local_metadata[:current_example] = example
129
+ RSpec::Support.thread_local_data[:current_example] = example
111
130
  end
112
131
 
113
- # @private
114
- # A single thread local variable so we don't excessively pollute that
115
- # namespace.
116
- def self.thread_local_metadata
117
- Thread.current[:_rspec] ||= {}
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]
118
156
  end
119
157
 
120
158
  # @private
121
- # Internal container for global non-configuration data
159
+ # Internal container for global non-configuration data.
122
160
  def self.world
123
161
  @world ||= RSpec::Core::World.new
124
162
  end
125
163
 
126
164
  # Namespace for the rspec-core code.
127
165
  module Core
166
+ autoload :ExampleStatusPersister, "rspec/core/example_status_persister"
167
+ autoload :Profiler, "rspec/core/profiler"
168
+ autoload :DidYouMean, "rspec/core/did_you_mean"
169
+
128
170
  # @private
129
171
  # This avoids issues with reporting time caused by examples that
130
172
  # change the value/meaning of Time.now without properly restoring
@@ -135,7 +177,7 @@ module RSpec
135
177
  end
136
178
  end
137
179
 
138
- # @private path to executable file
180
+ # @private path to executable file.
139
181
  def self.path_to_executable
140
182
  @path_to_executable ||= File.expand_path('../../../exe/rspec', __FILE__)
141
183
  end
@@ -164,4 +206,7 @@ module RSpec
164
206
  require MODULES_TO_AUTOLOAD.fetch(name) { return super }
165
207
  ::RSpec.const_get(name)
166
208
  end
209
+
210
+ Core::DSL.expose_globally!
211
+ Core::SharedExampleGroup::TopLevelDSL.expose_globally!
167
212
  end
data.tar.gz.sig CHANGED
Binary file