rspec-core 3.0.4 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/Changelog.md +67 -0
  5. data/lib/rspec/core.rb +3 -1
  6. data/lib/rspec/core/backtrace_formatter.rb +13 -10
  7. data/lib/rspec/core/configuration.rb +123 -57
  8. data/lib/rspec/core/configuration_options.rb +12 -12
  9. data/lib/rspec/core/drb.rb +11 -11
  10. data/lib/rspec/core/dsl.rb +0 -1
  11. data/lib/rspec/core/example.rb +39 -12
  12. data/lib/rspec/core/example_group.rb +31 -98
  13. data/lib/rspec/core/filter_manager.rb +16 -17
  14. data/lib/rspec/core/formatters.rb +14 -13
  15. data/lib/rspec/core/formatters/base_formatter.rb +8 -113
  16. data/lib/rspec/core/formatters/base_text_formatter.rb +3 -5
  17. data/lib/rspec/core/formatters/console_codes.rb +1 -2
  18. data/lib/rspec/core/formatters/deprecation_formatter.rb +2 -3
  19. data/lib/rspec/core/formatters/documentation_formatter.rb +3 -4
  20. data/lib/rspec/core/formatters/helpers.rb +5 -6
  21. data/lib/rspec/core/formatters/html_formatter.rb +20 -19
  22. data/lib/rspec/core/formatters/html_printer.rb +6 -5
  23. data/lib/rspec/core/formatters/json_formatter.rb +3 -2
  24. data/lib/rspec/core/formatters/profile_formatter.rb +0 -2
  25. data/lib/rspec/core/formatters/progress_formatter.rb +4 -4
  26. data/lib/rspec/core/formatters/protocol.rb +163 -0
  27. data/lib/rspec/core/formatters/snippet_extractor.rb +7 -6
  28. data/lib/rspec/core/hooks.rb +25 -10
  29. data/lib/rspec/core/memoized_helpers.rb +7 -5
  30. data/lib/rspec/core/metadata.rb +29 -30
  31. data/lib/rspec/core/metadata_filter.rb +66 -66
  32. data/lib/rspec/core/minitest_assertions_adapter.rb +1 -1
  33. data/lib/rspec/core/mocking_adapters/flexmock.rb +3 -1
  34. data/lib/rspec/core/mocking_adapters/mocha.rb +3 -1
  35. data/lib/rspec/core/mocking_adapters/null.rb +2 -0
  36. data/lib/rspec/core/mocking_adapters/rr.rb +3 -1
  37. data/lib/rspec/core/mocking_adapters/rspec.rb +3 -1
  38. data/lib/rspec/core/notifications.rb +36 -29
  39. data/lib/rspec/core/option_parser.rb +29 -25
  40. data/lib/rspec/core/ordering.rb +8 -9
  41. data/lib/rspec/core/pending.rb +6 -8
  42. data/lib/rspec/core/project_initializer.rb +4 -2
  43. data/lib/rspec/core/project_initializer/.rspec +0 -1
  44. data/lib/rspec/core/project_initializer/spec/spec_helper.rb +37 -26
  45. data/lib/rspec/core/rake_task.rb +37 -19
  46. data/lib/rspec/core/reporter.rb +13 -16
  47. data/lib/rspec/core/ruby_project.rb +2 -2
  48. data/lib/rspec/core/runner.rb +11 -14
  49. data/lib/rspec/core/shared_example_group.rb +14 -13
  50. data/lib/rspec/core/test_unit_assertions_adapter.rb +1 -1
  51. data/lib/rspec/core/version.rb +1 -1
  52. data/lib/rspec/core/warnings.rb +4 -4
  53. data/lib/rspec/core/world.rb +22 -24
  54. metadata +6 -5
  55. metadata.gz.sig +0 -0
@@ -41,14 +41,16 @@ module RSpec
41
41
  def organize_options
42
42
  @filter_manager_options = []
43
43
 
44
- @options = (file_options << command_line_options << env_options).each { |opts|
44
+ @options = (file_options << command_line_options << env_options).each do |opts|
45
45
  @filter_manager_options << [:include, opts.delete(:inclusion_filter)] if opts.key?(:inclusion_filter)
46
46
  @filter_manager_options << [:exclude, opts.delete(:exclusion_filter)] if opts.key?(:exclusion_filter)
47
- }.inject(:libs => [], :requires => []) { |hash, opts|
48
- hash.merge(opts) { |key, oldval, newval|
47
+ end
48
+
49
+ @options = @options.inject(:libs => [], :requires => []) do |hash, opts|
50
+ hash.merge(opts) do |key, oldval, newval|
49
51
  [:libs, :requires].include?(key) ? oldval + newval : newval
50
- }
51
- }
52
+ end
53
+ end
52
54
  end
53
55
 
54
56
  UNFORCED_OPTIONS = [
@@ -84,7 +86,7 @@ module RSpec
84
86
 
85
87
  # These must be set before `requires` to support checking `config.files_to_run`
86
88
  # from within `spec_helper.rb` when a `-rspec_helper` option is used.
87
- :files_or_directories_to_run, :pattern,
89
+ :files_or_directories_to_run, :pattern, :exclude_pattern,
88
90
 
89
91
  # In general, we want to require the specified files as early as possible.
90
92
  # The `--require` option is specifically intended to allow early requires.
@@ -161,12 +163,10 @@ module RSpec
161
163
  end
162
164
 
163
165
  def global_options_file
164
- begin
165
- File.join(File.expand_path("~"), ".rspec")
166
- rescue ArgumentError
167
- RSpec.warning "Unable to find ~/.rspec because the HOME environment variable is not set"
168
- nil
169
- end
166
+ File.join(File.expand_path("~"), ".rspec")
167
+ rescue ArgumentError
168
+ RSpec.warning "Unable to find ~/.rspec because the HOME environment variable is not set"
169
+ nil
170
170
  end
171
171
  end
172
172
  end
@@ -60,20 +60,20 @@ module RSpec
60
60
  end
61
61
 
62
62
  def add_failure_exit_code(argv)
63
- if @submitted_options[:failure_exit_code]
64
- argv << "--failure-exit-code" << @submitted_options[:failure_exit_code].to_s
65
- end
63
+ return unless @submitted_options[:failure_exit_code]
64
+
65
+ argv << "--failure-exit-code" << @submitted_options[:failure_exit_code].to_s
66
66
  end
67
67
 
68
68
  def add_full_description(argv)
69
- if @submitted_options[:full_description]
70
- # The argument to --example is regexp-escaped before being stuffed
71
- # into a regexp when received for the first time (see OptionParser).
72
- # Hence, merely grabbing the source of this regexp will retain the
73
- # backslashes, so we must remove them.
74
- @submitted_options[:full_description].each do |description|
75
- argv << "--example" << description.source.delete('\\')
76
- end
69
+ return unless @submitted_options[:full_description]
70
+
71
+ # The argument to --example is regexp-escaped before being stuffed
72
+ # into a regexp when received for the first time (see OptionParser).
73
+ # Hence, merely grabbing the source of this regexp will retain the
74
+ # backslashes, so we must remove them.
75
+ @submitted_options[:full_description].each do |description|
76
+ argv << "--example" << description.source.delete('\\')
77
77
  end
78
78
  end
79
79
 
@@ -85,7 +85,6 @@ module RSpec
85
85
  (class << top_level; self; end).class_exec(&changes)
86
86
  Module.class_exec(&changes)
87
87
  end
88
-
89
88
  end
90
89
  end
91
90
  end
@@ -73,9 +73,12 @@ module RSpec
73
73
  # there is one, otherwise returns a message including the location of the
74
74
  # example.
75
75
  def description
76
- description = metadata[:description].to_s.empty? ?
77
- "example at #{location}" :
78
- metadata[:description]
76
+ description = if metadata[:description].to_s.empty?
77
+ "example at #{location}"
78
+ else
79
+ metadata[:description]
80
+ end
81
+
79
82
  RSpec.configuration.format_docstrings_block.call(description)
80
83
  end
81
84
 
@@ -151,8 +154,8 @@ module RSpec
151
154
  Pending.mark_fixed! self
152
155
 
153
156
  raise Pending::PendingExampleFixedError,
154
- 'Expected example to fail since it is pending, but it passed.',
155
- [location]
157
+ 'Expected example to fail since it is pending, but it passed.',
158
+ [location]
156
159
  end
157
160
  rescue Pending::SkipDeclaredInExample
158
161
  # no-op, required metadata has already been set by the `skip`
@@ -201,25 +204,49 @@ module RSpec
201
204
  attr_reader :example
202
205
 
203
206
  Example.public_instance_methods(false).each do |name|
204
- unless name.to_sym == :run
205
- define_method(name) { |*a, &b| @example.__send__(name, *a, &b) }
206
- end
207
+ next if name.to_sym == :run || name.to_sym == :inspect
208
+
209
+ define_method(name) { |*a, &b| @example.__send__(name, *a, &b) }
207
210
  end
208
211
 
209
212
  Proc.public_instance_methods(false).each do |name|
213
+ next if name.to_sym == :call || name.to_sym == :inspect || name.to_sym == :to_proc
214
+
210
215
  define_method(name) { |*a, &b| @proc.__send__(name, *a, &b) }
211
216
  end
217
+
218
+ # Calls the proc and notes that the example has been executed.
219
+ def call(*args, &block)
220
+ @executed = true
221
+ @proc.call(*args, &block)
222
+ end
212
223
  alias run call
213
224
 
225
+ # Provides a wrapped proc that will update our `executed?` state when executed.
226
+ def to_proc
227
+ method(:call).to_proc
228
+ end
229
+
214
230
  def initialize(example, &block)
215
- @example = example
216
- @proc = block
231
+ @example = example
232
+ @proc = block
233
+ @executed = false
217
234
  end
218
235
 
219
236
  # @private
220
237
  def wrap(&block)
221
238
  self.class.new(example, &block)
222
239
  end
240
+
241
+ # Indicates whether or not the around hook has executed the example.
242
+ def executed?
243
+ @executed
244
+ end
245
+
246
+ # @private
247
+ def inspect
248
+ @example.inspect.gsub('Example', 'ExampleProcsy')
249
+ end
223
250
  end
224
251
 
225
252
  # @private
@@ -451,7 +478,7 @@ module RSpec
451
478
  end
452
479
  end
453
480
 
454
- def issue_deprecation(method_name, *args)
481
+ def issue_deprecation(_method_name, *_args)
455
482
  RSpec.deprecate("Treating `metadata[:execution_result]` as a hash",
456
483
  :replacement => "the attributes methods to access the data")
457
484
  end
@@ -466,7 +493,7 @@ module RSpec
466
493
  end
467
494
 
468
495
  # To ensure we don't silence errors...
469
- def set_exception(exception, context=nil)
496
+ def set_exception(exception, _context=nil)
470
497
  raise exception
471
498
  end
472
499
  end
@@ -1,3 +1,5 @@
1
+ RSpec::Support.require_rspec_support 'recursive_const_methods'
2
+
1
3
  module RSpec
2
4
  module Core
3
5
  # ExampleGroup and {Example} are the main structural elements of
@@ -15,7 +17,7 @@ module RSpec
15
17
  #
16
18
  # Example group bodies (e.g. `describe` or `context` blocks) are evaluated
17
19
  # in the context of a new subclass of ExampleGroup. Individual examples are
18
- # evalutaed in the context of an instance of the specific ExampleGroup subclass
20
+ # evaluated in the context of an instance of the specific ExampleGroup subclass
19
21
  # to which they belong.
20
22
  #
21
23
  # Besides the class methods defined here, there are other interesting macros
@@ -23,12 +25,12 @@ module RSpec
23
25
  # There are additional instance methods available to your examples defined in
24
26
  # {MemoizedHelpers} and {Pending}.
25
27
  class ExampleGroup
26
- extend Hooks
28
+ extend Hooks
27
29
 
28
30
  include MemoizedHelpers
29
- extend MemoizedHelpers::ClassMethods
31
+ extend MemoizedHelpers::ClassMethods
30
32
  include Pending
31
- extend SharedExampleGroup
33
+ extend SharedExampleGroup
32
34
 
33
35
  unless respond_to?(:define_singleton_method)
34
36
  # @private
@@ -48,7 +50,7 @@ module RSpec
48
50
  # @private
49
51
  # @return [Metadata] belonging to the parent of a nested {ExampleGroup}
50
52
  def self.superclass_metadata
51
- @superclass_metadata ||= self.superclass.respond_to?(:metadata) ? self.superclass.metadata : nil
53
+ @superclass_metadata ||= superclass.respond_to?(:metadata) ? superclass.metadata : nil
52
54
  end
53
55
 
54
56
  # @private
@@ -209,8 +211,8 @@ module RSpec
209
211
 
210
212
  if top_level
211
213
  if thread_data[:in_example_group]
212
- raise "Creating an isolated context from within a context is " +
213
- "not allowed. Change `RSpec.#{name}` to `#{name}` or " +
214
+ raise "Creating an isolated context from within a context is " \
215
+ "not allowed. Change `RSpec.#{name}` to `#{name}` or " \
214
216
  "move this to a top-level scope."
215
217
  end
216
218
 
@@ -313,7 +315,9 @@ module RSpec
313
315
 
314
316
  # @private
315
317
  def self.find_and_eval_shared(label, name, *args, &customization_block)
316
- unless shared_block = RSpec.world.shared_example_group_registry.find(parent_groups, name)
318
+ shared_block = RSpec.world.shared_example_group_registry.find(parent_groups, name)
319
+
320
+ unless shared_block
317
321
  raise ArgumentError, "Could not find shared #{label} #{name.inspect}"
318
322
  end
319
323
 
@@ -374,7 +378,7 @@ module RSpec
374
378
 
375
379
  # @private
376
380
  def self.descendant_filtered_examples
377
- @descendant_filtered_examples ||= filtered_examples + children.inject([]){|l,c| l + c.descendant_filtered_examples}
381
+ @descendant_filtered_examples ||= filtered_examples + children.inject([]) { |a, e| a + e.descendant_filtered_examples }
378
382
  end
379
383
 
380
384
  # @private
@@ -384,12 +388,12 @@ module RSpec
384
388
 
385
389
  # @private
386
390
  def self.descendants
387
- @_descendants ||= [self] + children.inject([]) {|list, c| list + c.descendants}
391
+ @_descendants ||= [self] + children.inject([]) { |a, e| a + e.descendants }
388
392
  end
389
393
 
390
394
  ## @private
391
395
  def self.parent_groups
392
- @parent_groups ||= ancestors.select {|a| a < RSpec::Core::ExampleGroup}
396
+ @parent_groups ||= ancestors.select { |a| a < RSpec::Core::ExampleGroup }
393
397
  end
394
398
 
395
399
  # @private
@@ -402,7 +406,9 @@ module RSpec
402
406
  unless defined?(@@example_groups_configured)
403
407
  RSpec.configuration.configure_mock_framework
404
408
  RSpec.configuration.configure_expectation_framework
409
+ # rubocop:disable Style/ClassVars
405
410
  @@example_groups_configured = true
411
+ # rubocop:enable Style/ClassVars
406
412
  end
407
413
  end
408
414
 
@@ -415,9 +421,9 @@ module RSpec
415
421
  def self.store_before_context_ivars(example_group_instance)
416
422
  return if example_group_instance.instance_variables.empty?
417
423
 
418
- example_group_instance.instance_variables.each { |ivar|
424
+ example_group_instance.instance_variables.each do |ivar|
419
425
  before_context_ivars[ivar] = example_group_instance.instance_variable_get(ivar)
420
- }
426
+ end
421
427
  end
422
428
 
423
429
  # @private
@@ -458,10 +464,10 @@ module RSpec
458
464
  results_for_descendants = ordering_strategy.order(children).map { |child| child.run(reporter) }.all?
459
465
  result_for_this_group && results_for_descendants
460
466
  rescue Pending::SkipDeclaredInExample => ex
461
- for_filtered_examples(reporter) {|example| example.skip_with_exception(reporter, ex) }
467
+ for_filtered_examples(reporter) { |example| example.skip_with_exception(reporter, ex) }
462
468
  rescue Exception => ex
463
469
  RSpec.world.wants_to_quit = true if fail_fast?
464
- for_filtered_examples(reporter) {|example| example.fail_with_exception(reporter, ex) }
470
+ for_filtered_examples(reporter) { |example| example.fail_with_exception(reporter, ex) }
465
471
  ensure
466
472
  run_after_context_hooks(new)
467
473
  before_context_ivars.clear
@@ -527,8 +533,8 @@ module RSpec
527
533
  # @private
528
534
  def self.declaration_line_numbers
529
535
  @declaration_line_numbers ||= [metadata[:line_number]] +
530
- examples.collect {|e| e.metadata[:line_number]} +
531
- children.inject([]) {|l,c| l + c.declaration_line_numbers}
536
+ examples.map { |e| e.metadata[:line_number] } +
537
+ children.inject([]) { |a, e| a + e.declaration_line_numbers }
532
538
  end
533
539
 
534
540
  # @private
@@ -538,7 +544,7 @@ module RSpec
538
544
 
539
545
  # @private
540
546
  def self.set_ivars(instance, ivars)
541
- ivars.each {|name, value| instance.instance_variable_set(name, value)}
547
+ ivars.each { |name, value| instance.instance_variable_set(name, value) }
542
548
  end
543
549
 
544
550
  # @private
@@ -557,7 +563,10 @@ module RSpec
557
563
  # This will fail if no block is provided, which is effectively the
558
564
  # same as failing the example so it will be marked correctly as
559
565
  # pending.
560
- callback = Proc.new { pending(reason); instance_exec(&block) }
566
+ callback = Proc.new do
567
+ pending(reason)
568
+ instance_exec(&block)
569
+ end
561
570
 
562
571
  return options, callback
563
572
  end
@@ -572,86 +581,11 @@ module RSpec
572
581
  end
573
582
  end
574
583
 
575
- # Provides recursive constant lookup methods useful for
576
- # constant stubbing.
577
- # @private
578
- module RecursiveConstMethods
579
- # We only want to consider constants that are defined directly on a
580
- # particular module, and not include top-level/inherited constants.
581
- # Unfortunately, the constant API changed between 1.8 and 1.9, so
582
- # we need to conditionally define methods to ignore the top-level/inherited
583
- # constants.
584
- #
585
- # Given:
586
- # class A; B = 1; end
587
- # class C < A; end
588
- #
589
- # On 1.8:
590
- # - C.const_get("Hash") # => ::Hash
591
- # - C.const_defined?("Hash") # => false
592
- # - C.constants # => ["B"]
593
- # - None of these methods accept the extra `inherit` argument
594
- # On 1.9:
595
- # - C.const_get("Hash") # => ::Hash
596
- # - C.const_defined?("Hash") # => true
597
- # - C.const_get("Hash", false) # => raises NameError
598
- # - C.const_defined?("Hash", false) # => false
599
- # - C.constants # => [:B]
600
- # - C.constants(false) #=> []
601
- if Module.method(:const_defined?).arity == 1
602
- def const_defined_on?(mod, const_name)
603
- mod.const_defined?(const_name)
604
- end
605
-
606
- def get_const_defined_on(mod, const_name)
607
- if const_defined_on?(mod, const_name)
608
- return mod.const_get(const_name)
609
- end
610
-
611
- raise NameError, "uninitialized constant #{mod.name}::#{const_name}"
612
- end
613
-
614
- def constants_defined_on(mod)
615
- mod.constants.select { |c| const_defined_on?(mod, c) }
616
- end
617
- else
618
- def const_defined_on?(mod, const_name)
619
- mod.const_defined?(const_name, false)
620
- end
621
-
622
- def get_const_defined_on(mod, const_name)
623
- mod.const_get(const_name, false)
624
- end
625
-
626
- def constants_defined_on(mod)
627
- mod.constants(false)
628
- end
629
- end
630
-
631
- def recursive_const_get(const_name)
632
- normalize_const_name(const_name).split('::').inject(Object) do |mod, name|
633
- get_const_defined_on(mod, name)
634
- end
635
- end
636
-
637
- def recursive_const_defined?(const_name)
638
- normalize_const_name(const_name).split('::').inject([Object, '']) do |(mod, full_name), name|
639
- yield(full_name, name) if block_given? && !(Module === mod)
640
- return false unless const_defined_on?(mod, name)
641
- [get_const_defined_on(mod, name), [mod, name].join('::')]
642
- end
643
- end
644
-
645
- def normalize_const_name(const_name)
646
- const_name.sub(/\A::/, '')
647
- end
648
- end
649
-
650
584
  # @private
651
585
  #
652
586
  # Namespace for the example group subclasses generated by top-level `describe`.
653
587
  module ExampleGroups
654
- extend RecursiveConstMethods
588
+ extend Support::RecursiveConstMethods
655
589
 
656
590
  def self.assign_const(group)
657
591
  base_name = base_name_for(group)
@@ -663,7 +597,7 @@ module RSpec
663
597
 
664
598
  def self.constant_scope_for(group)
665
599
  const_scope = group.superclass
666
- const_scope = self if const_scope == Core::ExampleGroup
600
+ const_scope = self if const_scope == ::RSpec::Core::ExampleGroup
667
601
  const_scope
668
602
  end
669
603
 
@@ -672,7 +606,7 @@ module RSpec
672
606
 
673
607
  # convert to CamelCase
674
608
  name = ' ' + group.description
675
- name.gsub!(/[^0-9a-zA-Z]+([0-9a-zA-Z])/) { $1.upcase }
609
+ name.gsub!(/[^0-9a-zA-Z]+([0-9a-zA-Z])/) { Regexp.last_match[1].upcase }
676
610
 
677
611
  name.lstrip! # Remove leading whitespace
678
612
  name.gsub!(/\W/, '') # JRuby, RBX and others don't like non-ascii in const names
@@ -694,4 +628,3 @@ module RSpec
694
628
  end
695
629
  end
696
630
  end
697
-
@@ -81,7 +81,7 @@ module RSpec
81
81
  # locations is a hash of expanded paths to arrays of line
82
82
  # numbers to match against. e.g.
83
83
  # { "path/to/file.rb" => [37, 42] }
84
- locations = inclusions.delete(:locations) || Hash.new { |h,k| h[k] = [] }
84
+ locations = inclusions.delete(:locations) || Hash.new { |h, k| h[k] = [] }
85
85
  locations[File.expand_path(file_path)].push(*line_numbers)
86
86
  inclusions.add_location(locations)
87
87
  end
@@ -93,9 +93,9 @@ module RSpec
93
93
  def prune(examples)
94
94
  if inclusions.standalone?
95
95
  base_exclusions = ExclusionRules.new
96
- examples.select {|e| !base_exclusions.include_example?(e) && include?(e) }
96
+ examples.select { |e| !base_exclusions.include_example?(e) && include?(e) }
97
97
  else
98
- examples.select {|e| !exclude?(e) && include?(e)}
98
+ examples.select { |e| !exclude?(e) && include?(e) }
99
99
  end
100
100
  end
101
101
 
@@ -156,9 +156,9 @@ module RSpec
156
156
  @rules.merge!(updated).each_key { |k| opposite.delete(k) }
157
157
  end
158
158
 
159
- def add_with_low_priority(_updated)
160
- updated = _updated.merge(@rules)
161
- opposite.each_pair { |k,v| updated.delete(k) if updated[k] == v }
159
+ def add_with_low_priority(updated)
160
+ updated = updated.merge(@rules)
161
+ opposite.each_pair { |k, v| updated.delete(k) if updated[k] == v }
162
162
  @rules.replace(updated)
163
163
  end
164
164
 
@@ -192,7 +192,7 @@ module RSpec
192
192
  end
193
193
 
194
194
  def description
195
- rules.inspect.gsub(PROC_HEX_NUMBER, '').gsub(PROJECT_DIR, '.').gsub(' (lambda)','')
195
+ rules.inspect.gsub(PROC_HEX_NUMBER, '').gsub(PROJECT_DIR, '.').gsub(' (lambda)', '')
196
196
  end
197
197
  end
198
198
 
@@ -201,19 +201,19 @@ module RSpec
201
201
  STANDALONE_FILTERS = [:locations, :full_description]
202
202
 
203
203
  def add_location(locations)
204
- replace_filters({ :locations => locations })
204
+ replace_filters(:locations => locations)
205
205
  end
206
206
 
207
207
  def add(*args)
208
- set_standalone_filter(*args) || super
208
+ apply_standalone_filter(*args) || super
209
209
  end
210
210
 
211
211
  def add_with_low_priority(*args)
212
- set_standalone_filter(*args) || super
212
+ apply_standalone_filter(*args) || super
213
213
  end
214
214
 
215
215
  def use(*args)
216
- set_standalone_filter(*args) || super
216
+ apply_standalone_filter(*args) || super
217
217
  end
218
218
 
219
219
  def include_example?(example)
@@ -226,13 +226,12 @@ module RSpec
226
226
 
227
227
  private
228
228
 
229
- def set_standalone_filter(updated)
229
+ def apply_standalone_filter(updated)
230
230
  return true if standalone?
231
+ return nil unless is_standalone_filter?(updated)
231
232
 
232
- if is_standalone_filter?(updated)
233
- replace_filters(updated)
234
- true
235
- end
233
+ replace_filters(updated)
234
+ true
236
235
  end
237
236
 
238
237
  def replace_filters(new_rules)
@@ -241,7 +240,7 @@ module RSpec
241
240
  end
242
241
 
243
242
  def is_standalone_filter?(rules)
244
- STANDALONE_FILTERS.any? { |key| rules.has_key?(key) }
243
+ STANDALONE_FILTERS.any? { |key| rules.key?(key) }
245
244
  end
246
245
  end
247
246