rspec-mocks 3.4.1 → 3.5.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Changelog.md +15 -0
- data/lib/rspec/mocks.rb +4 -0
- data/lib/rspec/mocks/any_instance/recorder.rb +22 -1
- data/lib/rspec/mocks/any_instance/stub_chain.rb +1 -1
- data/lib/rspec/mocks/matchers/have_received.rb +2 -0
- data/lib/rspec/mocks/matchers/receive.rb +2 -0
- data/lib/rspec/mocks/matchers/receive_message_chain.rb +2 -0
- data/lib/rspec/mocks/matchers/receive_messages.rb +2 -0
- data/lib/rspec/mocks/method_reference.rb +19 -11
- data/lib/rspec/mocks/proxy.rb +5 -0
- data/lib/rspec/mocks/targets.rb +1 -1
- data/lib/rspec/mocks/version.rb +1 -1
- metadata +10 -10
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5342aa85d00e6bcc24d8debc05333f12d40b7ad
|
4
|
+
data.tar.gz: e4082539be10ac57f42759854b84d9bc8c4c15d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5afda5c6811e7b3db5bb83b4957c5864d74a45fcc16fb9e84a8378d5dfb05c8eede815317fc6a6bbeb0cc378552d81837e7ed7e0c12a30b8838b512a8d9eef9
|
7
|
+
data.tar.gz: 177e8c07f662fa0a7b3a115218c50836aa5afe1da19c2bf679ab833dbe9041b048eac179b463cf9a8de385039f13a5133c7bf44a779fb2ad4329419b17745d24
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
### Development
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.5.0.beta1...master)
|
3
|
+
|
4
|
+
### 3.5.0.beta1 / 2016-02-06
|
5
|
+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.4.1...v3.5.0.beta1)
|
6
|
+
|
7
|
+
Bug Fixes:
|
8
|
+
|
9
|
+
* Allow `any_instance_of(...).to receive(...)` to use `and_yield` multiple
|
10
|
+
times. (Kilian Cirera Sant, #1054)
|
11
|
+
* Allow matchers which inherit from `rspec-mocks` matchers to be used for
|
12
|
+
`allow`. (Andrew Kozin, #1056)
|
13
|
+
* Prevent stubbing `respond_to?` on partial doubles from causing infinite
|
14
|
+
recursion. (Jon Rowe, #1013)
|
15
|
+
|
1
16
|
### 3.4.1 / 2016-01-10
|
2
17
|
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.4.0...v3.4.1)
|
3
18
|
|
data/lib/rspec/mocks.rb
CHANGED
@@ -117,6 +117,10 @@ module RSpec
|
|
117
117
|
|
118
118
|
# Namespace for mock-related matchers.
|
119
119
|
module Matchers
|
120
|
+
# @private
|
121
|
+
# just a "tag" for rspec-mock matchers detection
|
122
|
+
module Matcher; end
|
123
|
+
|
120
124
|
autoload :HaveReceived, "rspec/mocks/matchers/have_received"
|
121
125
|
autoload :Receive, "rspec/mocks/matchers/receive"
|
122
126
|
autoload :ReceiveMessageChain, "rspec/mocks/matchers/receive_message_chain"
|
@@ -193,7 +193,28 @@ module RSpec
|
|
193
193
|
alias_method_name = build_alias_method_name(method_name)
|
194
194
|
@klass.class_exec(@backed_up_method_owner) do |backed_up_method_owner|
|
195
195
|
remove_method method_name
|
196
|
-
|
196
|
+
|
197
|
+
# A @klass can have methods implemented (see Method#owner) in @klass
|
198
|
+
# or inherited from a superclass. In ruby 2.2 and earlier, we can copy
|
199
|
+
# a method regardless of the 'owner' and restore it to @klass after
|
200
|
+
# because a call to 'super' from @klass's copied method would end up
|
201
|
+
# calling the original class's superclass's method.
|
202
|
+
#
|
203
|
+
# With the commit below, available starting in 2.3.0, ruby changed
|
204
|
+
# this behavior and a call to 'super' from the method copied to @klass
|
205
|
+
# will call @klass's superclass method, which is the original
|
206
|
+
# implementer of this method! This leads to very strange errors
|
207
|
+
# if @klass's copied method calls 'super', since it would end up
|
208
|
+
# calling itself, the original method implemented in @klass's
|
209
|
+
# superclass.
|
210
|
+
#
|
211
|
+
# For ruby 2.3 and above, we need to only restore methods that
|
212
|
+
# @klass originally owned.
|
213
|
+
#
|
214
|
+
# https://github.com/ruby/ruby/commit/c8854d2ca4be9ee6946e6d17b0e17d9ef130ee81
|
215
|
+
if RUBY_VERSION < "2.3" || backed_up_method_owner[method_name.to_sym] == self
|
216
|
+
alias_method method_name, alias_method_name
|
217
|
+
end
|
197
218
|
remove_method alias_method_name
|
198
219
|
end
|
199
220
|
end
|
@@ -85,17 +85,25 @@ module RSpec
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def self.method_visibility_for(object, method_name)
|
88
|
-
instance_method_visibility_for(class << object; self; end, method_name)
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
88
|
+
vis = instance_method_visibility_for(class << object; self; end, method_name)
|
89
|
+
|
90
|
+
# If the method is not defined on the class, `instance_method_visibility_for`
|
91
|
+
# returns `nil`. However, it may be handled dynamically by `method_missing`,
|
92
|
+
# so here we check `respond_to` (passing false to not check private methods).
|
93
|
+
#
|
94
|
+
# This only considers the public case, but I don't think it's possible to
|
95
|
+
# write `method_missing` in such a way that it handles a dynamic message
|
96
|
+
# with private or protected visibility. Ruby doesn't provide you with
|
97
|
+
# the caller info.
|
98
|
+
return vis unless vis.nil?
|
99
|
+
|
100
|
+
proxy = RSpec::Mocks.space.proxy_for(object)
|
101
|
+
respond_to = proxy.method_double_if_exists_for_message(:respond_to?)
|
102
|
+
|
103
|
+
visible = respond_to && respond_to.original_method.call(method_name) ||
|
104
|
+
object.respond_to?(method_name)
|
105
|
+
|
106
|
+
return :public if visible
|
99
107
|
end
|
100
108
|
end
|
101
109
|
|
data/lib/rspec/mocks/proxy.rb
CHANGED
data/lib/rspec/mocks/targets.rb
CHANGED
data/lib/rspec/mocks/version.rb
CHANGED
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.
|
4
|
+
version: 3.5.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Baker
|
@@ -45,22 +45,22 @@ cert_chain:
|
|
45
45
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
46
46
|
F3MdtaDehhjC
|
47
47
|
-----END CERTIFICATE-----
|
48
|
-
date: 2016-
|
48
|
+
date: 2016-02-06 00:00:00.000000000 Z
|
49
49
|
dependencies:
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: rspec-support
|
52
52
|
requirement: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - '='
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 3.
|
56
|
+
version: 3.5.0.beta1
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - '='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 3.
|
63
|
+
version: 3.5.0.beta1
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: diff-lcs
|
66
66
|
requirement: !ruby/object:Gem::Requirement
|
@@ -204,14 +204,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
204
|
version: 1.8.7
|
205
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
206
|
requirements:
|
207
|
-
- - "
|
207
|
+
- - ">"
|
208
208
|
- !ruby/object:Gem::Version
|
209
|
-
version:
|
209
|
+
version: 1.3.1
|
210
210
|
requirements: []
|
211
211
|
rubyforge_project:
|
212
|
-
rubygems_version: 2.
|
212
|
+
rubygems_version: 2.4.5.1
|
213
213
|
signing_key:
|
214
214
|
specification_version: 4
|
215
|
-
summary: rspec-mocks-3.
|
215
|
+
summary: rspec-mocks-3.5.0.beta1
|
216
216
|
test_files: []
|
217
217
|
has_rdoc:
|
metadata.gz.sig
CHANGED
Binary file
|