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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 357dc2f6e1a122a0443515d850273f2f83cd6329
4
- data.tar.gz: d2c91703541a64a9f43b7faa6e8737f652537c85
3
+ metadata.gz: 60daeb7dc9a4b41de1284dcc4353bcf278ddce75
4
+ data.tar.gz: 93534dcf719a49ac1907e585d6633cd561cd2546
5
5
  SHA512:
6
- metadata.gz: cdbef88ac11e15f4191e82dcecece8f068e233478a5ab4030b3d81aa4d64514df9858609c771215977ff59c188a8c6af4f5b626f7554a826b34529cf6ec0aaa5
7
- data.tar.gz: d56779624093b0268659e7b05d243885ea0e9e6319697e712f836e60ea2e5a6fbf7c5bbbf7837b3ab4e9ba7dd6d17cd845a6cad6975eac88125810e39be94937
6
+ metadata.gz: c4177bc16ff8d22aa2236bdcfa35c79248bf73ef93117c91a75d0c7515a71d2a833304df1abf893905992f4765bf4b92c530fd7807f6421ea18ec4bead99e75a
7
+ data.tar.gz: 2d803b1a5ddac06a0f218a963cf01e0be05a9d4bb835f3ff86e7edb49e4dd22b88844ebe4ca65348e85def83ef1c125220a52ed31a9536d4a5fa8fa54f52a63e
@@ -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
@@ -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 |*__spy_args_#{self.object_id}, &block|
229
- __method_spy__.invoke(self, __spy_args_#{self.object_id}, block, caller(1)[0])
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
- return nil unless method.parameters[0].is_a?(Array)
368
- id = method.parameters[0][1].to_s.sub!("__spy_args_", "")
369
- id.to_i if id
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
@@ -1,3 +1,3 @@
1
1
  module Spy
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
@@ -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.description = %q{A simple modern mocking library that uses the spy pattern and checks method's existence and arity.}
14
- gem.summary = %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.}
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.2
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: 2015-05-12 00:00:00.000000000 Z
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: A simple modern mocking library that uses the spy pattern and checks
98
- method's existence and arity.
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.4.5
173
+ rubygems_version: 2.6.1
173
174
  signing_key:
174
175
  specification_version: 4
175
- summary: Spy is a mocking library that was made for the modern age. It supports only
176
- 1.9.3+. Spy by default will raise an error if you attempt to stub a method that
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