quacky 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -11,8 +11,13 @@ module Quacky
11
11
  raise Quacky::DuckTypeVerificationFailure, "object does not respond to `#{method.name}'" unless object.respond_to?(method.name)
12
12
 
13
13
  target_method = object.public_method(method.name)
14
- if target_method.parameters.count != method.parameters.count ||
15
- target_method.parameters.map {|p| p.first } != method.parameters.map {|p| p.first}
14
+ return true if target_method.parameters.any? { |p| p.first == :rest }
15
+
16
+ method_parameters = method.parameters.reject { |p| p.first == :block }
17
+ target_method_parameters = target_method.parameters.reject { |p| p.first == :block }
18
+
19
+ if target_method_parameters.count != method_parameters.count ||
20
+ target_method_parameters.map {|p| p.first } != method_parameters.map {|p| p.first}
16
21
  raise Quacky::DuckTypeVerificationFailure, "definitions of method `#{method.name}` differ in parameters accepted."
17
22
  end
18
23
 
@@ -51,5 +51,29 @@ describe Quacky::DuckTypeVerifier do
51
51
  expect { verifier.verify! conforming_object }.not_to raise_exception Quacky::DuckTypeVerificationFailure
52
52
  end
53
53
  end
54
+
55
+ context "given a method that accepts any number of arguments" do
56
+ let(:conforming_object) do
57
+ Class.new do
58
+ def quack *args; end
59
+ end.new
60
+ end
61
+
62
+ it "should return true" do
63
+ expect { verifier.verify! conforming_object }.not_to raise_exception Quacky::DuckTypeVerificationFailure
64
+ end
65
+ end
66
+
67
+ context "given a method that accepts a named block" do
68
+ let(:conforming_object) do
69
+ Class.new do
70
+ def quack arg1,arg2,arg3=nil,█ end
71
+ end.new
72
+ end
73
+
74
+ it "should return true" do
75
+ expect { verifier.verify! conforming_object }.not_to raise_exception Quacky::DuckTypeVerificationFailure
76
+ end
77
+ end
54
78
  end
55
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quacky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-28 00:00:00.000000000 Z
12
+ date: 2012-09-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70335152016460 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 3.2.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70335152016460
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.5
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rspec
27
- requirement: &70335152014440 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70335152014440
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: cucumber
38
- requirement: &70335152013140 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70335152013140
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: specdown
49
- requirement: &70335152008340 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '0'
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *70335152008340
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: rake
60
- requirement: &70335152007040 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,7 +85,12 @@ dependencies:
65
85
  version: '0'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *70335152007040
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  description:
70
95
  email: moonmaster9000@gmail.com
71
96
  executables: []
@@ -110,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
135
  version: '0'
111
136
  requirements: []
112
137
  rubyforge_project:
113
- rubygems_version: 1.8.17
138
+ rubygems_version: 1.8.24
114
139
  signing_key:
115
140
  specification_version: 3
116
141
  summary: Ensure your test doubles quack like the real thing.
@@ -122,3 +147,4 @@ test_files:
122
147
  - spec/lib/quacky_spec.rb
123
148
  - spec/lib/stub_spec.rb
124
149
  - spec/spec_helper.rb
150
+ has_rdoc: