muack 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bdc0fed7c77d1ef5a925dc20e54857bc2bf279b
4
- data.tar.gz: f5be7c8560523fe958c91683d6401e0cfc52f9de
3
+ metadata.gz: 44cee556b89d8eb6f0b0cf73e9082a41c24f0c07
4
+ data.tar.gz: 3843d7a99fd975384d3faccce6b4235ce3d273f3
5
5
  SHA512:
6
- metadata.gz: d32c303896f89c12a83a84602e1190062c53d89cb12e10aaff8fb05dc5382d98f82b9e2c8a9a5ae53fee6a284ecdf4bb7b96e10034b33347bce227a071eabbb1
7
- data.tar.gz: 3d028e15246b9c8bdd79ab39accfcfb55ec68d5997c502744510a3093a75e8d4e4fa05da936c091fb32cd43dc0429e88cd2841157285fb08dbd3fe2da6d6b1fa
6
+ metadata.gz: 5a50371ce353f2063dcbf323e3089b51a8c3e45bb1dd0b1b14882dd0849b4d499e5c61a6dc64ac7a4db9ecd84a11085db9ad95507633fcdaac029fd9b5551611
7
+ data.tar.gz: b21dbd44169cea461871d4d67ddc9cdb7fecf0b41378b118046b82093e5690165da8c69f907f20d602da8d935c7e50b06896c92ae4149faeb9f641ba6e4000a5
data/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGES
2
2
 
3
+ ## Muack 1.3.1 -- 2015-05-27
4
+
5
+ * Fixed a bug for `where`, `having`, and `allowing` which would raise an
6
+ exception whenever the actual value is not a hash or array.
7
+
3
8
  ## Muack 1.3.0 -- 2015-05-24
4
9
 
5
10
  ### Incompatible changes
@@ -123,9 +123,9 @@ module Muack
123
123
  def match actual_arg, spec=api_args.first
124
124
  case spec
125
125
  when Hash
126
- match_hash(actual_arg, spec)
126
+ actual_arg.kind_of?(Hash) && match_hash(actual_arg, spec)
127
127
  when Array
128
- match_array(actual_arg, spec)
128
+ actual_arg.kind_of?(Array) && match_array(actual_arg, spec)
129
129
  else
130
130
  raise UnknownSpec.new(spec)
131
131
  end
@@ -149,9 +149,9 @@ module Muack
149
149
  when Satisfying
150
150
  ev.match(av)
151
151
  when Hash
152
- match_hash(av, ev)
152
+ av.kind_of?(Hash) && match_hash(av, ev)
153
153
  when Array
154
- match_array(av, ev)
154
+ av.kind_of?(Array) && match_array(av, ev)
155
155
  else
156
156
  ev == av
157
157
  end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Muack
3
- VERSION = '1.3.0'
3
+ VERSION = '1.3.1'
4
4
  end
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: muack 1.3.0 ruby lib
2
+ # stub: muack 1.3.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "muack"
6
- s.version = "1.3.0"
6
+ s.version = "1.3.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 = "2015-05-24"
11
+ s.date = "2015-05-27"
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 = [
@@ -215,6 +215,20 @@ describe Muack::Satisfying do
215
215
  e.was .should.eq 'obj.say({:a=>0, :b=>1, :c=>2})'
216
216
  e.message .should.eq "\nExpected: #{e.expected}\n but was: #{e.was}"
217
217
  end
218
+
219
+ would 'recurse' do
220
+ mock(Obj).say(where(:a =>
221
+ having(:b =>
222
+ allowing(:c => [is_a(Fixnum)])))){ 'boo' }
223
+ e = should.raise(Muack::Unexpected){Obj.say(:a => 0)}
224
+ e.expected.should.eq \
225
+ 'obj.say(Muack::API.where({:a=>' \
226
+ 'Muack::API.having({:b=>' \
227
+ 'Muack::API.allowing({:c=>' \
228
+ '[Muack::API.is_a(Fixnum)]})})}))'
229
+ e.was .should.eq 'obj.say({:a=>0})'
230
+ e.message .should.eq "\nExpected: #{e.expected}\n but was: #{e.was}"
231
+ end
218
232
  end
219
233
 
220
234
  describe Muack::Having do
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.3.0
4
+ version: 1.3.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: 2015-05-24 00:00:00.000000000 Z
11
+ date: 2015-05-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  Muack -- A fast, small, yet powerful mocking library.