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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23619481e2ad1d312e8b023d3643e777b11a0532
4
- data.tar.gz: 182baa8926b5b645f4522f8d4bb03ab32e83c52d
3
+ metadata.gz: af70a254e2da3b9b4e1c876f9487a597ddf3f897
4
+ data.tar.gz: b5ae8e833a730c0547f9d4d3b3b10b2b8beb9732
5
5
  SHA512:
6
- metadata.gz: d07419f23b7fd2535e7392bea7df9e744b1e4a1cbf6511bf6ec881e76d4d0d87a5a71e3a4012cc8c54f5dcb30f063196c8bd1cad51ccb5cb97fa3c5a00b9b2a6
7
- data.tar.gz: 3e25a12d67d1533e56836690440badcf0734f78a11d7ab310db4830df3a501d0040ba50e9538620337db3b51e183a5b29ac6a6ae574e3615c173a8aafa13b805
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
- require "#{dir = File.dirname(__FILE__)}/task/gemgem"
3
- Gemgem.dir = dir
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 expected_defi = defis.find{ |d| d.args == actual_args }
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, expected_defi, defis.size, defis.size+1))
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
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Muack
3
- VERSION = '0.7.1'
3
+ VERSION = '0.7.2'
4
4
  end
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.1"
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-07-13"
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.5"
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.1
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-07-13 00:00:00.000000000 Z
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.5
77
+ rubygems_version: 2.0.6
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Muack -- Yet another mocking library.