rspec-core 3.13.5 → 4.0.0.beta1

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 (49) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/Changelog.md +56 -1
  4. data/LICENSE.md +2 -2
  5. data/README.md +33 -44
  6. data/lib/rspec/core/bisect/example_minimizer.rb +3 -3
  7. data/lib/rspec/core/bisect/fork_runner.rb +0 -6
  8. data/lib/rspec/core/bisect/shell_command.rb +2 -0
  9. data/lib/rspec/core/bisect/shell_runner.rb +2 -25
  10. data/lib/rspec/core/bisect/utilities.rb +3 -7
  11. data/lib/rspec/core/configuration.rb +128 -330
  12. data/lib/rspec/core/configuration_options.rb +4 -16
  13. data/lib/rspec/core/drb.rb +0 -5
  14. data/lib/rspec/core/dsl.rb +3 -48
  15. data/lib/rspec/core/example.rb +5 -41
  16. data/lib/rspec/core/example_group.rb +36 -75
  17. data/lib/rspec/core/filter_manager.rb +2 -11
  18. data/lib/rspec/core/formatters/deprecation_formatter.rb +4 -4
  19. data/lib/rspec/core/formatters/exception_presenter.rb +30 -60
  20. data/lib/rspec/core/formatters/helpers.rb +1 -1
  21. data/lib/rspec/core/formatters/html_printer.rb +8 -7
  22. data/lib/rspec/core/formatters/html_snippet_extractor.rb +0 -4
  23. data/lib/rspec/core/formatters/profile_formatter.rb +2 -2
  24. data/lib/rspec/core/formatters/snippet_extractor.rb +3 -1
  25. data/lib/rspec/core/formatters/syntax_highlighter.rb +2 -0
  26. data/lib/rspec/core/formatters.rb +4 -8
  27. data/lib/rspec/core/hooks.rb +24 -45
  28. data/lib/rspec/core/memoized_helpers.rb +30 -120
  29. data/lib/rspec/core/metadata.rb +8 -216
  30. data/lib/rspec/core/metadata_filter.rb +15 -69
  31. data/lib/rspec/core/minitest_assertions_adapter.rb +2 -2
  32. data/lib/rspec/core/mocking_adapters/mocha.rb +2 -31
  33. data/lib/rspec/core/notifications.rb +4 -16
  34. data/lib/rspec/core/option_parser.rb +6 -14
  35. data/lib/rspec/core/ordering.rb +5 -6
  36. data/lib/rspec/core/output_wrapper.rb +2 -2
  37. data/lib/rspec/core/pending.rb +1 -9
  38. data/lib/rspec/core/project_initializer/spec/spec_helper.rb +14 -31
  39. data/lib/rspec/core/rake_task.rb +6 -7
  40. data/lib/rspec/core/shared_example_group.rb +7 -82
  41. data/lib/rspec/core/shell_escape.rb +2 -0
  42. data/lib/rspec/core/test_unit_assertions_adapter.rb +4 -17
  43. data/lib/rspec/core/version.rb +1 -1
  44. data/lib/rspec/core/world.rb +8 -23
  45. data/lib/rspec/core.rb +1 -22
  46. data.tar.gz.sig +0 -0
  47. metadata +24 -25
  48. metadata.gz.sig +0 -0
  49. data/lib/rspec/core/flat_map.rb +0 -20
@@ -46,10 +46,6 @@ module RSpec
46
46
  line = line.sub(/\A([^:]+:\d+)$/, '\\1'.freeze)
47
47
  return nil if line == '-e:1'.freeze
48
48
  line
49
- rescue SecurityError
50
- # :nocov: - SecurityError is no longer produced starting in ruby 2.7
51
- nil
52
- # :nocov:
53
49
  end
54
50
 
55
51
  # @private
@@ -77,16 +73,11 @@ module RSpec
77
73
  # Symbols are converted into hash keys with a value of `true`.
78
74
  # This is done to support simple tagging using a symbol, rather
79
75
  # than needing to do `:symbol => true`.
80
- def self.build_hash_from(args, warn_about_example_group_filtering=false)
76
+ def self.build_hash_from(args)
81
77
  hash = args.last.is_a?(Hash) ? args.pop : {}
82
78
 
83
79
  hash[args.pop] = true while args.last.is_a?(Symbol)
84
80
 
85
- if warn_about_example_group_filtering && hash.key?(:example_group)
86
- RSpec.deprecate("Filtering by an `:example_group` subhash",
87
- :replacement => "the subhash to filter directly")
88
- end
89
-
90
81
  hash
91
82
  end
92
83
 
@@ -146,7 +137,7 @@ module RSpec
146
137
  file_path, line_number = if backtrace
147
138
  file_path_and_line_number_from(backtrace)
148
139
  elsif block.respond_to?(:source_location)
149
- block.source_location
140
+ block.source_location.take(2)
150
141
  else
151
142
  file_path_and_line_number_from(caller)
152
143
  end
@@ -213,11 +204,6 @@ module RSpec
213
204
  class ExampleHash < HashPopulator
214
205
  def self.create(group_metadata, user_metadata, index_provider, description, block)
215
206
  example_metadata = group_metadata.dup
216
- group_metadata = Hash.new(&ExampleGroupHash.backwards_compatibility_default_proc do |hash|
217
- hash[:parent_example_group]
218
- end)
219
- group_metadata.update(example_metadata)
220
-
221
207
  example_metadata[:execution_result] = Example::ExecutionResult.new
222
208
  example_metadata[:example_group] = group_metadata
223
209
  example_metadata[:shared_group_inclusion_backtrace] = SharedExampleGroupInclusionStackFrame.current_backtrace
@@ -246,59 +232,18 @@ module RSpec
246
232
  # @private
247
233
  class ExampleGroupHash < HashPopulator
248
234
  def self.create(parent_group_metadata, user_metadata, example_group_index, *args, &block)
249
- group_metadata = hash_with_backwards_compatibility_default_proc
250
-
251
- if parent_group_metadata
252
- group_metadata.update(parent_group_metadata)
253
- group_metadata[:parent_example_group] = parent_group_metadata
254
- end
235
+ group_metadata =
236
+ if parent_group_metadata
237
+ { **parent_group_metadata, :parent_example_group => parent_group_metadata }
238
+ else
239
+ {}
240
+ end
255
241
 
256
242
  hash = new(group_metadata, user_metadata, example_group_index, args, block)
257
243
  hash.populate
258
244
  hash.metadata
259
245
  end
260
246
 
261
- def self.hash_with_backwards_compatibility_default_proc
262
- Hash.new(&backwards_compatibility_default_proc { |hash| hash })
263
- end
264
-
265
- def self.backwards_compatibility_default_proc(&example_group_selector)
266
- Proc.new do |hash, key|
267
- case key
268
- when :example_group
269
- # We commonly get here when rspec-core is applying a previously
270
- # configured filter rule, such as when a gem configures:
271
- #
272
- # RSpec.configure do |c|
273
- # c.include MyGemHelpers, :example_group => { :file_path => /spec\/my_gem_specs/ }
274
- # end
275
- #
276
- # It's confusing for a user to get a deprecation at this point in
277
- # the code, so instead we issue a deprecation from the config APIs
278
- # that take a metadata hash, and MetadataFilter sets this thread
279
- # local to silence the warning here since it would be so
280
- # confusing.
281
- unless RSpec::Support.thread_local_data[:silence_metadata_example_group_deprecations]
282
- RSpec.deprecate("The `:example_group` key in an example group's metadata hash",
283
- :replacement => "the example group's hash directly for the " \
284
- "computed keys and `:parent_example_group` to access the parent " \
285
- "example group metadata")
286
- end
287
-
288
- group_hash = example_group_selector.call(hash)
289
- LegacyExampleGroupHash.new(group_hash) if group_hash
290
- when :example_group_block
291
- RSpec.deprecate("`metadata[:example_group_block]`",
292
- :replacement => "`metadata[:block]`")
293
- hash[:block]
294
- when :describes
295
- RSpec.deprecate("`metadata[:describes]`",
296
- :replacement => "`metadata[:described_class]`")
297
- hash[:described_class]
298
- end
299
- end
300
- end
301
-
302
247
  private
303
248
 
304
249
  def described_class
@@ -341,158 +286,5 @@ module RSpec
341
286
  :shared_group_inclusion_backtrace
342
287
  ]
343
288
  end
344
-
345
- # Mixin that makes the including class imitate a hash for backwards
346
- # compatibility. The including class should use `attr_accessor` to
347
- # declare attributes.
348
- # @private
349
- module HashImitatable
350
- def self.included(klass)
351
- klass.extend ClassMethods
352
- end
353
-
354
- def to_h
355
- hash = extra_hash_attributes.dup
356
-
357
- self.class.hash_attribute_names.each do |name|
358
- hash[name] = __send__(name)
359
- end
360
-
361
- hash
362
- end
363
-
364
- (Hash.public_instance_methods - Object.public_instance_methods).each do |method_name|
365
- next if [:[], :[]=, :to_h].include?(method_name.to_sym)
366
-
367
- define_method(method_name) do |*args, &block|
368
- issue_deprecation(method_name, *args)
369
-
370
- hash = hash_for_delegation
371
- self.class.hash_attribute_names.each do |name|
372
- hash.delete(name) unless instance_variable_defined?(:"@#{name}")
373
- end
374
-
375
- hash.__send__(method_name, *args, &block).tap do
376
- # apply mutations back to the object
377
- hash.each do |name, value|
378
- if directly_supports_attribute?(name)
379
- set_value(name, value)
380
- else
381
- extra_hash_attributes[name] = value
382
- end
383
- end
384
- end
385
- end
386
- end
387
-
388
- def [](key)
389
- issue_deprecation(:[], key)
390
-
391
- if directly_supports_attribute?(key)
392
- get_value(key)
393
- else
394
- extra_hash_attributes[key]
395
- end
396
- end
397
-
398
- def []=(key, value)
399
- issue_deprecation(:[]=, key, value)
400
-
401
- if directly_supports_attribute?(key)
402
- set_value(key, value)
403
- else
404
- extra_hash_attributes[key] = value
405
- end
406
- end
407
-
408
- private
409
-
410
- def extra_hash_attributes
411
- @extra_hash_attributes ||= {}
412
- end
413
-
414
- def directly_supports_attribute?(name)
415
- self.class.hash_attribute_names.include?(name)
416
- end
417
-
418
- def get_value(name)
419
- __send__(name)
420
- end
421
-
422
- def set_value(name, value)
423
- __send__(:"#{name}=", value)
424
- end
425
-
426
- def hash_for_delegation
427
- to_h
428
- end
429
-
430
- def issue_deprecation(_method_name, *_args)
431
- # no-op by default: subclasses can override
432
- end
433
-
434
- # @private
435
- module ClassMethods
436
- def hash_attribute_names
437
- @hash_attribute_names ||= []
438
- end
439
-
440
- def attr_accessor(*names)
441
- hash_attribute_names.concat(names)
442
- super
443
- end
444
- end
445
- end
446
-
447
- # @private
448
- # Together with the example group metadata hash default block,
449
- # provides backwards compatibility for the old `:example_group`
450
- # key. In RSpec 2.x, the computed keys of a group's metadata
451
- # were exposed from a nested subhash keyed by `[:example_group]`, and
452
- # then the parent group's metadata was exposed by sub-subhash
453
- # keyed by `[:example_group][:example_group]`.
454
- #
455
- # In RSpec 3, we reorganized this to that the computed keys are
456
- # exposed directly of the group metadata hash (no nesting), and
457
- # `:parent_example_group` returns the parent group's metadata.
458
- #
459
- # Maintaining backwards compatibility was difficult: we wanted
460
- # `:example_group` to return an object that:
461
- #
462
- # * Exposes the top-level metadata keys that used to be nested
463
- # under `:example_group`.
464
- # * Supports mutation (rspec-rails, for example, assigns
465
- # `metadata[:example_group][:described_class]` when you use
466
- # anonymous controller specs) such that changes are written
467
- # back to the top-level metadata hash.
468
- # * Exposes the parent group metadata as
469
- # `[:example_group][:example_group]`.
470
- class LegacyExampleGroupHash
471
- include HashImitatable
472
-
473
- def initialize(metadata)
474
- @metadata = metadata
475
- parent_group_metadata = metadata.fetch(:parent_example_group) { {} }[:example_group]
476
- self[:example_group] = parent_group_metadata if parent_group_metadata
477
- end
478
-
479
- def to_h
480
- super.merge(@metadata)
481
- end
482
-
483
- private
484
-
485
- def directly_supports_attribute?(name)
486
- name != :example_group
487
- end
488
-
489
- def get_value(name)
490
- @metadata[name]
491
- end
492
-
493
- def set_value(name, value)
494
- @metadata[name] = value
495
- end
496
- end
497
289
  end
498
290
  end
@@ -8,33 +8,23 @@ module RSpec
8
8
  module MetadataFilter
9
9
  class << self
10
10
  # @private
11
- def apply?(predicate, filters, metadata)
12
- filters.__send__(predicate) { |k, v| filter_applies?(k, v, metadata) }
11
+ def apply?(filters, metadata)
12
+ filters.all? { |k, v| filter_applies?(k, v, metadata) }
13
13
  end
14
14
 
15
15
  # @private
16
16
  def filter_applies?(key, filter_value, metadata)
17
- silence_metadata_example_group_deprecations do
18
- return location_filter_applies?(filter_value, metadata) if key == :locations
19
- return id_filter_applies?(filter_value, metadata) if key == :ids
20
- return filters_apply?(key, filter_value, metadata) if Hash === filter_value
17
+ return location_filter_applies?(filter_value, metadata) if key == :locations
18
+ return id_filter_applies?(filter_value, metadata) if key == :ids
19
+ return filters_apply?(key, filter_value, metadata) if Hash === filter_value
21
20
 
22
- meta_value = metadata.fetch(key) { return false }
21
+ meta_value = metadata.fetch(key) { return false }
23
22
 
24
- return true if TrueClass === filter_value && meta_value
25
- return proc_filter_applies?(key, filter_value, metadata) if Proc === filter_value
26
- return filter_applies_to_any_value?(key, filter_value, metadata) if Array === meta_value
23
+ return true if TrueClass === filter_value && meta_value
24
+ return proc_filter_applies?(key, filter_value, metadata) if Proc === filter_value
25
+ return filter_applies_to_any_value?(key, filter_value, metadata) if Array === meta_value
27
26
 
28
- filter_value === meta_value || filter_value.to_s == meta_value.to_s
29
- end
30
- end
31
-
32
- # @private
33
- def silence_metadata_example_group_deprecations
34
- RSpec::Support.thread_local_data[:silence_metadata_example_group_deprecations] = true
35
- yield
36
- ensure
37
- RSpec::Support.thread_local_data.delete(:silence_metadata_example_group_deprecations)
27
+ filter_value === meta_value || filter_value.to_s == meta_value.to_s
38
28
  end
39
29
 
40
30
  private
@@ -72,7 +62,7 @@ module RSpec
72
62
 
73
63
  def filters_apply?(key, value, metadata)
74
64
  subhash = metadata[key]
75
- return false unless Hash === subhash || HashImitatable === subhash
65
+ return false unless Hash === subhash
76
66
  value.all? { |k, v| filter_applies?(k, v, subhash) }
77
67
  end
78
68
  end
@@ -98,8 +88,7 @@ module RSpec
98
88
  class UpdateOptimized
99
89
  attr_reader :items_and_filters
100
90
 
101
- def initialize(applies_predicate)
102
- @applies_predicate = applies_predicate
91
+ def initialize
103
92
  @items_and_filters = []
104
93
  end
105
94
 
@@ -118,21 +107,8 @@ module RSpec
118
107
  def items_for(request_meta)
119
108
  @items_and_filters.each_with_object([]) do |(item, item_meta), to_return|
120
109
  to_return << item if item_meta.empty? ||
121
- MetadataFilter.apply?(@applies_predicate, item_meta, request_meta)
122
- end
123
- end
124
-
125
- unless [].respond_to?(:each_with_object) # For 1.8.7
126
- # :nocov:
127
- undef items_for
128
- def items_for(request_meta)
129
- @items_and_filters.inject([]) do |to_return, (item, item_meta)|
130
- to_return << item if item_meta.empty? ||
131
- MetadataFilter.apply?(@applies_predicate, item_meta, request_meta)
132
- to_return
133
- end
110
+ MetadataFilter.apply?(item_meta, request_meta)
134
111
  end
135
- # :nocov:
136
112
  end
137
113
  end
138
114
 
@@ -152,7 +128,7 @@ module RSpec
152
128
  alias find_items_for items_for
153
129
  private :find_items_for
154
130
 
155
- def initialize(applies_predicate)
131
+ def initialize
156
132
  super
157
133
  @applicable_keys = Set.new
158
134
  @proc_keys = Set.new
@@ -187,7 +163,7 @@ module RSpec
187
163
  # that are not. For each set, this method for the first group in the set is
188
164
  # still an `O(N)` calculation, but all subsequent groups in the set will be
189
165
  # constant time lookups when they call this method.
190
- applicable_metadata = applicable_metadata_from(metadata)
166
+ applicable_metadata = metadata.slice(*@applicable_keys)
191
167
 
192
168
  if applicable_metadata.any? { |k, _| @proc_keys.include?(k) }
193
169
  # It's unsafe to memoize lookups involving procs (since they can
@@ -214,41 +190,11 @@ module RSpec
214
190
  @memoized_lookups.clear
215
191
  end
216
192
 
217
- def applicable_metadata_from(metadata)
218
- MetadataFilter.silence_metadata_example_group_deprecations do
219
- @applicable_keys.inject({}) do |hash, key|
220
- # :example_group is treated special here because...
221
- # - In RSpec 2, example groups had an `:example_group` key
222
- # - In RSpec 3, that key is deprecated (it was confusing!).
223
- # - The key is not technically present in an example group metadata hash
224
- # (and thus would fail the `metadata.key?(key)` check) but a value
225
- # is provided when accessed via the hash's `default_proc`
226
- # - Thus, for backwards compatibility, we have to explicitly check
227
- # for `:example_group` here if it is one of the keys being used to
228
- # filter.
229
- hash[key] = metadata[key] if metadata.key?(key) || key == :example_group
230
- hash
231
- end
232
- end
233
- end
234
-
235
193
  def proc_keys_from(metadata)
236
194
  metadata.each_with_object([]) do |(key, value), to_return|
237
195
  to_return << key if Proc === value
238
196
  end
239
197
  end
240
-
241
- unless [].respond_to?(:each_with_object) # For 1.8.7
242
- # :nocov:
243
- undef proc_keys_from
244
- def proc_keys_from(metadata)
245
- metadata.inject([]) do |to_return, (key, value)|
246
- to_return << key if Proc === value
247
- to_return
248
- end
249
- end
250
- # :nocov:
251
- end
252
198
  end
253
199
  end
254
200
  end
@@ -1,9 +1,9 @@
1
1
  begin
2
- # Only the minitest 5.x gem includes the minitest.rb and assertions.rb files.
2
+ # Only Minitest 5.x includes minitest.rb and assertions.rb files
3
3
  require 'minitest'
4
4
  require 'minitest/assertions'
5
5
  rescue LoadError
6
- # We must be using Ruby Core's MiniTest or the Minitest gem 4.x.
6
+ # We must be using Minitest 4.x
7
7
  require 'minitest/unit'
8
8
  Minitest = MiniTest
9
9
  end
@@ -1,28 +1,4 @@
1
- # In order to support all versions of mocha, we have to jump through some
2
- # hoops here.
3
- #
4
- # mocha >= '0.13.0':
5
- # require 'mocha/api' is required.
6
- # require 'mocha/object' raises a LoadError b/c the file no longer exists.
7
- # mocha < '0.13.0', >= '0.9.7'
8
- # require 'mocha/api' is required.
9
- # require 'mocha/object' is required.
10
- # mocha < '0.9.7':
11
- # require 'mocha/api' raises a LoadError b/c the file does not yet exist.
12
- # require 'mocha/standalone' is required.
13
- # require 'mocha/object' is required.
14
- begin
15
- require 'mocha/api'
16
-
17
- begin
18
- require 'mocha/object'
19
- rescue LoadError
20
- # Mocha >= 0.13.0 no longer contains this file nor needs it to be loaded.
21
- end
22
- rescue LoadError
23
- require 'mocha/standalone'
24
- require 'mocha/object'
25
- end
1
+ require 'mocha/api'
26
2
 
27
3
  module RSpec
28
4
  module Core
@@ -33,12 +9,7 @@ module RSpec
33
9
  :mocha
34
10
  end
35
11
 
36
- # Mocha::Standalone was deprecated as of Mocha 0.9.7.
37
- begin
38
- include ::Mocha::API
39
- rescue NameError
40
- include ::Mocha::Standalone
41
- end
12
+ include ::Mocha::API
42
13
 
43
14
  def setup_mocks_for_rspec
44
15
  mocha_setup
@@ -42,17 +42,9 @@ module RSpec::Core
42
42
  execution_result = example.execution_result
43
43
 
44
44
  return SkippedExampleNotification.new(example) if execution_result.example_skipped?
45
- return new(example) unless execution_result.status == :pending || execution_result.status == :failed
45
+ return FailedExampleNotification.new(example) if execution_result.status == :pending || execution_result.status == :failed
46
46
 
47
- klass = if execution_result.pending_fixed?
48
- PendingExampleFixedNotification
49
- elsif execution_result.status == :pending
50
- PendingExampleFailedAsExpectedNotification
51
- else
52
- FailedExampleNotification
53
- end
54
-
55
- klass.new(example)
47
+ new(example)
56
48
  end
57
49
 
58
50
  private_class_method :new
@@ -216,12 +208,6 @@ module RSpec::Core
216
208
  end
217
209
  end
218
210
 
219
- # @deprecated Use {FailedExampleNotification} instead.
220
- class PendingExampleFixedNotification < FailedExampleNotification; end
221
-
222
- # @deprecated Use {FailedExampleNotification} instead.
223
- class PendingExampleFailedAsExpectedNotification < FailedExampleNotification; end
224
-
225
211
  # The `SkippedExampleNotification` extends `ExampleNotification` with
226
212
  # things useful for specs that are skipped.
227
213
  #
@@ -401,7 +387,9 @@ module RSpec::Core
401
387
 
402
388
  def rerun_argument_for(example)
403
389
  location = example.location_rerun_argument
390
+
404
391
  return location unless duplicate_rerun_locations.include?(location)
392
+ return location if RSpec.configuration.force_line_number_for_spec_rerun
405
393
  conditionally_quote(example.id)
406
394
  end
407
395
 
@@ -18,7 +18,7 @@ module RSpec::Core
18
18
  return { :files_or_directories_to_run => [] } if original_args.empty?
19
19
  args = original_args.dup
20
20
 
21
- options = args.delete('--tty') ? { :tty => true } : {}
21
+ options = {}
22
22
  begin
23
23
  parser(options).parse!(args)
24
24
  rescue OptionParser::InvalidOption => e
@@ -139,12 +139,6 @@ module RSpec::Core
139
139
  options[:full_backtrace] = true
140
140
  end
141
141
 
142
- parser.on('-c', '--color', '--colour', '') do |_o|
143
- # flag will be excluded from `--help` output because it is deprecated
144
- options[:color] = true
145
- options[:color_mode] = :automatic
146
- end
147
-
148
142
  parser.on('--force-color', '--force-colour', 'Force the output to be in color, even if the output is not a TTY') do |_o|
149
143
  if options[:color_mode] == :off
150
144
  abort "Please only use one of `--force-color` and `--no-color`"
@@ -170,8 +164,8 @@ module RSpec::Core
170
164
  Integer(argument)
171
165
  rescue ArgumentError
172
166
  RSpec.warning "Non integer specified as profile count, separate " \
173
- "your path from options with -- e.g. " \
174
- "`rspec --profile -- #{argument}`",
167
+ "your path from options with -- e.g. " \
168
+ "`rspec --profile -- #{argument}`",
175
169
  :call_site => nil
176
170
  true
177
171
  end
@@ -184,11 +178,7 @@ module RSpec::Core
184
178
  end
185
179
 
186
180
  parser.on('-w', '--warnings', 'Enable ruby warnings') do
187
- if Object.const_defined?(:Warning) && Warning.respond_to?(:[]=)
188
- # :nocov: on older Ruby without Warning
189
- Warning[:deprecated] = true
190
- # :nocov:
191
- end
181
+ Warning[:deprecated] = true
192
182
  $VERBOSE = true
193
183
  end
194
184
 
@@ -252,6 +242,7 @@ FILTERING
252
242
  name, value = tag.gsub(/^(~@|~|@)/, '').split(':', 2)
253
243
  name = name.to_sym
254
244
 
245
+ # rubocop:disable Lint/DuplicateBranch
255
246
  parsed_value = case value
256
247
  when nil then true # The default value for tags is true
257
248
  when 'true' then true
@@ -263,6 +254,7 @@ FILTERING
263
254
  else
264
255
  value
265
256
  end
257
+ # rubocop:enable Lint/DuplicateBranch
266
258
 
267
259
  add_tag_filter(options, filter_type, name, parsed_value)
268
260
  end
@@ -109,14 +109,13 @@ module RSpec
109
109
  @configuration = configuration
110
110
  @strategies = {}
111
111
 
112
- register(:random, Random.new(configuration))
112
+ random = Random.new(configuration)
113
+ register(:random, random)
113
114
  register(:recently_modified, RecentlyModified.new)
115
+ register(:defined, Identity.new)
114
116
 
115
- identity = Identity.new
116
- register(:defined, identity)
117
-
118
- # The default global ordering is --defined.
119
- register(:global, identity)
117
+ # The default global ordering is --random.
118
+ register(:global, random)
120
119
  end
121
120
 
122
121
  def fetch(name, &fallback)
@@ -10,8 +10,8 @@ module RSpec
10
10
  @output = output
11
11
  end
12
12
 
13
- def respond_to?(name, priv=false)
14
- output.respond_to?(name, priv)
13
+ def respond_to?(*args)
14
+ output.respond_to?(*args)
15
15
  end
16
16
 
17
17
  def method_missing(name, *args, &block)
@@ -64,15 +64,7 @@ module RSpec
64
64
 
65
65
  if block_given?
66
66
  raise ArgumentError, <<-EOS.gsub(/^\s+\|/, '')
67
- |The semantics of `RSpec::Core::Pending#pending` have changed in
68
- |RSpec 3. In RSpec 2.x, it caused the example to be skipped. In
69
- |RSpec 3, the rest of the example is still run but is expected to
70
- |fail, and will be marked as a failure (rather than as pending) if
71
- |the example passes.
72
- |
73
- |Passing a block within an example is now deprecated. Marking the
74
- |example as pending provides the same behavior in RSpec 3 which was
75
- |provided only by the block in RSpec 2.x.
67
+ |Passing a block within an example is not supported.
76
68
  |
77
69
  |Move the code in the block provided to `pending` into the rest of
78
70
  |the example body.