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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1c224f1dd6be101ec8dada7a46d3df32f788d82
4
- data.tar.gz: cc3f213b4d737ecea14fb3492467c985dcbbe685
3
+ metadata.gz: 46ee22af9472ac4c12baeb58afee2b979d6b80d0
4
+ data.tar.gz: f155f3f23684f6fdceb3a6e5bc922cebbd151d0b
5
5
  SHA512:
6
- metadata.gz: 690163afe7968b15fde073e447d54604a20c431645fc56fd56e8fa5f52f1ea0d10bdec7e92ebb78c2b3a38c6291d79c242f49aec6744a7a2639c1abf44e52c90
7
- data.tar.gz: 9b4ff0d87fd84b0f76b17983f1e2524fa60d435b5ad48c87f593dbde6c2fc0d5dead257beac7147bad5a37def75dd567c145dc07ab9760ed2310b3ebdaf356ad
6
+ metadata.gz: d27fc18f9ef192c19167432c73ca93191af1f747bfe59731eb8621709925da4ae3f33549ad9b493e0627f4d061581cd7fc1b6d818af6f4c93cd09bcd9bf60267
7
+ data.tar.gz: 161f8b4a87addc0d0841fcfe6e3a6ad71becb17ff0b2f2e535e0c7e856051225e71f363950c81bae9ee78f9de8a4baa38150312b4ac15ceb23aa60c231bcbff8
data/.travis.yml CHANGED
@@ -5,5 +5,5 @@ rvm:
5
5
  - 1.9.3
6
6
  - 2.0.0
7
7
  - ruby
8
- - rbx
8
+ - rbx-2
9
9
  - jruby
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 say. Tedious. From now on, spies
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
- @secret = stub.__mock_disps.values.flatten # steal disps
8
+ @stub = stub
9
9
  end
10
10
 
11
11
  # used for Muack::Session#verify
12
12
  def __mock_verify
13
- @secret.each do |defi|
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
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Muack
3
- VERSION = '1.1.0'
3
+ VERSION = '1.1.1'
4
4
  end
data/muack.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: muack 1.1.0 ruby lib
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.0"
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-04-17"
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.0
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-04-17 00:00:00.000000000 Z
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.