muack 0.7.1 → 0.7.2
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 -0
- data/README.md +0 -9
- data/Rakefile +7 -2
- data/lib/muack/mock.rb +2 -2
- data/lib/muack/version.rb +1 -1
- data/muack.gemspec +3 -3
- data/test/test_mock.rb +16 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af70a254e2da3b9b4e1c876f9487a597ddf3f897
|
4
|
+
data.tar.gz: b5ae8e833a730c0547f9d4d3b3b10b2b8beb9732
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94b296d5a7026b2702cf247ba45fbcacb9e5bf8ee107247100d39b5c1c8ae1458bf8c8d7695ffd123006a4200425ef45d33bcd9ae03ce0846a8573b422f22ee7
|
7
|
+
data.tar.gz: 79191de263d9aab1a4f23927c0d7e13dd3a1b58e1cfa6668b22c07f2d22874e29adf048c340e7ca73377e3975f3a70118625d1208fc6e1f43375adc9887ac46a
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# CHANGES
|
2
2
|
|
3
|
+
## Muack 0.7.2 -- 2013-08-23
|
4
|
+
|
5
|
+
* Show correct Expected error for special satisfiers. Previously, it would
|
6
|
+
incorrectly showing Unexpected error. However it's considered expected,
|
7
|
+
it's simply the number of times is wrong.
|
8
|
+
|
3
9
|
## Muack 0.7.1 -- 2013-07-13
|
4
10
|
|
5
11
|
* Added `respond_to` argument matcher corresponding to RR's duck_type.
|
data/README.md
CHANGED
@@ -469,15 +469,6 @@ mock(object).foobar(is_a(TrueClass) | is_a(FalseClass))
|
|
469
469
|
object.foobar(false)
|
470
470
|
```
|
471
471
|
|
472
|
-
Or simply pass a custom satisfy block for it.
|
473
|
-
Though there's not much point here. Just want to demonstrate.
|
474
|
-
|
475
|
-
``` ruby
|
476
|
-
mock(object).foobar(
|
477
|
-
satisfy{ |a| a.kind_of?(TrueClass) || a.kind_of?(FalseClass) })
|
478
|
-
object.foobar(false)
|
479
|
-
```
|
480
|
-
|
481
472
|
Since duck_type is a weird name to me. Here we use `respond_to(:walk, :talk)`.
|
482
473
|
|
483
474
|
``` ruby
|
data/Rakefile
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
2
|
+
begin
|
3
|
+
require "#{dir = File.dirname(__FILE__)}/task/gemgem"
|
4
|
+
rescue LoadError
|
5
|
+
sh 'git submodule update --init'
|
6
|
+
exec Gem.ruby, '-S', 'rake', *ARGV
|
7
|
+
end
|
4
8
|
|
9
|
+
Gemgem.dir = dir
|
5
10
|
($LOAD_PATH << File.expand_path("#{Gemgem.dir}/lib")).uniq!
|
6
11
|
|
7
12
|
desc 'Generate gemspec'
|
data/lib/muack/mock.rb
CHANGED
@@ -59,9 +59,9 @@ module Muack
|
|
59
59
|
end
|
60
60
|
else
|
61
61
|
defis = __mock_disps[msg]
|
62
|
-
if
|
62
|
+
if expected = defis.find{ |d| __mock_check_args(d.args, actual_args) }
|
63
63
|
Mock.__send__(:raise, # Too many times
|
64
|
-
Expected.new(object,
|
64
|
+
Expected.new(object, expected, defis.size, defis.size+1))
|
65
65
|
else
|
66
66
|
Mock.__send__(:raise, # Wrong argument
|
67
67
|
Unexpected.new(object, defis, msg, actual_args))
|
data/lib/muack/version.rb
CHANGED
data/muack.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "muack"
|
5
|
-
s.version = "0.7.
|
5
|
+
s.version = "0.7.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Lin Jen-Shin (godfat)"]
|
9
|
-
s.date = "2013-
|
9
|
+
s.date = "2013-08-23"
|
10
10
|
s.description = "Muack -- Yet another mocking library.\n\nBasically it's an [RR][] clone, but much faster under heavy use.\nIt's 32x times faster (750s vs 23s) for running [Rib][] tests.\n\n[RR]: https://github.com/rr/rr\n[Rib]: https://github.com/godfat/rib"
|
11
11
|
s.email = ["godfat (XD) godfat.org"]
|
12
12
|
s.files = [
|
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
|
|
43
43
|
s.homepage = "https://github.com/godfat/muack"
|
44
44
|
s.licenses = ["Apache License 2.0"]
|
45
45
|
s.require_paths = ["lib"]
|
46
|
-
s.rubygems_version = "2.0.
|
46
|
+
s.rubygems_version = "2.0.6"
|
47
47
|
s.summary = "Muack -- Yet another mocking library."
|
48
48
|
s.test_files = [
|
49
49
|
"test/test_any_instance_of.rb",
|
data/test/test_mock.rb
CHANGED
@@ -120,6 +120,22 @@ describe Muack::Mock do
|
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
+
should 'have correct message for mocks with special satisfier' do
|
124
|
+
mock(Obj).say(anything)
|
125
|
+
begin
|
126
|
+
Obj.say(1)
|
127
|
+
Obj.say(2)
|
128
|
+
'never'.should.eq 'reach'
|
129
|
+
rescue Muack::Expected => e
|
130
|
+
expected = 'obj.say(Muack::API.anything())'
|
131
|
+
e.expected.should.eq expected
|
132
|
+
e.expected_times.should.eq 1
|
133
|
+
e.actual_times .should.eq 2
|
134
|
+
e.message .should.eq "\nExpected: #{expected}\n " \
|
135
|
+
"called 1 times\n but was 2 times."
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
123
139
|
should 'raise if a mock with times(0) gets called' do
|
124
140
|
mock(Obj).say.times(0)
|
125
141
|
begin
|
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: 0.7.
|
4
|
+
version: 0.7.2
|
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: 2013-
|
11
|
+
date: 2013-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Muack -- Yet another mocking library.
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
76
|
rubyforge_project:
|
77
|
-
rubygems_version: 2.0.
|
77
|
+
rubygems_version: 2.0.6
|
78
78
|
signing_key:
|
79
79
|
specification_version: 4
|
80
80
|
summary: Muack -- Yet another mocking library.
|