rspec-mocks 3.12.5 → 3.12.7

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: 9ac306bd185750c3017ee678b47a8049e734c0442b6cef60e8e7a04aa13c29c4
4
- data.tar.gz: bde012659ef5fb279c0dee84a6788ba3a58156bfca1d3bdf934c99e6b96c26dc
3
+ metadata.gz: 9cf01a58b4af1af87a64bb57139b8bb7010349ffb208980bca4b8d851c7c64d7
4
+ data.tar.gz: b5b7ddbcd488edf6bc693dee88de4de2ff7a3ebcb8fb067bf8374726dfef869d
5
5
  SHA512:
6
- metadata.gz: ccde683caf2726c2f7e9f27d982550a779fdaead2c595495107dab5cdab04609568aedb882fcf47456528a4630dd55ed8c4097fc169ff71e34cc28e724306879
7
- data.tar.gz: dec3ab40874ab16f87a20f0332f15afe7a487dd024bcd111843e1edcbfff91366954012d56e2c90e8b7b0518f721cc4f1e9771afad0e0a265034d63c3c6d9b24
6
+ metadata.gz: f3b1ec29a54f045fefd91e58c55667e0b805d1996abd54d6024f8fe74f5584697ba9365e091f19179cb3ea0e75e1ae1125def0719232600ee0afaa879c1fd805
7
+ data.tar.gz: ac8be23c660534d3d33078405d8d035b8812b5e4b54df413e6249768ad30eab0c9125741558ece3a29c985e9d520edd2b346e606104f5cd840b780b2fc43b82b
checksums.yaml.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -1,5 +1,20 @@
1
1
  ### Development
2
- [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.12.5...3-12-maintenance)
2
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.12.7...3-12-maintenance)
3
+
4
+ ### 3.12.7 / 2024-02-04
5
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.12.6...v3.12.7)
6
+
7
+ Bug Fixes:
8
+
9
+ * Reduce allocations from "any_instance" style mocks. (Carlos Palhares, #1479)
10
+
11
+ ### 3.12.6 / 2023-07-11
12
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.12.5...v3.12.6)
13
+
14
+ Bug Fixes:
15
+
16
+ * Fix an issue with `and_call_original` when using the `method_missing` fallback
17
+ with keyword arguments. (Igor Drozdov, #1552)
3
18
 
4
19
  ### 3.12.5 / 2023-03-30
5
20
  [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.12.4...v3.12.5)
data/README.md CHANGED
@@ -278,6 +278,8 @@ expect(double).to receive(:msg).with(1, duck_type(:abs, :div), "b") #2nd argumen
278
278
  expect(double).to receive(:msg).with(hash_including(:a => 5)) # first arg is a hash with a: 5 as one of the key-values
279
279
  expect(double).to receive(:msg).with(array_including(5)) # first arg is an array with 5 as one of the key-values
280
280
  expect(double).to receive(:msg).with(hash_excluding(:a => 5)) # first arg is a hash without a: 5 as one of the key-values
281
+ expect(double).to receive(:msg).with(start_with('a')) # any matcher, custom or from rspec-expectations
282
+ expect(double).to receive(:msg).with(satisfy { |data| data.dig(:a, :b, :c) == 5 }) # assert anything you want
281
283
  ```
282
284
 
283
285
  ## Receive Counts
@@ -156,21 +156,23 @@ module RSpec
156
156
 
157
157
  private
158
158
 
159
- def ancestor_is_an_observer?(method_name)
160
- lambda do |ancestor|
161
- unless ancestor == @klass
162
- ::RSpec::Mocks.space.
163
- any_instance_recorder_for(ancestor).already_observing?(method_name)
164
- end
165
- end
159
+ def ancestor_is_an_observer?(ancestor, method_name)
160
+ return if ancestor == @klass
161
+
162
+ ::RSpec::Mocks.space.
163
+ any_instance_recorder_for(ancestor).already_observing?(method_name)
166
164
  end
167
165
 
168
166
  def super_class_observers_for(method_name)
169
- @klass.ancestors.select(&ancestor_is_an_observer?(method_name))
167
+ @klass.ancestors.select do |ancestor|
168
+ ancestor_is_an_observer?(ancestor, method_name)
169
+ end
170
170
  end
171
171
 
172
172
  def super_class_observing?(method_name)
173
- @klass.ancestors.any?(&ancestor_is_an_observer?(method_name))
173
+ @klass.ancestors.any? do |ancestor|
174
+ ancestor_is_an_observer?(ancestor, method_name)
175
+ end
174
176
  end
175
177
 
176
178
  def normalize_chain(*args)
@@ -312,7 +312,7 @@ module RSpec
312
312
  begin
313
313
  object.class.name.include?(matcher_namespace)
314
314
  rescue NoMethodError
315
- # Some objects, like BasicObject, don't implemented standard
315
+ # Some objects, like BasicObject, don't implement standard
316
316
  # reflection methods.
317
317
  false
318
318
  end
@@ -26,10 +26,7 @@ module RSpec
26
26
  # handler of the object. This accounts for cases where the user has not
27
27
  # correctly defined `respond_to?`, and also 1.8 which does not provide
28
28
  # method handles for missing methods even if `respond_to?` is correct.
29
- @original_implementation_callable ||= original_method ||
30
- Proc.new do |*args, &block|
31
- @object.__send__(:method_missing, @method_name, *args, &block)
32
- end
29
+ @original_implementation_callable ||= original_method || method_missing_block
33
30
  end
34
31
 
35
32
  alias_method :save_original_implementation_callable!, :original_implementation_callable
@@ -40,6 +37,16 @@ module RSpec
40
37
  @proxy.original_method_handle_for(method_name)
41
38
  end
42
39
 
40
+ # @private
41
+ def method_missing_block
42
+ block = Proc.new do |*args, &b|
43
+ @object.__send__(:method_missing, @method_name, *args, &b)
44
+ end
45
+ block.ruby2_keywords if block.respond_to?(:ruby2_keywords)
46
+
47
+ block
48
+ end
49
+
43
50
  # @private
44
51
  def visibility
45
52
  @proxy.visibility_for(@method_name)
@@ -3,7 +3,7 @@ module RSpec
3
3
  # Version information for RSpec mocks.
4
4
  module Version
5
5
  # Version of RSpec mocks currently in use in SemVer format.
6
- STRING = '3.12.5'
6
+ STRING = '3.12.7'
7
7
  end
8
8
  end
9
9
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-mocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.5
4
+ version: 3.12.7
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: 2023-03-30 00:00:00.000000000 Z
48
+ date: 2024-02-04 00:00:00.000000000 Z
49
49
  dependencies:
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: rspec-support
@@ -113,16 +113,22 @@ dependencies:
113
113
  name: aruba
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - "~>"
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 1.1.0
119
+ - - "<"
117
120
  - !ruby/object:Gem::Version
118
- version: '1.1'
121
+ version: 3.0.0
119
122
  type: :development
120
123
  prerelease: false
121
124
  version_requirements: !ruby/object:Gem::Requirement
122
125
  requirements:
123
- - - "~>"
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: 1.1.0
129
+ - - "<"
124
130
  - !ruby/object:Gem::Version
125
- version: '1.1'
131
+ version: 3.0.0
126
132
  - !ruby/object:Gem::Dependency
127
133
  name: minitest
128
134
  requirement: !ruby/object:Gem::Requirement
@@ -194,7 +200,7 @@ licenses:
194
200
  - MIT
195
201
  metadata:
196
202
  bug_tracker_uri: https://github.com/rspec/rspec-mocks/issues
197
- changelog_uri: https://github.com/rspec/rspec-mocks/blob/v3.12.5/Changelog.md
203
+ changelog_uri: https://github.com/rspec/rspec-mocks/blob/v3.12.7/Changelog.md
198
204
  documentation_uri: https://rspec.info/documentation/
199
205
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
200
206
  source_code_uri: https://github.com/rspec/rspec-mocks
@@ -214,8 +220,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
220
  - !ruby/object:Gem::Version
215
221
  version: '0'
216
222
  requirements: []
217
- rubygems_version: 3.4.1
223
+ rubygems_version: 3.1.6
218
224
  signing_key:
219
225
  specification_version: 4
220
- summary: rspec-mocks-3.12.5
226
+ summary: rspec-mocks-3.12.7
221
227
  test_files: []
metadata.gz.sig CHANGED
Binary file