delegation 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/test/delegation_test.rb +30 -2
- metadata +2 -2
data/test/delegation_test.rb
CHANGED
@@ -61,9 +61,37 @@ describe Delegation do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
describe Delegation::Client do
|
64
|
-
it 'adds a
|
64
|
+
it 'adds a delegation method to return a Delegation' do
|
65
65
|
client = Object.new
|
66
66
|
client.extend(Delegation::Client)
|
67
|
-
|
67
|
+
|
68
|
+
assert_instance_of Delegation, client.delegation('id')
|
69
|
+
end
|
70
|
+
it 'adds a delegate method to call a method on an attendant' do
|
71
|
+
client = TestPerson.new
|
72
|
+
client.extend(Delegation::Client)
|
73
|
+
attendant = TestPerson.new
|
74
|
+
attendant.extend(TestPerson::Greeter)
|
75
|
+
|
76
|
+
assert_equal attendant.greet, client.delegate('greet', attendant)
|
77
|
+
end
|
78
|
+
it 'passes additional parameters to the attendant' do
|
79
|
+
client = TestPerson.new
|
80
|
+
client.extend(Delegation::Client)
|
81
|
+
attendant = TestPerson.new
|
82
|
+
attendant.extend(TestPerson::Verbose)
|
83
|
+
|
84
|
+
attendant_output = attendant.verbose('hello', 'goodbye')
|
85
|
+
client_output = client.delegate('verbose', attendant, 'hello', 'goodbye')
|
86
|
+
|
87
|
+
assert_equal attendant_output, client_output
|
88
|
+
end
|
89
|
+
it 'passes the object as the client for delegation' do
|
90
|
+
client = Object.new
|
91
|
+
client.extend(Delegation::Client)
|
92
|
+
|
93
|
+
delegation = client.delegation('id')
|
94
|
+
|
95
|
+
assert_equal client, delegation.client
|
68
96
|
end
|
69
97
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delegation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Proper method delegation.
|
15
15
|
email:
|