muack 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGES.md +28 -1
- data/lib/muack/spy.rb +2 -2
- data/lib/muack/version.rb +1 -1
- data/muack.gemspec +3 -3
- data/test/test_stub.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46ee22af9472ac4c12baeb58afee2b979d6b80d0
|
4
|
+
data.tar.gz: f155f3f23684f6fdceb3a6e5bc922cebbd151d0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d27fc18f9ef192c19167432c73ca93191af1f747bfe59731eb8621709925da4ae3f33549ad9b493e0627f4d061581cd7fc1b6d818af6f4c93cd09bcd9bf60267
|
7
|
+
data.tar.gz: 161f8b4a87addc0d0841fcfe6e3a6ad71becb17ff0b2f2e535e0c7e856051225e71f363950c81bae9ee78f9de8a4baa38150312b4ac15ceb23aa60c231bcbff8
|
data/.travis.yml
CHANGED
data/CHANGES.md
CHANGED
@@ -1,5 +1,32 @@
|
|
1
1
|
# CHANGES
|
2
2
|
|
3
|
+
## Muack 1.1.1 -- 2014-05-21
|
4
|
+
|
5
|
+
It's no longer necessary to make spy the last call. Below now works:
|
6
|
+
|
7
|
+
``` ruby
|
8
|
+
obj = Object.new
|
9
|
+
stub(obj).say{}
|
10
|
+
2.times do
|
11
|
+
obj.say
|
12
|
+
spy(obj).say
|
13
|
+
end
|
14
|
+
```
|
15
|
+
|
16
|
+
Previously, only this works:
|
17
|
+
|
18
|
+
``` ruby
|
19
|
+
obj = Object.new
|
20
|
+
stub(obj).say{}
|
21
|
+
2.times{ obj.say }
|
22
|
+
2.times{ spy(obj).say }
|
23
|
+
```
|
24
|
+
|
25
|
+
This would be very useful when using Muack with [RubyQC][], in which cases
|
26
|
+
we don't know how many times the spied object would be called.
|
27
|
+
|
28
|
+
[RubyQC]: https://github.com/godfat/rubyqc
|
29
|
+
|
3
30
|
## Muack 1.1.0 -- 2014-04-17
|
4
31
|
|
5
32
|
Improvements:
|
@@ -11,7 +38,7 @@ Incompatible changes:
|
|
11
38
|
|
12
39
|
* Previously, if you're using a spy, it would examine all the messages for
|
13
40
|
the given stub. However this might not be desired as then we need to
|
14
|
-
specify everything in the stub for the
|
41
|
+
specify everything in the stub for the spy. Tedious. From now on, spies
|
15
42
|
would only examine specified messages, ignoring unspecified stubbed
|
16
43
|
methods. This sort of breaks the concept that "mocks = stubs + spies"
|
17
44
|
as spies would not fully examine the stubs now. It's now more like:
|
data/lib/muack/spy.rb
CHANGED
@@ -5,12 +5,12 @@ module Muack
|
|
5
5
|
class Spy < Mock
|
6
6
|
def initialize stub
|
7
7
|
super(stub.object)
|
8
|
-
@
|
8
|
+
@stub = stub
|
9
9
|
end
|
10
10
|
|
11
11
|
# used for Muack::Session#verify
|
12
12
|
def __mock_verify
|
13
|
-
@
|
13
|
+
@stub.__mock_disps.values.flatten.each do |defi|
|
14
14
|
__mock_dispatch(defi.msg, defi.args) if __mock_defis.key?(defi.msg)
|
15
15
|
end
|
16
16
|
super # simulate dispatching before passing to mock to verify
|
data/lib/muack/version.rb
CHANGED
data/muack.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: muack 1.1.
|
2
|
+
# stub: muack 1.1.1 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "muack"
|
6
|
-
s.version = "1.1.
|
6
|
+
s.version = "1.1.1"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Lin Jen-Shin (godfat)"]
|
11
|
-
s.date = "2014-
|
11
|
+
s.date = "2014-05-21"
|
12
12
|
s.description = "Muack -- A fast, small, yet powerful mocking library.\n\nInspired by [RR][], and it's 32x times faster (750s vs 23s) than RR\nfor running [Rib][] tests.\n\n[RR]: https://github.com/rr/rr\n[Rib]: https://github.com/godfat/rib"
|
13
13
|
s.email = ["godfat (XD) godfat.org"]
|
14
14
|
s.files = [
|
data/test/test_stub.rb
CHANGED
@@ -62,6 +62,14 @@ describe Muack::Stub do
|
|
62
62
|
2.times{ spy(Obj).say }
|
63
63
|
end
|
64
64
|
|
65
|
+
should 'work with call spy and call spy' do
|
66
|
+
stub(Obj).say{}
|
67
|
+
2.times do
|
68
|
+
Obj.say.should.eq nil
|
69
|
+
spy(Obj).say
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
65
73
|
should 'verify spy arguments' do
|
66
74
|
stub(Obj).say(1){|a|a}
|
67
75
|
Obj.say(1).should.eq 1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lin Jen-Shin (godfat)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Muack -- A fast, small, yet powerful mocking library.
|