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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbb0455780531e5a3b3dc2519ba3fa1179f65866
4
- data.tar.gz: 91445ca9d049d32bfb110566e4403883158071e5
3
+ metadata.gz: b510879670f4d28a7439923c7e5a2c8710ef6973
4
+ data.tar.gz: 2aa9e4cff5879f785bd67683c5f97cdb16acf2a5
5
5
  SHA512:
6
- metadata.gz: 9e02fc19cb16d91758b6122e2e704ea81ff298e7766806e1bf08a29be6daebe113635ca943ef0308ccea9cb345d60e46f1699112869b9f3c5a4883cc9c5d5cc3
7
- data.tar.gz: 5a4e374c7f7cd81f379817143b7b82939f76a918b6aac6dfc44fd452823fc6a570111a56c033f416630b93106a9b02d81808ba91e342d2a6e27f1107b1d3c66e
6
+ metadata.gz: cdf80091cc5687f7c086fb7928647c25696fa93c2d8758610fc7d043af6a360a7cb4df38e7bfb642f568536ac7a4ab28d3fcbaf6348ee7c8d917b89584e903cf
7
+ data.tar.gz: 604f04f66082275081659575f002146f48ac817fb262ef408d12473689452c69963328e4cc52ccf33fd23df995dea213c270c42348cb29a5f90f21662b2b00c9
data/CHANGES.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # CHANGES
2
2
 
3
- ## Muack 1.0.0 -- ?
3
+ ## Muack 1.0.1 -- 2014-01-07
4
+
5
+ * Fixed a regression where proxy with multiple arguments might not pass
6
+ all arguments along.
7
+
8
+ ## Muack 1.0.0 -- 2014-01-06
4
9
 
5
10
  Improvements:
6
11
 
data/README.md CHANGED
@@ -1008,7 +1008,7 @@ verifiers details.
1008
1008
 
1009
1009
  Apache License 2.0
1010
1010
 
1011
- Copyright (c) 2013~2014, Lin Jen-Shin (godfat)
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.
@@ -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(*args, &actual_block)
92
+ _yield.call(args, &actual_block)
93
93
  end
94
94
 
95
95
  if disp.peek_return
@@ -13,6 +13,9 @@ end
13
13
  def Obj.private
14
14
  'pri'
15
15
  end
16
+ def Obj.aloha a=0, b=1
17
+ [a, b]
18
+ end
16
19
  Obj.singleton_class.__send__(:private, :private)
17
20
 
18
21
  Muack::EnsureReset = lambda{
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Muack
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: muack 1.0.0 ruby lib
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.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-06"
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 = [
@@ -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
@@ -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 block' do
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.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-06 00:00:00.000000000 Z
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.