spy 0.4.2 → 0.4.3
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 +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/spy/subroutine.rb +9 -5
- data/lib/spy/version.rb +1 -1
- data/spy.gemspec +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60daeb7dc9a4b41de1284dcc4353bcf278ddce75
|
4
|
+
data.tar.gz: 93534dcf719a49ac1907e585d6633cd561cd2546
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4177bc16ff8d22aa2236bdcfa35c79248bf73ef93117c91a75d0c7515a71d2a833304df1abf893905992f4765bf4b92c530fd7807f6421ea18ec4bead99e75a
|
7
|
+
data.tar.gz: 2d803b1a5ddac06a0f218a963cf01e0be05a9d4bb835f3ff86e7edb49e4dd22b88844ebe4ca65348e85def83ef1c125220a52ed31a9536d4a5fa8fa54f52a63e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## Spy 0.4.3 (April 14, 2016) ##
|
2
|
+
|
3
|
+
* Double performance of spy lookups (@BlakeMesdag)
|
4
|
+
|
5
|
+
## Spy 0.4.2 ##
|
6
|
+
|
7
|
+
* Support for minitest 5.1
|
8
|
+
|
9
|
+
## Spy 0.4.1 ##
|
10
|
+
|
11
|
+
* Support for minitest 5.0
|
12
|
+
|
1
13
|
## Spy 0.4.0 (May 8, 2013) ##
|
2
14
|
|
3
15
|
* Allow `Spy#have_received_with` to accept a block
|
data/lib/spy/subroutine.rb
CHANGED
@@ -222,11 +222,12 @@ module Spy
|
|
222
222
|
# this returns a lambda that calls the spy object.
|
223
223
|
# we use eval to set the spy object id as a parameter so it can be extracted
|
224
224
|
# and looked up later using `Method#parameters`
|
225
|
+
SPY_ARGS_PREFIX='__spy_args_'.freeze
|
225
226
|
def override_method
|
226
227
|
eval <<-METHOD, binding, __FILE__, __LINE__ + 1
|
227
228
|
__method_spy__ = self
|
228
|
-
lambda do
|
229
|
-
__method_spy__.invoke(self,
|
229
|
+
lambda do |*#{SPY_ARGS_PREFIX}#{self.object_id}, &block|
|
230
|
+
__method_spy__.invoke(self, #{SPY_ARGS_PREFIX}#{self.object_id}, block, caller(1)[0])
|
230
231
|
end
|
231
232
|
METHOD
|
232
233
|
end
|
@@ -364,9 +365,12 @@ module Spy
|
|
364
365
|
|
365
366
|
# @private
|
366
367
|
def get_spy_id(method)
|
367
|
-
|
368
|
-
|
369
|
-
|
368
|
+
if method.parameters[0].is_a?(Array) && method.parameters[0][1]
|
369
|
+
raw_id = method.parameters[0][1].to_s
|
370
|
+
if raw_id.start_with?(SPY_ARGS_PREFIX)
|
371
|
+
raw_id[SPY_ARGS_PREFIX.length..-1].to_i
|
372
|
+
end
|
373
|
+
end
|
370
374
|
end
|
371
375
|
end
|
372
376
|
end
|
data/lib/spy/version.rb
CHANGED
data/spy.gemspec
CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.license = 'MIT'
|
11
11
|
gem.authors = ["Ryan Ong"]
|
12
12
|
gem.email = ["ryanong@gmail.com"]
|
13
|
-
gem.
|
14
|
-
gem.
|
13
|
+
gem.summary = %q{A simple modern mocking library that uses the spy pattern and checks method's existence and arity.}
|
14
|
+
gem.description = %q{Spy is a mocking library that was made for the modern age. It supports only 1.9.3+. Spy by default will raise an error if you attempt to stub a method that doesn't exist or call the stubbed method with the wrong arity.}
|
15
15
|
gem.homepage = "https://github.com/ryanong/spy"
|
16
16
|
|
17
17
|
gem.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Ong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -94,8 +94,9 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description:
|
98
|
-
|
97
|
+
description: Spy is a mocking library that was made for the modern age. It supports
|
98
|
+
only 1.9.3+. Spy by default will raise an error if you attempt to stub a method
|
99
|
+
that doesn't exist or call the stubbed method with the wrong arity.
|
99
100
|
email:
|
100
101
|
- ryanong@gmail.com
|
101
102
|
executables: []
|
@@ -169,12 +170,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
170
|
version: '0'
|
170
171
|
requirements: []
|
171
172
|
rubyforge_project:
|
172
|
-
rubygems_version: 2.
|
173
|
+
rubygems_version: 2.6.1
|
173
174
|
signing_key:
|
174
175
|
specification_version: 4
|
175
|
-
summary:
|
176
|
-
|
177
|
-
doesn't exist or call the stubbed method with the wrong arity.
|
176
|
+
summary: A simple modern mocking library that uses the spy pattern and checks method's
|
177
|
+
existence and arity.
|
178
178
|
test_files:
|
179
179
|
- spec/spec_helper.rb
|
180
180
|
- spec/spy/and_call_original_spec.rb
|