rspec-expectations 3.9.0 → 3.9.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8cb915ab51f5b587fcbaa864e697cc291ff3c1f49afd8d829837c1a9c4c4f6b
4
- data.tar.gz: 6aa770883cacbfcf2921074a98506a0a789b4557ee6a7ea79738f008107e582d
3
+ metadata.gz: 18fe83413ef95c1cba358df490f7a8df578da2fd556853a7b043f45b5a28f301
4
+ data.tar.gz: '0486c1b3cc729a742b7630c28c299053a9eddae5bdc71092a40d285e9f14780b'
5
5
  SHA512:
6
- metadata.gz: fc2669ca822767874cc62c9e7cef32040f90da7cd0d4c13b1bd97fde68230f7f7019a8b717e2ebfcd223da5b9e25aaa60270c0797ba4d304def5e4ae3bb63f03
7
- data.tar.gz: e9d7a9e1b186c1eee547c315f177181992f5be9e35c61a16a041d97901537d054943a779e0d6bd7f2502e51a1fcbf95f0f6a10eab46fcdd85bebd8be1170a369
6
+ metadata.gz: 1b9d208174a3a192557c3f14b54a2ca2074d48b50e532a260008168a7aa504b8c9dc7af09dca75093d4f95f32a38c2e805fb561f56cc1d1416d35753de37fc85
7
+ data.tar.gz: 02360020651abb0aa4beb421415e3b23d4df072b20e8b5ae5dee16830f503a5c81741c72e336b9491915e896dd04eb57f32445e46f96a68702f73978226bc0a2
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,13 @@
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.9.1 / 2020-03-13
2
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.9.0...v3.9.1)
3
+
4
+ Bug Fixes:
5
+
6
+ * Issue an improved warning when using `respond_to(...).with(n).arguments` and ignore
7
+ the warning when using with `have_attributes(...)`. (Jon Rowe, #1164)
8
+
9
+ ### 3.9.0 / 2019-10-08
10
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.8.6...v3.9.0)
3
11
 
4
12
  Enhancements:
5
13
 
@@ -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.9.1'
6
6
  end
7
7
  end
8
8
  end
@@ -93,7 +93,7 @@ module RSpec
93
93
  end
94
94
 
95
95
  def respond_to_matcher
96
- @respond_to_matcher ||= RespondTo.new(*expected.keys).with(0).arguments
96
+ @respond_to_matcher ||= RespondTo.new(*expected.keys).with(0).arguments.tap { |m| m.ignoring_method_signature_failure! }
97
97
  end
98
98
 
99
99
  def respond_to_failure_message_or
@@ -1,5 +1,7 @@
1
1
  RSpec::Support.require_rspec_support "method_signature_verifier"
2
2
 
3
+ # TODO: Refactor this file to be under our class length
4
+ # rubocop:disable ClassLength
3
5
  module RSpec
4
6
  module Matchers
5
7
  module BuiltIn
@@ -11,6 +13,7 @@ module RSpec
11
13
  @names = names
12
14
  @expected_arity = nil
13
15
  @expected_keywords = []
16
+ @ignoring_method_signature_failure = false
14
17
  @unlimited_arguments = nil
15
18
  @arbitrary_keywords = nil
16
19
  end
@@ -100,6 +103,12 @@ module RSpec
100
103
  "respond to #{pp_names}#{with_arity}"
101
104
  end
102
105
 
106
+ # @api private
107
+ # Used by other matchers to suppress a check
108
+ def ignoring_method_signature_failure!
109
+ @ignoring_method_signature_failure = true
110
+ end
111
+
103
112
  private
104
113
 
105
114
  def find_failing_method_names(actual, filter_method)
@@ -109,7 +118,7 @@ module RSpec
109
118
  end
110
119
  end
111
120
 
112
- def matches_arity?(actual, name)
121
+ def setup_method_signature_expectation
113
122
  expectation = Support::MethodSignatureExpectation.new
114
123
 
115
124
  if @expected_arity.is_a?(Range)
@@ -123,10 +132,25 @@ module RSpec
123
132
  expectation.expect_unlimited_arguments = @unlimited_arguments
124
133
  expectation.expect_arbitrary_keywords = @arbitrary_keywords
125
134
 
135
+ expectation
136
+ end
137
+
138
+ def matches_arity?(actual, name)
139
+ expectation = setup_method_signature_expectation
140
+
126
141
  return true if expectation.empty?
127
142
 
128
- Support::StrictSignatureVerifier.new(method_signature_for(actual, name)).
129
- with_expectation(expectation).valid?
143
+ begin
144
+ Support::StrictSignatureVerifier.new(method_signature_for(actual, name)).
145
+ with_expectation(expectation).valid?
146
+ rescue NameError
147
+ return true if @ignoring_method_signature_failure
148
+ raise ArgumentError, "The #{matcher_name} matcher requires that " \
149
+ "the actual object define the method(s) in " \
150
+ "order to check arity, but the method " \
151
+ "`#{name}` is not defined. Remove the arity " \
152
+ "check or define the method to continue."
153
+ end
130
154
  end
131
155
 
132
156
  def method_signature_for(actual, name)
@@ -172,3 +196,4 @@ module RSpec
172
196
  end
173
197
  end
174
198
  end
199
+ # rubocop:enable ClassLength
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-expectations
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.0
4
+ version: 3.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Baker
@@ -45,7 +45,7 @@ cert_chain:
45
45
  ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
46
46
  F3MdtaDehhjC
47
47
  -----END CERTIFICATE-----
48
- date: 2019-10-07 00:00:00.000000000 Z
48
+ date: 2020-03-13 00:00:00.000000000 Z
49
49
  dependencies:
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: rspec-support
@@ -202,7 +202,7 @@ licenses:
202
202
  - MIT
203
203
  metadata:
204
204
  bug_tracker_uri: https://github.com/rspec/rspec-expectations/issues
205
- changelog_uri: https://github.com/rspec/rspec-expectations/blob/v3.9.0/Changelog.md
205
+ changelog_uri: https://github.com/rspec/rspec-expectations/blob/v3.9.1/Changelog.md
206
206
  documentation_uri: https://rspec.info/documentation/
207
207
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
208
208
  source_code_uri: https://github.com/rspec/rspec-expectations
@@ -222,8 +222,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  - !ruby/object:Gem::Version
223
223
  version: '0'
224
224
  requirements: []
225
- rubygems_version: 3.0.6
225
+ rubygems_version: 3.1.2
226
226
  signing_key:
227
227
  specification_version: 4
228
- summary: rspec-expectations-3.9.0
228
+ summary: rspec-expectations-3.9.1
229
229
  test_files: []
metadata.gz.sig CHANGED
Binary file