adequack 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +5 -1
- data/lib/adequack/core.rb +2 -2
- data/lib/adequack/proxy.rb +12 -3
- data/lib/adequack/version.rb +1 -1
- data/spec/adequack_spec.rb +6 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70f0291eb7ccd7aa8818463326c4a68c69bfc99b
|
4
|
+
data.tar.gz: caf67d45f2aa6efea859b1b8a89b5768417b8870
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68d9434369d6c2a5866eb0dee4b535917fc12d3914a3bc4e03f88ae419e63f255e0d4add303c56cd30b8342685ffbe94af8eb87ab1176e44992e9c75c8130185
|
7
|
+
data.tar.gz: b6c93a4e560827abb4124db0065bfafcac9723c24d2d39c862c1026507ecc0b745a867f32ab9af11beade861a6ca5c2f717d4366242fa9a4a6a71a2cedc95b2b
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Adequack
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/adequack.png)](http://badge.fury.io/rb/adequack)
|
4
|
+
[![Build Status](https://travis-ci.org/Somebody32/adequack.png?branch=master)](https://travis-ci.org/Somebody32/adequack)
|
5
|
+
[![Dependency Status](https://gemnasium.com/Somebody32/adequack.png)](https://gemnasium.com/Somebody32/adequack)
|
6
|
+
|
7
|
+
Everyone likes isolation testing. And when you do it then you stubbing and mocking a lot.
|
4
8
|
But the main concern when you use this approach is that you stubs will be out of sync with the
|
5
9
|
real objects.
|
6
10
|
Adequack addresses this issue.
|
data/lib/adequack/core.rb
CHANGED
@@ -13,7 +13,7 @@ module Adequack
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def validate_ducktype
|
16
|
-
check_method_implementation(get_methods interface.public_methods
|
16
|
+
check_method_implementation(get_methods interface.public_methods)
|
17
17
|
check_method_implementation(
|
18
18
|
get_methods(interface.public_instance_methods), true
|
19
19
|
)
|
@@ -40,4 +40,4 @@ module Adequack
|
|
40
40
|
methods - Object.methods
|
41
41
|
end
|
42
42
|
end
|
43
|
-
end
|
43
|
+
end
|
data/lib/adequack/proxy.rb
CHANGED
@@ -76,10 +76,19 @@ module Adequack
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def duck_type_methods
|
79
|
-
@duck_type_methods ||=
|
80
|
-
|
81
|
-
|
79
|
+
@duck_type_methods ||= get_methods
|
80
|
+
end
|
81
|
+
|
82
|
+
def get_methods
|
83
|
+
cm = interface.methods.map do |m|
|
84
|
+
interface.public_method(m)
|
82
85
|
end
|
86
|
+
|
87
|
+
im = interface.instance_methods.map do |m|
|
88
|
+
interface.public_instance_method(m)
|
89
|
+
end
|
90
|
+
|
91
|
+
cm + im
|
83
92
|
end
|
84
93
|
end
|
85
94
|
end
|
data/lib/adequack/version.rb
CHANGED
data/spec/adequack_spec.rb
CHANGED
@@ -125,5 +125,11 @@ describe Adequack do
|
|
125
125
|
}.to raise_error Adequack::InterfaceImplementationError,
|
126
126
|
"definition of method 'bark' differs in parameters accepted."
|
127
127
|
end
|
128
|
+
|
129
|
+
it "works with class method defs too" do
|
130
|
+
d = Adequack.double Class.new, interface
|
131
|
+
d.should_receive(:evolutionize)
|
132
|
+
d.evolutionize
|
133
|
+
end
|
128
134
|
end
|
129
135
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adequack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Zayats
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -61,6 +61,7 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- .gitignore
|
63
63
|
- .rspec
|
64
|
+
- CHANGELOG.md
|
64
65
|
- Gemfile
|
65
66
|
- LICENSE.txt
|
66
67
|
- README.md
|