spy_rb 3.0.1 → 3.1.0

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
  SHA1:
3
- metadata.gz: d247b447012a78c5b4bbe55b9d110a533b1c4d60
4
- data.tar.gz: 4d269fc360686ff2c0f6562db3580ffa7bcc70cc
3
+ metadata.gz: 7a5b66b4ba30415a795bfb54ad2d6913618e92a1
4
+ data.tar.gz: 857e278a71757b8d2423017b529b09297985f52c
5
5
  SHA512:
6
- metadata.gz: 189fad81e202e567b8f71199e40bfcbc11e796a8c5107cc180ca9c502b869b467fa88f04fbbdc2636cc7c6decc61fd579107e3d39a0f32151bcbd6299633713e
7
- data.tar.gz: 7b0a329157d8190a168a513ad7cc0f5d35116f9940df9c94d93cc6a01659fab5e6a6c9429335b882aeb098b6ad864388757b9693899f1986d31e850175febdbc
6
+ metadata.gz: 2082d105d28146a818793ce81aba85f65d8ec073cdc4da56c73a745f15904db7b7a0d1299cd91ebce6348592590de813b56e02303e41cc9640bb5c5674929f1e
7
+ data.tar.gz: 3bb2dae86c59e31517856daa58b16b2a01458c3c65ee43d6b25168747d1670ed1728e0a0f0bdc4c285a6d11ca8a003c5af923488c1dc8be9e5fe93f694aeb127
data/lib/spy/core.rb CHANGED
@@ -24,7 +24,7 @@ module Spy
24
24
  # being spied on
25
25
  def add_spy(blueprint)
26
26
  if prev = @registry.get(blueprint)
27
- raise Errors::AlreadySpiedError.new("Already spied on here:\n\t#{prev[0].caller.join("\n\t")}")
27
+ raise Errors::AlreadySpiedError.new("Already spied on #{blueprint} here:\n\t#{prev[0].caller.join("\n\t")}")
28
28
  end
29
29
  spy = Instance.new(blueprint)
30
30
  @registry.insert(blueprint, spy)
@@ -9,7 +9,7 @@ module Spy
9
9
  @receiver = receiver
10
10
  @args = args
11
11
  @caller = method_caller
12
- @block = proc { receiver.instance_eval(&Proc.new) } if block_given?
12
+ @block = Proc.new if block_given?
13
13
  end
14
14
 
15
15
  def replay
data/lib/spy/multi.rb CHANGED
@@ -14,6 +14,10 @@ module Spy
14
14
  @spies.find { |spy| spy.name == name }
15
15
  end
16
16
 
17
+ def called
18
+ @spies.select { |spy| spy.call_count > 0 }
19
+ end
20
+
17
21
  def uncalled
18
22
  @spies.select { |spy| spy.call_count == 0 }
19
23
  end
data/lib/spy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Spy
2
- VERSION = '3.0.1'
2
+ VERSION = '3.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spy_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Bodah
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-14 00:00:00.000000000 Z
11
+ date: 2018-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake