rspec-mocks 3.12.1 → 3.12.6

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: 26d2a0b4b29906b9299801a379eafbad373822822ad30b769ef2bef2e9a4b22b
4
- data.tar.gz: b2196b0f0111c48cb88398bb1071c9047fa637853da0ac684fc3d57d5ec7fc71
3
+ metadata.gz: 51d2892643ca24dce94963c553f2fdee71d55d9c3c2b2d14ba4fb2cb4ed0876a
4
+ data.tar.gz: ceb42a276b994afe0eaffe46e3a7f314393caf5ba39a5804969b955dc9f309d0
5
5
  SHA512:
6
- metadata.gz: c96f4c1dc4c9f99e0d222c2aeb054d5aa6d18a7b18e58df7a2235644c3d91745590346cb74ef8102420e658d748ded36ce1c90727bac6158770e3625f4817aed
7
- data.tar.gz: 7539266eec67cb3e522855f9a446b9e8a90aef2947d19ce01c69c4e2c6be033cf0e0c01f8b115d0d2f08fc7391e81e355514aeaaa3dc1364bff147bf489e1d19
6
+ metadata.gz: 3d19a308278d05b7703dafc5a88ca5b897badd3e60619fce025937b2ee677e36bea53f9ff2386b4180d107ce45dc695fecb68c69e46d0a4d0ec8063126d30b5f
7
+ data.tar.gz: dd881cdd051593ef697cab19d41b760933daca59768ad12430551743936d4373c575f2cc8cfe496e955e90b3cd965d14ec1f2b097c66f63e5e35e34d720696d9
checksums.yaml.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -1,5 +1,48 @@
1
1
  ### Development
2
- [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.12.1...3-12-maintenance)
2
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.12.6...3-12-maintenance)
3
+
4
+ ### 3.12.6 / 2023-07-11
5
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.12.5...v3.12.6)
6
+
7
+ Bug Fixes:
8
+
9
+ * Fix an issue with `and_call_original` when using the `method_missing` fallback
10
+ with keyword arguments. (Igor Drozdov, #1552)
11
+
12
+ ### 3.12.5 / 2023-03-30
13
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.12.4...v3.12.5)
14
+
15
+ Bug Fixes:
16
+
17
+ * Fix compatibility issue with Rails where active_support monkey patches `with`
18
+ when using any instance. (Lachlan Sylvester, #1540)
19
+
20
+ ### 3.12.4 / 2023-03-12
21
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.12.3...v3.12.4)
22
+
23
+ Bug Fixes:
24
+
25
+ * Fix an issue with asserting that Array#reverse is never called. (Brad Trick, #1533)
26
+ * Fix compatibility issue with Rails where active_support monkey patches `with`.
27
+ (Jean Boussier, #1531, #1534)
28
+
29
+ ### 3.12.3 / 2023-01-17
30
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.12.2...v3.12.3)
31
+
32
+ Bug Fixes:
33
+
34
+ * Fix keyword delegation in `send` for verifying doubles on Ruby 3.
35
+ (Charlie Honig, #1485)
36
+
37
+ ### 3.12.2 / 2023-01-07
38
+ [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.12.1...v3.12.2)
39
+
40
+ Bug Fixes:
41
+
42
+ * Fix implementation blocks for mocks using keyword arguments on Ruby 3.2.0.
43
+ (Adam Steel, #1508)
44
+ * Fix keyword argument assertions when mocking using `with` on Ruby 3.2.0.
45
+ (Slava Kardakov, Benoit Tigeot, Phil Pirozhkov, Benoit Daloze, #1514)
3
46
 
4
47
  ### 3.12.1 / 2022-12-10
5
48
  [Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.12.0...v3.12.1)
@@ -10,7 +10,7 @@ module RSpec
10
10
  #
11
11
  # This proxy sits in front of the recorder and delegates both to it
12
12
  # and to the `RSpec::Mocks::Proxy` for each already mocked or stubbed
13
- # instance of the class, in order to propogates changes to the instances.
13
+ # instance of the class, in order to propagates changes to the instances.
14
14
  #
15
15
  # Note that unlike `RSpec::Mocks::Proxy`, this proxy class is stateless
16
16
  # and is not persisted in `RSpec::Mocks.space`.
@@ -83,6 +83,15 @@ module RSpec
83
83
  end
84
84
  end
85
85
 
86
+ unless defined?(BasicObject)
87
+ class BasicObject
88
+ # Remove all methods except those expected to be defined on BasicObject
89
+ (instance_methods.map(&:to_sym) - [:__send__, :"!", :instance_eval, :==, :instance_exec, :"!=", :equal?, :__id__, :__binding__, :object_id]).each do |method|
90
+ undef_method method
91
+ end
92
+ end
93
+ end
94
+
86
95
  # @private
87
96
  # Delegates messages to each of the given targets in order to
88
97
  # provide the fluent interface that is available off of message
@@ -91,12 +100,12 @@ module RSpec
91
100
  # `targets` will typically contain 1 of the `AnyInstance::Recorder`
92
101
  # return values and N `MessageExpectation` instances (one per instance
93
102
  # of the `any_instance` klass).
94
- class FluentInterfaceProxy
103
+ class FluentInterfaceProxy < BasicObject
95
104
  def initialize(targets)
96
105
  @targets = targets
97
106
  end
98
107
 
99
- if RUBY_VERSION.to_f > 1.8
108
+ if ::RUBY_VERSION.to_f > 1.8
100
109
  def respond_to_missing?(method_name, include_private=false)
101
110
  super || @targets.first.respond_to?(method_name, include_private)
102
111
  end
@@ -61,7 +61,9 @@ module RSpec
61
61
  return false if expected_args.size != actual_args.size
62
62
 
63
63
  if RUBY_VERSION >= "3"
64
- # if both arguments end with Hashes, and if one is a keyword hash and the other is not, they don't match
64
+ # If the expectation was set with keywords, while the actual method was called with a positional hash argument, they don't match.
65
+ # If the expectation was set without keywords, e.g., with({a: 1}), then it fine to call it with either foo(a: 1) or foo({a: 1}).
66
+ # This corresponds to Ruby semantics, as if the method was def foo(options).
65
67
  if Hash === expected_args.last && Hash === actual_args.last
66
68
  if !Hash.ruby2_keywords_hash?(actual_args.last) && Hash.ruby2_keywords_hash?(expected_args.last)
67
69
  return false
@@ -55,8 +55,9 @@ module RSpec
55
55
  setup_any_instance_method_substitute(subject, :stub, block)
56
56
  end
57
57
 
58
+ own_methods = (instance_methods - superclass.instance_methods)
58
59
  MessageExpectation.public_instance_methods(false).each do |method|
59
- next if method_defined?(method)
60
+ next if own_methods.include?(method)
60
61
 
61
62
  define_method(method) do |*args, &block|
62
63
  @recorded_customizations << ExpectationCustomization.new(method, args, block)
@@ -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)
@@ -37,7 +37,7 @@ if defined?(::Minitest::Expectation)
37
37
  # not want to here (or else we would interfere with rspec-expectations' definition).
38
38
  else
39
39
  # ...otherwise, define those methods now. If `rspec/expectations/minitest_integration`
40
- # is loaded after this file, it'll overide the defintion here.
40
+ # is loaded after this file, it'll override the definition here.
41
41
  Minitest::Expectation.class_eval do
42
42
  include RSpec::Mocks::ExpectationTargetMethods
43
43
 
@@ -81,7 +81,7 @@ module RSpec
81
81
  # Queries rspec-mocks to find out information about the named constant.
82
82
  #
83
83
  # @param [String] name the name of the constant
84
- # @return [Constant] an object contaning information about the named
84
+ # @return [Constant] an object containing information about the named
85
85
  # constant.
86
86
  def self.original(name)
87
87
  mutator = ::RSpec::Mocks.space.constant_mutator_for(name)
@@ -192,6 +192,7 @@ module RSpec
192
192
  @messages_received << [message, args, block]
193
193
  end
194
194
  end
195
+ ruby2_keywords :record_message_received if respond_to?(:ruby2_keywords, true)
195
196
 
196
197
  # @private
197
198
  def message_received(message, *args, &block)
@@ -77,9 +77,9 @@ module RSpec
77
77
 
78
78
  def reset_all
79
79
  proxies.each_value { |proxy| proxy.reset }
80
- @constant_mutators.reverse.each { |mut| mut.idempotently_reset }
81
80
  any_instance_recorders.each_value { |recorder| recorder.stop_all_observation! }
82
81
  any_instance_recorders.clear
82
+ @constant_mutators.reverse.each { |mut| mut.idempotently_reset }
83
83
  end
84
84
 
85
85
  def register_constant_mutator(mutator)
@@ -42,11 +42,13 @@ module RSpec
42
42
  ensure
43
43
  @__sending_message = nil
44
44
  end
45
+ ruby2_keywords :__send__ if respond_to?(:ruby2_keywords, true)
45
46
  $VERBOSE = old
46
47
 
47
48
  def send(name, *args, &block)
48
49
  __send__(name, *args, &block)
49
50
  end
51
+ ruby2_keywords :send if respond_to?(:ruby2_keywords, true)
50
52
 
51
53
  def initialize(doubled_module, *args)
52
54
  @doubled_module = doubled_module
@@ -57,7 +57,7 @@ module RSpec
57
57
  # A verifying proxy mostly acts like a normal proxy, except that it
58
58
  # contains extra logic to try and determine the validity of any expectation
59
59
  # set on it. This includes whether or not methods have been defined and the
60
- # validatiy of arguments on method calls.
60
+ # validity of arguments on method calls.
61
61
  #
62
62
  # In all other ways this behaves like a normal proxy. It only adds the
63
63
  # verification behaviour to specific methods then delegates to the parent
@@ -147,12 +147,12 @@ module RSpec
147
147
  end
148
148
 
149
149
  def add_expectation(*args, &block)
150
- # explict params necessary for 1.8.7 see #626
150
+ # explicit params necessary for 1.8.7 see #626
151
151
  super(*args, &block).tap { |x| x.method_reference = @method_reference }
152
152
  end
153
153
 
154
154
  def add_stub(*args, &block)
155
- # explict params necessary for 1.8.7 see #626
155
+ # explicit params necessary for 1.8.7 see #626
156
156
  super(*args, &block).tap { |x| x.method_reference = @method_reference }
157
157
  end
158
158
 
@@ -160,6 +160,7 @@ module RSpec
160
160
  validate_arguments!(args)
161
161
  super
162
162
  end
163
+ ruby2_keywords :proxy_method_invoked if respond_to?(:ruby2_keywords, true)
163
164
 
164
165
  def validate_arguments!(actual_args)
165
166
  @method_reference.with_signature do |signature|
@@ -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.1'
6
+ STRING = '3.12.6'
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.1
4
+ version: 3.12.6
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: 2022-12-10 00:00:00.000000000 Z
48
+ date: 2023-07-11 00:00:00.000000000 Z
49
49
  dependencies:
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: rspec-support
@@ -115,14 +115,14 @@ dependencies:
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: 0.14.10
118
+ version: '1.1'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: 0.14.10
125
+ version: '1.1'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: minitest
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -194,7 +194,7 @@ licenses:
194
194
  - MIT
195
195
  metadata:
196
196
  bug_tracker_uri: https://github.com/rspec/rspec-mocks/issues
197
- changelog_uri: https://github.com/rspec/rspec-mocks/blob/v3.12.1/Changelog.md
197
+ changelog_uri: https://github.com/rspec/rspec-mocks/blob/v3.12.6/Changelog.md
198
198
  documentation_uri: https://rspec.info/documentation/
199
199
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
200
200
  source_code_uri: https://github.com/rspec/rspec-mocks
@@ -214,8 +214,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
216
  requirements: []
217
- rubygems_version: 3.3.26
217
+ rubygems_version: 3.4.1
218
218
  signing_key:
219
219
  specification_version: 4
220
- summary: rspec-mocks-3.12.1
220
+ summary: rspec-mocks-3.12.6
221
221
  test_files: []
metadata.gz.sig CHANGED
Binary file