rspec-expectations 3.9.0 → 3.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8cb915ab51f5b587fcbaa864e697cc291ff3c1f49afd8d829837c1a9c4c4f6b
4
- data.tar.gz: 6aa770883cacbfcf2921074a98506a0a789b4557ee6a7ea79738f008107e582d
3
+ metadata.gz: 487ee657765cb954821ff9cdff9298e5442431c611eb83f380afe9151e865a01
4
+ data.tar.gz: 5c6a1b5e7c99e1f58029cef0f0dce644d83d64fe265155aadb3f247b0b3fbe32
5
5
  SHA512:
6
- metadata.gz: fc2669ca822767874cc62c9e7cef32040f90da7cd0d4c13b1bd97fde68230f7f7019a8b717e2ebfcd223da5b9e25aaa60270c0797ba4d304def5e4ae3bb63f03
7
- data.tar.gz: e9d7a9e1b186c1eee547c315f177181992f5be9e35c61a16a041d97901537d054943a779e0d6bd7f2502e51a1fcbf95f0f6a10eab46fcdd85bebd8be1170a369
6
+ metadata.gz: a5f4383ba85185e8c59ccf2f1523835fb64e02e1828e37b2d5a93bd1be320c6152e0783b14fd524d753b8ef18d7dc7205fe25481a8adbadf2bf6b8c63acd3965
7
+ data.tar.gz: 710360cfef64576512eab6a165cd6e54cde44648d20ff40598a047af2fbce20f88caf00bf695c74c53c78e404505a4bfa6f196f5481bc7a7a742c1898c98a398
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -1,5 +1,75 @@
1
- ### 3.9.0 / 2019-10-02
2
- [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.5...v3.9.0)
1
+ ### 3.10.1 / 2020-12-27
2
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.10.0...v3.10.1)
3
+
4
+ Bug Fixes:
5
+
6
+ * Allow JRuby 9.2.x.x to generate backtraces normally rather than via our
7
+ backfill workaround. (#1230, Jon Rowe)
8
+
9
+ ### 3.10.0 / 2020-10-30
10
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.3...v3.10.0)
11
+
12
+ Enhancements:
13
+
14
+ * Allow `include` matcher to be chained with `once`, `at_least`, etc. for simple cases.
15
+ (Marc-André Lafortune, #1168)
16
+ * Add an explicit warning when `nil` is passed to `raise_error`. (Phil Pirozhkov, #1143)
17
+ * Improve `include` matcher's composability. (Phil Pirozhkov, #1155)
18
+ * Mocks expectations can now set a custom failure message.
19
+ (Benoit Tigeot and Nicolas Zermati, #1156)
20
+ * `aggregate_failures` now shows the backtrace line for each failure. (Fabricio Bedin, #1163)
21
+ * Support multiple combinations of `yield_control` modifiers like `at_least`, `at_most`.
22
+ (Jon Rowe, #1169)
23
+ * Dynamic `have_<n>` matchers now have output consistent with other dynamic matchers.
24
+ (Marc-André Lafortune, #1195)
25
+ * New config option `strict_predicate_matchers` allows predicate matcher to be strict
26
+ (i.e. match for `true` or `false`) instead of the default (match truthy vs `false` or `nil`).
27
+ (Marc-André Lafortune, #1196)
28
+
29
+ ### 3.9.4 / 2020-10-29
30
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.3...v3.9.4)
31
+
32
+ Bug Fixes:
33
+
34
+ * Fix regression with `be_` and `have_` matchers and arguments implementing `to_hash`
35
+ were they would act like keywords and be cast to a hash. (Jon Rowe, #1222)
36
+
37
+ ### 3.9.3 / 2020-10-23
38
+
39
+ Bug Fixes:
40
+
41
+ * Swap the comparison of the delta vs the expected for the `be_within` matcher allowing
42
+ more complicated oobjects to be compared providing they provide `abs` and other
43
+ comparison methods. (Kelly Stannard, #1182)
44
+ * Properly format expected in the description of the `be_within` matcher. (Jon Rowe, #1185)
45
+ * Remove warning when using keyword arguments with `be_` and `have_` matchers on 2.7.x
46
+ (Jon Rowe, #1187)
47
+ * Prevent formatting a single hash as a list of key value pairs in default failure messages
48
+ for custom matches (fixes formatting in `EnglishPhrasing#list`). (Robert Eshleman, #1193)
49
+ * Prevent errors from causing false positives when using `be <operator>` comparison, e.g.
50
+ `expect(1).not_to be < 'a'` will now correctly fail rather than pass. (Jon Rowe, #1208)
51
+
52
+
53
+ ### 3.9.2 / 2020-05-08
54
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.1...v3.9.2)
55
+
56
+ Bug Fixes:
57
+
58
+ * Issue a proper `ArgumentError` when invalid arguments are given to `yield_control`
59
+ modifiers such as `at_least` et al. (Marc-André Lafortune, #1167)
60
+ * Prevent Ruby 2.7 keyword arguments warning from being issued by custom
61
+ matcher definitions. (Jon Rowe, #1176)
62
+
63
+ ### 3.9.1 / 2020-03-13
64
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.0...v3.9.1)
65
+
66
+ Bug Fixes:
67
+
68
+ * Issue an improved warning when using `respond_to(...).with(n).arguments` and ignore
69
+ the warning when using with `have_attributes(...)`. (Jon Rowe, #1164)
70
+
71
+ ### 3.9.0 / 2019-10-08
72
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.6...v3.9.0)
3
73
 
4
74
  Enhancements:
5
75
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # RSpec Expectations [![Build Status](https://secure.travis-ci.org/rspec/rspec-expectations.svg?branch=master)](http://travis-ci.org/rspec/rspec-expectations) [![Code Climate](https://codeclimate.com/github/rspec/rspec-expectations.svg)](https://codeclimate.com/github/rspec/rspec-expectations)
1
+ # RSpec Expectations [![Build Status](https://secure.travis-ci.org/rspec/rspec-expectations.svg?branch=main)](http://travis-ci.org/rspec/rspec-expectations) [![Code Climate](https://codeclimate.com/github/rspec/rspec-expectations.svg)](https://codeclimate.com/github/rspec/rspec-expectations)
2
2
 
3
3
  RSpec::Expectations lets you express expected outcomes on an object in an
4
4
  example.
@@ -15,12 +15,12 @@ rspec-core and rspec-mocks):
15
15
 
16
16
  gem install rspec
17
17
 
18
- Want to run against the `master` branch? You'll need to include the dependent
18
+ Want to run against the `main` branch? You'll need to include the dependent
19
19
  RSpec repos as well. Add the following to your `Gemfile`:
20
20
 
21
21
  ```ruby
22
22
  %w[rspec-core rspec-expectations rspec-mocks rspec-support].each do |lib|
23
- gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => 'master'
23
+ gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => 'main'
24
24
  end
25
25
  ```
26
26
 
@@ -227,7 +227,7 @@ actual.should be > 3
227
227
  [1, 2, 3].should_not include 4
228
228
  ```
229
229
 
230
- See [detailed information on the `should` syntax and its usage.](https://github.com/rspec/rspec-expectations/blob/master/Should.md)
230
+ See [detailed information on the `should` syntax and its usage.](https://github.com/rspec/rspec-expectations/blob/main/Should.md)
231
231
 
232
232
  ## Compound Matcher Expressions
233
233
 
@@ -28,6 +28,7 @@ module RSpec
28
28
 
29
29
  def initialize
30
30
  @on_potential_false_positives = :warn
31
+ @strict_predicate_matchers = false
31
32
  end
32
33
 
33
34
  # Configures the supported syntax.
@@ -185,6 +186,20 @@ module RSpec
185
186
  @on_potential_false_positives = behavior
186
187
  end
187
188
 
189
+ # Configures RSpec to check predicate matchers to `be(true)` / `be(false)` (strict),
190
+ # or `be_truthy` / `be_falsey` (not strict).
191
+ # Historically, the default was `false`, but `true` is recommended.
192
+ def strict_predicate_matchers=(flag)
193
+ raise ArgumentError, "Pass `true` or `false`" unless flag == true || flag == false
194
+ @strict_predicate_matchers = flag
195
+ end
196
+
197
+ attr_reader :strict_predicate_matchers
198
+
199
+ def strict_predicate_matchers?
200
+ @strict_predicate_matchers
201
+ end
202
+
188
203
  # Indicates what RSpec will do about matcher use which will
189
204
  # potentially cause false positives in tests, generally you want to
190
205
  # avoid such scenarios so this defaults to `true`.
@@ -52,10 +52,10 @@ module RSpec
52
52
 
53
53
  private
54
54
 
55
- if RSpec::Support::Ruby.jruby?
56
- # On JRuby, `caller` and `raise` produce different backtraces with regards to `.java`
57
- # stack frames. It's important that we use `raise` for JRuby to produce a backtrace
58
- # that has a continuous common section with the raised `MultipleExpectationsNotMetError`,
55
+ if RSpec::Support::Ruby.jruby? && RSpec::Support::Ruby.jruby_version < '9.2.0.0'
56
+ # On JRuby 9.1.x.x and before, `caller` and `raise` produce different backtraces with
57
+ # regards to `.java` stack frames. It's important that we use `raise` for JRuby to produce
58
+ # a backtrace that has a continuous common section with the raised `MultipleExpectationsNotMetError`,
59
59
  # so that rspec-core's truncation logic can work properly on it to list the backtrace
60
60
  # relative to the `aggregate_failures` block.
61
61
  def assign_backtrace(failure)
@@ -150,11 +150,29 @@ module RSpec
150
150
  def enumerated(exceptions, index_offset)
151
151
  exceptions.each_with_index.map do |exception, index|
152
152
  index += index_offset
153
- formatted_message = yield exception
153
+ formatted_message = "#{yield exception}\n#{format_backtrace(exception.backtrace).first}"
154
154
  "#{index_label index}#{indented formatted_message, index}"
155
155
  end
156
156
  end
157
157
 
158
+ def exclusion_patterns
159
+ patterns = %w[/lib\d*/ruby/ bin/ exe/rspec /lib/bundler/ /exe/bundle:]
160
+ patterns << "org/jruby/" if RSpec::Support::Ruby.jruby?
161
+ patterns.map! { |s| Regexp.new(s.gsub('/', File::SEPARATOR)) }
162
+ end
163
+
164
+ def format_backtrace(backtrace)
165
+ backtrace.map { |l| backtrace_line(l) }.compact.tap { |filtered| filtered.concat backtrace if filtered.empty? }
166
+ end
167
+
168
+ def backtrace_line(line)
169
+ return if [Regexp.union(RSpec::CallerFilter::IGNORE_REGEX, *exclusion_patterns)].any? { |p| line =~ p }
170
+
171
+ # It changes the current path that is relative to
172
+ # system root to be relative to the project root.
173
+ line.sub(/(\A|\s)#{File.expand_path('.')}(#{File::SEPARATOR}|\s|\Z)/, '\\1.\\2'.freeze).sub(/\A([^:]+:\d+)$/, '\\1'.freeze)
174
+ end
175
+
158
176
  def enumerated_failures
159
177
  enumerated(failures, 0, &:message)
160
178
  end
@@ -44,10 +44,16 @@ module RSpec
44
44
 
45
45
  # @private
46
46
  class PositiveExpectationHandler
47
- def self.handle_matcher(actual, initial_matcher, message=nil, &block)
48
- ExpectationHelper.with_matcher(self, initial_matcher, message) do |matcher|
47
+ def self.handle_matcher(actual, initial_matcher, custom_message=nil, &block)
48
+ ExpectationHelper.with_matcher(self, initial_matcher, custom_message) do |matcher|
49
49
  return ::RSpec::Matchers::BuiltIn::PositiveOperatorMatcher.new(actual) unless initial_matcher
50
- matcher.matches?(actual, &block) || ExpectationHelper.handle_failure(matcher, message, :failure_message)
50
+
51
+ match_result = matcher.matches?(actual, &block)
52
+ if custom_message && match_result.respond_to?(:error_generator)
53
+ match_result.error_generator.opts[:message] = custom_message
54
+ end
55
+
56
+ match_result || ExpectationHelper.handle_failure(matcher, custom_message, :failure_message)
51
57
  end
52
58
  end
53
59
 
@@ -66,10 +72,16 @@ module RSpec
66
72
 
67
73
  # @private
68
74
  class NegativeExpectationHandler
69
- def self.handle_matcher(actual, initial_matcher, message=nil, &block)
70
- ExpectationHelper.with_matcher(self, initial_matcher, message) do |matcher|
75
+ def self.handle_matcher(actual, initial_matcher, custom_message=nil, &block)
76
+ ExpectationHelper.with_matcher(self, initial_matcher, custom_message) do |matcher|
71
77
  return ::RSpec::Matchers::BuiltIn::NegativeOperatorMatcher.new(actual) unless initial_matcher
72
- does_not_match?(matcher, actual, &block) || ExpectationHelper.handle_failure(matcher, message, :failure_message_when_negated)
78
+
79
+ negated_match_result = does_not_match?(matcher, actual, &block)
80
+ if custom_message && negated_match_result.respond_to?(:error_generator)
81
+ negated_match_result.error_generator.opts[:message] = custom_message
82
+ end
83
+
84
+ negated_match_result || ExpectationHelper.handle_failure(matcher, custom_message, :failure_message_when_negated)
73
85
  end
74
86
  end
75
87
 
@@ -2,7 +2,7 @@ module RSpec
2
2
  module Expectations
3
3
  # @private
4
4
  module Version
5
- STRING = '3.9.0'
5
+ STRING = '3.10.1'
6
6
  end
7
7
  end
8
8
  end
@@ -238,7 +238,7 @@ module RSpec
238
238
  # best to find a more positive name for the negated form, such as
239
239
  # `avoid_changing` rather than `not_change`.
240
240
  #
241
- module Matchers
241
+ module Matchers # rubocop:disable Metrics/ModuleLength
242
242
  extend ::RSpec::Matchers::DSL
243
243
 
244
244
  # @!macro [attach] alias_matcher
@@ -316,9 +316,9 @@ module RSpec
316
316
  def be_falsey
317
317
  BuiltIn::BeFalsey.new
318
318
  end
319
- alias_matcher :be_falsy, :be_falsey
319
+ alias_matcher :be_falsy, :be_falsey
320
320
  alias_matcher :a_falsey_value, :be_falsey
321
- alias_matcher :a_falsy_value, :be_falsey
321
+ alias_matcher :a_falsy_value, :be_falsey
322
322
 
323
323
  # Passes if actual is nil
324
324
  def be_nil
@@ -379,7 +379,7 @@ module RSpec
379
379
  BuiltIn::BeAKindOf.new(expected)
380
380
  end
381
381
  alias_method :be_kind_of, :be_a_kind_of
382
- alias_matcher :a_kind_of, :be_a_kind_of
382
+ alias_matcher :a_kind_of, :be_a_kind_of
383
383
 
384
384
  # Passes if actual.between?(min, max). Works with any Comparable object,
385
385
  # including String, Symbol, Time, or Numeric (Fixnum, Bignum, Integer,
@@ -406,7 +406,7 @@ module RSpec
406
406
  BuiltIn::BeWithin.new(delta)
407
407
  end
408
408
  alias_matcher :a_value_within, :be_within
409
- alias_matcher :within, :be_within
409
+ alias_matcher :within, :be_within
410
410
 
411
411
  # Applied to a proc, specifies that its execution will cause some value to
412
412
  # change.
@@ -492,8 +492,8 @@ module RSpec
492
492
  def change(receiver=nil, message=nil, &block)
493
493
  BuiltIn::Change.new(receiver, message, &block)
494
494
  end
495
- alias_matcher :a_block_changing, :change
496
- alias_matcher :changing, :change
495
+ alias_matcher :a_block_changing, :change
496
+ alias_matcher :changing, :change
497
497
 
498
498
  # Passes if actual contains all of the expected regardless of order.
499
499
  # This works for collections. Pass in multiple args and it will only
@@ -511,7 +511,7 @@ module RSpec
511
511
  BuiltIn::ContainExactly.new(items)
512
512
  end
513
513
  alias_matcher :a_collection_containing_exactly, :contain_exactly
514
- alias_matcher :containing_exactly, :contain_exactly
514
+ alias_matcher :containing_exactly, :contain_exactly
515
515
 
516
516
  # Passes if actual covers expected. This works for
517
517
  # Ranges. You can also pass in multiple args
@@ -529,7 +529,7 @@ module RSpec
529
529
  BuiltIn::Cover.new(*values)
530
530
  end
531
531
  alias_matcher :a_range_covering, :cover
532
- alias_matcher :covering, :cover
532
+ alias_matcher :covering, :cover
533
533
 
534
534
  # Matches if the actual value ends with the expected value(s). In the case
535
535
  # of a string, matches against the last `expected.length` characters of the
@@ -544,8 +544,8 @@ module RSpec
544
544
  BuiltIn::EndWith.new(*expected)
545
545
  end
546
546
  alias_matcher :a_collection_ending_with, :end_with
547
- alias_matcher :a_string_ending_with, :end_with
548
- alias_matcher :ending_with, :end_with
547
+ alias_matcher :a_string_ending_with, :end_with
548
+ alias_matcher :ending_with, :end_with
549
549
 
550
550
  # Passes if <tt>actual == expected</tt>.
551
551
  #
@@ -559,7 +559,7 @@ module RSpec
559
559
  BuiltIn::Eq.new(expected)
560
560
  end
561
561
  alias_matcher :an_object_eq_to, :eq
562
- alias_matcher :eq_to, :eq
562
+ alias_matcher :eq_to, :eq
563
563
 
564
564
  # Passes if `actual.eql?(expected)`
565
565
  #
@@ -573,7 +573,7 @@ module RSpec
573
573
  BuiltIn::Eql.new(expected)
574
574
  end
575
575
  alias_matcher :an_object_eql_to, :eql
576
- alias_matcher :eql_to, :eql
576
+ alias_matcher :eql_to, :eql
577
577
 
578
578
  # Passes if <tt>actual.equal?(expected)</tt> (object identity).
579
579
  #
@@ -587,7 +587,7 @@ module RSpec
587
587
  BuiltIn::Equal.new(expected)
588
588
  end
589
589
  alias_matcher :an_object_equal_to, :equal
590
- alias_matcher :equal_to, :equal
590
+ alias_matcher :equal_to, :equal
591
591
 
592
592
  # Passes if `actual.exist?` or `actual.exists?`
593
593
  #
@@ -597,7 +597,7 @@ module RSpec
597
597
  BuiltIn::Exist.new(*args)
598
598
  end
599
599
  alias_matcher :an_object_existing, :exist
600
- alias_matcher :existing, :exist
600
+ alias_matcher :existing, :exist
601
601
 
602
602
  # Passes if actual's attribute values match the expected attributes hash.
603
603
  # This works no matter how you define your attribute readers.
@@ -617,7 +617,7 @@ module RSpec
617
617
  BuiltIn::HaveAttributes.new(expected)
618
618
  end
619
619
  alias_matcher :an_object_having_attributes, :have_attributes
620
- alias_matcher :having_attributes, :have_attributes
620
+ alias_matcher :having_attributes, :have_attributes
621
621
 
622
622
  # Passes if actual includes expected. This works for
623
623
  # collections and Strings. You can also pass in multiple args
@@ -640,9 +640,9 @@ module RSpec
640
640
  BuiltIn::Include.new(*expected)
641
641
  end
642
642
  alias_matcher :a_collection_including, :include
643
- alias_matcher :a_string_including, :include
644
- alias_matcher :a_hash_including, :include
645
- alias_matcher :including, :include
643
+ alias_matcher :a_string_including, :include
644
+ alias_matcher :a_hash_including, :include
645
+ alias_matcher :including, :include
646
646
 
647
647
  # Passes if the provided matcher passes when checked against all
648
648
  # elements of the collection.
@@ -697,10 +697,10 @@ module RSpec
697
697
  def match(expected)
698
698
  BuiltIn::Match.new(expected)
699
699
  end
700
- alias_matcher :match_regex, :match
700
+ alias_matcher :match_regex, :match
701
701
  alias_matcher :an_object_matching, :match
702
- alias_matcher :a_string_matching, :match
703
- alias_matcher :matching, :match
702
+ alias_matcher :a_string_matching, :match
703
+ alias_matcher :matching, :match
704
704
 
705
705
  # An alternate form of `contain_exactly` that accepts
706
706
  # the expected contents as a single array arg rather
@@ -761,20 +761,22 @@ module RSpec
761
761
  # expect { do_something_risky }.to raise_error
762
762
  # expect { do_something_risky }.to raise_error(PoorRiskDecisionError)
763
763
  # expect { do_something_risky }.to raise_error(PoorRiskDecisionError) { |error| expect(error.data).to eq 42 }
764
+ # expect { do_something_risky }.to raise_error { |error| expect(error.data).to eq 42 }
764
765
  # expect { do_something_risky }.to raise_error(PoorRiskDecisionError, "that was too risky")
765
766
  # expect { do_something_risky }.to raise_error(PoorRiskDecisionError, /oo ri/)
767
+ # expect { do_something_risky }.to raise_error("that was too risky")
766
768
  #
767
769
  # expect { do_something_risky }.not_to raise_error
768
- def raise_error(error=nil, message=nil, &block)
770
+ def raise_error(error=BuiltIn::RaiseError::UndefinedValue, message=nil, &block)
769
771
  BuiltIn::RaiseError.new(error, message, &block)
770
772
  end
771
- alias_method :raise_exception, :raise_error
773
+ alias_method :raise_exception, :raise_error
772
774
 
773
- alias_matcher :a_block_raising, :raise_error do |desc|
775
+ alias_matcher :a_block_raising, :raise_error do |desc|
774
776
  desc.sub("raise", "a block raising")
775
777
  end
776
778
 
777
- alias_matcher :raising, :raise_error do |desc|
779
+ alias_matcher :raising, :raise_error do |desc|
778
780
  desc.sub("raise", "raising")
779
781
  end
780
782
 
@@ -788,7 +790,7 @@ module RSpec
788
790
  BuiltIn::RespondTo.new(*names)
789
791
  end
790
792
  alias_matcher :an_object_responding_to, :respond_to
791
- alias_matcher :responding_to, :respond_to
793
+ alias_matcher :responding_to, :respond_to
792
794
 
793
795
  # Passes if the submitted block returns true. Yields target to the
794
796
  # block.
@@ -809,7 +811,7 @@ module RSpec
809
811
  BuiltIn::Satisfy.new(description, &block)
810
812
  end
811
813
  alias_matcher :an_object_satisfying, :satisfy
812
- alias_matcher :satisfying, :satisfy
814
+ alias_matcher :satisfying, :satisfy
813
815
 
814
816
  # Matches if the actual value starts with the expected value(s). In the
815
817
  # case of a string, matches against the first `expected.length` characters
@@ -824,8 +826,8 @@ module RSpec
824
826
  BuiltIn::StartWith.new(*expected)
825
827
  end
826
828
  alias_matcher :a_collection_starting_with, :start_with
827
- alias_matcher :a_string_starting_with, :start_with
828
- alias_matcher :starting_with, :start_with
829
+ alias_matcher :a_string_starting_with, :start_with
830
+ alias_matcher :starting_with, :start_with
829
831
 
830
832
  # Given no argument, matches if a proc throws any Symbol.
831
833
  #
@@ -850,7 +852,7 @@ module RSpec
850
852
  desc.sub("throw", "a block throwing")
851
853
  end
852
854
 
853
- alias_matcher :throwing, :throw_symbol do |desc|
855
+ alias_matcher :throwing, :throw_symbol do |desc|
854
856
  desc.sub("throw", "throwing")
855
857
  end
856
858
 
@@ -866,8 +868,8 @@ module RSpec
866
868
  def yield_control
867
869
  BuiltIn::YieldControl.new
868
870
  end
869
- alias_matcher :a_block_yielding_control, :yield_control
870
- alias_matcher :yielding_control, :yield_control
871
+ alias_matcher :a_block_yielding_control, :yield_control
872
+ alias_matcher :yielding_control, :yield_control
871
873
 
872
874
  # Passes if the method called in the expect block yields with
873
875
  # no arguments. Fails if it does not yield, or yields with arguments.
@@ -884,8 +886,8 @@ module RSpec
884
886
  def yield_with_no_args
885
887
  BuiltIn::YieldWithNoArgs.new
886
888
  end
887
- alias_matcher :a_block_yielding_with_no_args, :yield_with_no_args
888
- alias_matcher :yielding_with_no_args, :yield_with_no_args
889
+ alias_matcher :a_block_yielding_with_no_args, :yield_with_no_args
890
+ alias_matcher :yielding_with_no_args, :yield_with_no_args
889
891
 
890
892
  # Given no arguments, matches if the method called in the expect
891
893
  # block yields with arguments (regardless of what they are or how
@@ -914,8 +916,8 @@ module RSpec
914
916
  def yield_with_args(*args)
915
917
  BuiltIn::YieldWithArgs.new(*args)
916
918
  end
917
- alias_matcher :a_block_yielding_with_args, :yield_with_args
918
- alias_matcher :yielding_with_args, :yield_with_args
919
+ alias_matcher :a_block_yielding_with_args, :yield_with_args
920
+ alias_matcher :yielding_with_args, :yield_with_args
919
921
 
920
922
  # Designed for use with methods that repeatedly yield (such as
921
923
  # iterators). Passes if the method called in the expect block yields
@@ -935,8 +937,8 @@ module RSpec
935
937
  def yield_successive_args(*args)
936
938
  BuiltIn::YieldSuccessiveArgs.new(*args)
937
939
  end
938
- alias_matcher :a_block_yielding_successive_args, :yield_successive_args
939
- alias_matcher :yielding_successive_args, :yield_successive_args
940
+ alias_matcher :a_block_yielding_successive_args, :yield_successive_args
941
+ alias_matcher :yielding_successive_args, :yield_successive_args
940
942
 
941
943
  # Delegates to {RSpec::Expectations.configuration}.
942
944
  # This is here because rspec-core's `expect_with` option
@@ -949,7 +951,7 @@ module RSpec
949
951
 
950
952
  private
951
953
 
952
- BE_PREDICATE_REGEX = /^(be_(?:an?_)?)(.*)/
954
+ BE_PREDICATE_REGEX = /^(?:be_(?:an?_)?)(.*)/
953
955
  HAS_REGEX = /^(?:have_)(.*)/
954
956
  DYNAMIC_MATCHER_REGEX = Regexp.union(BE_PREDICATE_REGEX, HAS_REGEX)
955
957
 
@@ -963,6 +965,7 @@ module RSpec
963
965
  super
964
966
  end
965
967
  end
968
+ ruby2_keywords :method_missing if respond_to?(:ruby2_keywords, true)
966
969
 
967
970
  if RUBY_VERSION.to_f >= 1.9
968
971
  def respond_to_missing?(method, *)