spy_rb 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spy/instance/api/internal.rb +8 -4
- data/lib/spy/instance.rb +5 -0
- data/lib/spy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fc7717987d2a804c55203a19a3a665d33f96f58
|
4
|
+
data.tar.gz: 517c1723f922c931ff5e745694b491b289798a7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75da4d827d5b93e47dfe145321f17d8c8a41fca8f550477e9e3d10c7922c7a7567dcce3a7da3c645a322584079ad810b699d4e9b5ad35aa28505d0af40f4b8fe
|
7
|
+
data.tar.gz: e91d8363fff8c5675af653b778d47447da235db493d6325d1d19fec06b0c4f8e4e8447910bcfc5ad2dd26052a8bce6c9743c9de88f7afd660f00cc93fdb367ad
|
@@ -80,11 +80,15 @@ module Spy
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def call_and_record(receiver, args, opts = {}, &block)
|
83
|
-
|
84
|
-
|
83
|
+
if @instead
|
84
|
+
@instead.call build_method_call(receiver, *args, &block)
|
85
|
+
else
|
86
|
+
record = opts[:record] || build_method_call(receiver, *args, &block)
|
87
|
+
@call_history << record
|
85
88
|
|
86
|
-
|
87
|
-
|
89
|
+
result = call_original(receiver, *args, &block)
|
90
|
+
record.result = result
|
91
|
+
end
|
88
92
|
end
|
89
93
|
|
90
94
|
def call_original(receiver, *args, &block)
|
data/lib/spy/instance.rb
CHANGED
@@ -21,6 +21,7 @@ module Spy
|
|
21
21
|
@around_procs = []
|
22
22
|
@call_history = []
|
23
23
|
@strategy = Strategy.factory_build(self)
|
24
|
+
@instead = nil
|
24
25
|
end
|
25
26
|
|
26
27
|
def name
|
@@ -67,6 +68,10 @@ module Spy
|
|
67
68
|
self
|
68
69
|
end
|
69
70
|
|
71
|
+
def instead(&block)
|
72
|
+
@instead = block
|
73
|
+
end
|
74
|
+
|
70
75
|
private
|
71
76
|
|
72
77
|
def extract_visibility
|
data/lib/spy/version.rb
CHANGED