muack 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -1
- data/README.md +1 -1
- data/lib/muack/mock.rb +1 -1
- data/lib/muack/test.rb +3 -0
- data/lib/muack/version.rb +1 -1
- data/muack.gemspec +3 -3
- data/test/test_mock.rb +5 -0
- data/test/test_proxy.rb +15 -1
- 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: b510879670f4d28a7439923c7e5a2c8710ef6973
|
4
|
+
data.tar.gz: 2aa9e4cff5879f785bd67683c5f97cdb16acf2a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdf80091cc5687f7c086fb7928647c25696fa93c2d8758610fc7d043af6a360a7cb4df38e7bfb642f568536ac7a4ab28d3fcbaf6348ee7c8d917b89584e903cf
|
7
|
+
data.tar.gz: 604f04f66082275081659575f002146f48ac817fb262ef408d12473689452c69963328e4cc52ccf33fd23df995dea213c270c42348cb29a5f90f21662b2b00c9
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -1008,7 +1008,7 @@ verifiers details.
|
|
1008
1008
|
|
1009
1009
|
Apache License 2.0
|
1010
1010
|
|
1011
|
-
Copyright (c) 2013
|
1011
|
+
Copyright (c) 2013-2014, Lin Jen-Shin (godfat)
|
1012
1012
|
|
1013
1013
|
Licensed under the Apache License, Version 2.0 (the "License");
|
1014
1014
|
you may not use this file except in compliance with the License.
|
data/lib/muack/mock.rb
CHANGED
@@ -89,7 +89,7 @@ module Muack
|
|
89
89
|
else # proxies for instance methods
|
90
90
|
# need the original context for calling `super`
|
91
91
|
# ruby: can't pass a block to yield, so we name it _yield
|
92
|
-
_yield.call(
|
92
|
+
_yield.call(args, &actual_block)
|
93
93
|
end
|
94
94
|
|
95
95
|
if disp.peek_return
|
data/lib/muack/test.rb
CHANGED
data/lib/muack/version.rb
CHANGED
data/muack.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: muack 1.0.
|
2
|
+
# stub: muack 1.0.1 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "muack"
|
6
|
-
s.version = "1.0.
|
6
|
+
s.version = "1.0.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-01-
|
11
|
+
s.date = "2014-01-07"
|
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_mock.rb
CHANGED
@@ -27,6 +27,11 @@ describe Muack::Mock do
|
|
27
27
|
Obj.say{ |msg| msg }.should.eq 'Hi'
|
28
28
|
end
|
29
29
|
|
30
|
+
should 'pass multiple arguments' do
|
31
|
+
mock(Obj).say{ |*args| args.reverse }.with_any_args
|
32
|
+
Obj.say(0, 1).should.eq [1, 0]
|
33
|
+
end
|
34
|
+
|
30
35
|
should 'mock private method and preserve privacy' do
|
31
36
|
mock(Obj).private{ 'sai' }
|
32
37
|
Obj.respond_to?(:private ).should.eq false
|
data/test/test_proxy.rb
CHANGED
@@ -28,17 +28,31 @@ describe Muack::Mock do
|
|
28
28
|
2.times{ Str.class.should.eq String }
|
29
29
|
end
|
30
30
|
|
31
|
+
should 'proxy with super method for multiple arguments' do
|
32
|
+
args = %w[o u]
|
33
|
+
mock(Str).tr(*args)
|
34
|
+
Str.tr(*args).should.eq 'Muu'
|
35
|
+
end
|
36
|
+
|
31
37
|
should 'return modifier itself for any modifier methods' do
|
32
38
|
mock(Str).to_s.peek_return{ |s| s.reverse }.times(2).
|
33
39
|
with_any_args.with_any_args
|
34
40
|
2.times{ Str.to_s.should.eq 'ooM' }
|
35
41
|
end
|
36
42
|
|
37
|
-
should 'proxy and call the
|
43
|
+
should 'proxy and call the original method' do
|
38
44
|
mock(Obj).method_missing(:inspect).peek_return{ |str| str.reverse }
|
39
45
|
Obj.inspect.should.eq 'jbo'
|
40
46
|
end
|
41
47
|
|
48
|
+
should 'proxy and call the original method for multiple arguments' do
|
49
|
+
args = %w[o u]
|
50
|
+
mock(Obj).aloha(*args)
|
51
|
+
mock(Obj).aloha
|
52
|
+
Obj.aloha(*args).should.eq args
|
53
|
+
Obj.aloha.should.eq [0, 1]
|
54
|
+
end
|
55
|
+
|
42
56
|
should 'proxy and call the block with super' do
|
43
57
|
mock(Str).class.peek_return{ |k| k.name.reverse }
|
44
58
|
Str.class.should.eq 'gnirtS'
|
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.0.
|
4
|
+
version: 1.0.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-01-
|
11
|
+
date: 2014-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Muack -- A fast, small, yet powerful mocking library.
|