module-cluster 1.4.8 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +127 -337
- data/lib/module-cluster.rb +1 -153
- data/lib/module/cluster.rb +341 -0
- data/lib/module/cluster/class_support.rb +22 -0
- data/lib/module/cluster/cluster.rb +10 -0
- data/lib/module/cluster/cluster/cluster_interface.rb +550 -0
- data/lib/module/cluster/exception/module_not_in_stack.rb +26 -0
- data/lib/module/cluster/instance_controller.rb +14 -0
- data/lib/module/cluster/instance_controller/hook_controller.rb +33 -0
- data/lib/module/cluster/instance_controller/hook_controller/chain_proxy.rb +511 -0
- data/lib/module/cluster/instance_controller/hook_controller/hook_controller_interface.rb +830 -0
- data/lib/module/cluster/instance_controller/instance_controller_interface.rb +269 -0
- data/lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb +359 -0
- data/lib/module/cluster/instance_controller/multiple_hook_controller_proxy/chain_proxy.rb +442 -0
- data/lib/module/cluster/module_support.rb +67 -0
- data/lib/module/namespaces.rb +13 -0
- data/lib/module/requires.rb +32 -0
- data/spec/module/cluster/cluster_spec.rb +473 -0
- data/spec/module/cluster/instance_controller/hook_controller_spec.rb +922 -0
- data/spec/module/cluster/instance_controller/multiple_hook_controller_proxy_spec.rb +1240 -0
- data/spec/module/cluster_spec.rb +1794 -0
- metadata +27 -98
- data/README.rdoc +0 -395
- data/lib/module-cluster/ModuleCluster.rb +0 -9
- data/lib/module-cluster/ModuleCluster/Define.rb +0 -12
- data/lib/module-cluster/ModuleCluster/Define/Block.rb +0 -9
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClass.rb +0 -83
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClassOrModule.rb +0 -70
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModule.rb +0 -79
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModuleOrSubclass.rb +0 -21
- data/lib/module-cluster/ModuleCluster/Define/Block/Class.rb +0 -77
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrInstance.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrInstance.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrSubclass.rb +0 -36
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrSubclass.rb +0 -29
- data/lib/module-cluster/ModuleCluster/Define/Block/Instance.rb +0 -45
- data/lib/module-cluster/ModuleCluster/Define/Block/Module.rb +0 -77
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrInstance.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrSubclass.rb +0 -29
- data/lib/module-cluster/ModuleCluster/Define/Block/Subclass.rb +0 -56
- data/lib/module-cluster/ModuleCluster/Define/ClassCluster.rb +0 -193
- data/lib/module-cluster/ModuleCluster/Define/ClassOrInstanceCluster.rb +0 -128
- data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +0 -181
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +0 -185
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +0 -181
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +0 -181
- data/lib/module-cluster/ModuleCluster/Define/Deprecated.rb +0 -40
- data/lib/module-cluster/ModuleCluster/Define/InstanceCluster.rb +0 -45
- data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +0 -193
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrClassCluster.rb +0 -209
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrInstanceCluster.rb +0 -128
- data/lib/module-cluster/ModuleCluster/Define/Status.rb +0 -106
- data/lib/module-cluster/ModuleCluster/Suspend.rb +0 -7
- data/lib/module-cluster/ModuleCluster/Suspend/Hooks.rb +0 -315
- data/lib/module-cluster/ModuleCluster/Suspend/WithoutHooks.rb +0 -153
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures.rb +0 -77
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/ClusterStack.rb +0 -44
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/PerformCascades.rb +0 -292
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/Subclass.rb +0 -24
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack.rb +0 -12
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block.rb +0 -9
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Class.rb +0 -36
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Inherited.rb +0 -20
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Instance.rb +0 -20
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Module.rb +0 -36
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Set.rb +0 -6
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Extends.rb +0 -140
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Includes.rb +0 -110
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsExtends.rb +0 -140
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsIncludes.rb +0 -110
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set.rb +0 -35
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy.rb +0 -359
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Status.rb +0 -55
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Suspend.rb +0 -199
- data/lib/module-cluster/_private_/ModuleCluster/ExtendForCascade.rb +0 -34
- data/spec/ModuleCluster/Define/Block/CascadingClassOrModule_spec.rb +0 -285
- data/spec/ModuleCluster/Define/Block/CascadingClass_spec.rb +0 -254
- data/spec/ModuleCluster/Define/Block/CascadingModuleOrSubclass_spec.rb +0 -56
- data/spec/ModuleCluster/Define/Block/CascadingModule_spec.rb +0 -278
- data/spec/ModuleCluster/Define/Block/ClassOrInstance_spec.rb +0 -230
- data/spec/ModuleCluster/Define/Block/ClassOrModuleOrInstance_spec.rb +0 -238
- data/spec/ModuleCluster/Define/Block/ClassOrModuleOrSubclass_spec.rb +0 -54
- data/spec/ModuleCluster/Define/Block/ClassOrModule_spec.rb +0 -231
- data/spec/ModuleCluster/Define/Block/ClassOrSubclass_spec.rb +0 -54
- data/spec/ModuleCluster/Define/Block/Class_spec.rb +0 -224
- data/spec/ModuleCluster/Define/Block/Instance_spec.rb +0 -78
- data/spec/ModuleCluster/Define/Block/ModuleOrInstance_spec.rb +0 -54
- data/spec/ModuleCluster/Define/Block/ModuleOrSubclass_spec.rb +0 -51
- data/spec/ModuleCluster/Define/Block/Module_spec.rb +0 -230
- data/spec/ModuleCluster/Define/Block/Subclass_spec.rb +0 -73
- data/spec/ModuleCluster/Define/Block_spec.rb +0 -18
- data/spec/ModuleCluster/Define/ClassCluster_spec.rb +0 -728
- data/spec/ModuleCluster/Define/ClassOrInstanceCluster_spec.rb +0 -576
- data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +0 -659
- data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +0 -678
- data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +0 -644
- data/spec/ModuleCluster/Define/Cluster_spec.rb +0 -708
- data/spec/ModuleCluster/Define/InstanceCluster_spec.rb +0 -102
- data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +0 -728
- data/spec/ModuleCluster/Define/ModuleOrClassCluster_spec.rb +0 -728
- data/spec/ModuleCluster/Define/ModuleOrInstanceCluster_spec.rb +0 -576
- data/spec/ModuleCluster/Suspend/Hooks_spec.rb +0 -573
- data/spec/ModuleCluster/Suspend/WithoutHooks_spec.rb +0 -559
- data/spec/ModuleCluster_spec.rb +0 -15
- data/spec/_private_/ModuleCluster/CascadeFeatures/PerformCascades_spec.rb +0 -386
- data/spec/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy_spec.rb +0 -419
- data/spec/_private_/ModuleCluster/ClusterStack/Suspend_spec.rb +0 -242
@@ -0,0 +1,1240 @@
|
|
1
|
+
|
2
|
+
require_relative '../../../../lib/module/cluster.rb'
|
3
|
+
|
4
|
+
describe ::Module::Cluster::InstanceController::MultipleHookControllerProxy do
|
5
|
+
|
6
|
+
before :all do
|
7
|
+
module ::Module::Cluster::InstanceController::MultipleHookControllerProxy::Mock
|
8
|
+
|
9
|
+
module Instance
|
10
|
+
end
|
11
|
+
|
12
|
+
class InstanceControllerMock
|
13
|
+
def instance
|
14
|
+
return Instance
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
InstanceController = InstanceControllerMock.new
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
#############
|
24
|
+
# include #
|
25
|
+
#############
|
26
|
+
|
27
|
+
it 'can put modules on its stack for including at later event hook' do
|
28
|
+
module ::Module::Cluster::InstanceController::MultipleHookControllerProxy::IncludeMock
|
29
|
+
|
30
|
+
instance_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy::Mock::InstanceController
|
31
|
+
HookControllerA = ::Module::Cluster::InstanceController::HookController.new( :mock_A, instance_controller )
|
32
|
+
HookControllerB = ::Module::Cluster::InstanceController::HookController.new( :mock_B, instance_controller )
|
33
|
+
multi_hook_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy.new( :mock, HookControllerA, HookControllerB )
|
34
|
+
|
35
|
+
module A
|
36
|
+
end
|
37
|
+
module B
|
38
|
+
end
|
39
|
+
module C
|
40
|
+
end
|
41
|
+
|
42
|
+
multi_hook_controller.include( A, B, C )
|
43
|
+
|
44
|
+
HookControllerA.stack[ 0 ].module.should == A
|
45
|
+
HookControllerA.stack[ 0 ].owner.should == instance_controller.instance
|
46
|
+
HookControllerA.stack[ 0 ].action.should == :include
|
47
|
+
HookControllerA.stack[ 0 ].cascades.should == nil
|
48
|
+
HookControllerA.stack[ 0 ].block.should == nil
|
49
|
+
|
50
|
+
HookControllerA.stack[ 1 ].module.should == B
|
51
|
+
HookControllerA.stack[ 1 ].owner.should == instance_controller.instance
|
52
|
+
HookControllerA.stack[ 1 ].action.should == :include
|
53
|
+
HookControllerA.stack[ 1 ].cascades.should == nil
|
54
|
+
HookControllerA.stack[ 1 ].block.should == nil
|
55
|
+
|
56
|
+
HookControllerA.stack[ 2 ].module.should == C
|
57
|
+
HookControllerA.stack[ 2 ].owner.should == instance_controller.instance
|
58
|
+
HookControllerA.stack[ 2 ].action.should == :include
|
59
|
+
HookControllerA.stack[ 2 ].cascades.should == nil
|
60
|
+
HookControllerA.stack[ 2 ].block.should == nil
|
61
|
+
|
62
|
+
HookControllerB.stack[ 0 ].module.should == A
|
63
|
+
HookControllerB.stack[ 0 ].owner.should == instance_controller.instance
|
64
|
+
HookControllerB.stack[ 0 ].action.should == :include
|
65
|
+
HookControllerB.stack[ 0 ].cascades.should == nil
|
66
|
+
HookControllerB.stack[ 0 ].block.should == nil
|
67
|
+
|
68
|
+
HookControllerB.stack[ 1 ].module.should == B
|
69
|
+
HookControllerB.stack[ 1 ].owner.should == instance_controller.instance
|
70
|
+
HookControllerB.stack[ 1 ].action.should == :include
|
71
|
+
HookControllerB.stack[ 1 ].cascades.should == nil
|
72
|
+
HookControllerB.stack[ 1 ].block.should == nil
|
73
|
+
|
74
|
+
HookControllerB.stack[ 2 ].module.should == C
|
75
|
+
HookControllerB.stack[ 2 ].owner.should == instance_controller.instance
|
76
|
+
HookControllerB.stack[ 2 ].action.should == :include
|
77
|
+
HookControllerB.stack[ 2 ].cascades.should == nil
|
78
|
+
HookControllerB.stack[ 2 ].block.should == nil
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
############
|
84
|
+
# extend #
|
85
|
+
############
|
86
|
+
|
87
|
+
it 'can put modules on its stack for extending at later event hook' do
|
88
|
+
module ::Module::Cluster::InstanceController::MultipleHookControllerProxy::ExtendMock
|
89
|
+
|
90
|
+
instance_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy::Mock::InstanceController
|
91
|
+
HookControllerA = ::Module::Cluster::InstanceController::HookController.new( :mock_A, instance_controller )
|
92
|
+
HookControllerB = ::Module::Cluster::InstanceController::HookController.new( :mock_B, instance_controller )
|
93
|
+
multi_hook_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy.new( :mock, HookControllerA, HookControllerB )
|
94
|
+
|
95
|
+
module A
|
96
|
+
end
|
97
|
+
module B
|
98
|
+
end
|
99
|
+
module C
|
100
|
+
end
|
101
|
+
|
102
|
+
multi_hook_controller.extend( A, B, C )
|
103
|
+
|
104
|
+
HookControllerA.stack[ 0 ].module.should == A
|
105
|
+
HookControllerA.stack[ 0 ].owner.should == instance_controller.instance
|
106
|
+
HookControllerA.stack[ 0 ].action.should == :extend
|
107
|
+
HookControllerA.stack[ 0 ].cascades.should == nil
|
108
|
+
HookControllerA.stack[ 0 ].block.should == nil
|
109
|
+
|
110
|
+
HookControllerA.stack[ 1 ].module.should == B
|
111
|
+
HookControllerA.stack[ 1 ].owner.should == instance_controller.instance
|
112
|
+
HookControllerA.stack[ 1 ].action.should == :extend
|
113
|
+
HookControllerA.stack[ 1 ].cascades.should == nil
|
114
|
+
HookControllerA.stack[ 1 ].block.should == nil
|
115
|
+
|
116
|
+
HookControllerA.stack[ 2 ].module.should == C
|
117
|
+
HookControllerA.stack[ 2 ].owner.should == instance_controller.instance
|
118
|
+
HookControllerA.stack[ 2 ].action.should == :extend
|
119
|
+
HookControllerA.stack[ 2 ].cascades.should == nil
|
120
|
+
HookControllerA.stack[ 2 ].block.should == nil
|
121
|
+
|
122
|
+
HookControllerB.stack[ 0 ].module.should == A
|
123
|
+
HookControllerB.stack[ 0 ].owner.should == instance_controller.instance
|
124
|
+
HookControllerB.stack[ 0 ].action.should == :extend
|
125
|
+
HookControllerB.stack[ 0 ].cascades.should == nil
|
126
|
+
HookControllerB.stack[ 0 ].block.should == nil
|
127
|
+
|
128
|
+
HookControllerB.stack[ 1 ].module.should == B
|
129
|
+
HookControllerB.stack[ 1 ].owner.should == instance_controller.instance
|
130
|
+
HookControllerB.stack[ 1 ].action.should == :extend
|
131
|
+
HookControllerB.stack[ 1 ].cascades.should == nil
|
132
|
+
HookControllerB.stack[ 1 ].block.should == nil
|
133
|
+
|
134
|
+
HookControllerB.stack[ 2 ].module.should == C
|
135
|
+
HookControllerB.stack[ 2 ].owner.should == instance_controller.instance
|
136
|
+
HookControllerB.stack[ 2 ].action.should == :extend
|
137
|
+
HookControllerB.stack[ 2 ].cascades.should == nil
|
138
|
+
HookControllerB.stack[ 2 ].block.should == nil
|
139
|
+
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
########################
|
144
|
+
# include_and_extend #
|
145
|
+
########################
|
146
|
+
|
147
|
+
it 'can put modules on its stack for including and extending at later event hook' do
|
148
|
+
module ::Module::Cluster::InstanceController::MultipleHookControllerProxy::IncludeAndExtendMock
|
149
|
+
|
150
|
+
instance_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy::Mock::InstanceController
|
151
|
+
HookControllerA = ::Module::Cluster::InstanceController::HookController.new( :mock_A, instance_controller )
|
152
|
+
HookControllerB = ::Module::Cluster::InstanceController::HookController.new( :mock_B, instance_controller )
|
153
|
+
multi_hook_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy.new( :mock, HookControllerA, HookControllerB )
|
154
|
+
|
155
|
+
module A
|
156
|
+
end
|
157
|
+
module B
|
158
|
+
end
|
159
|
+
module C
|
160
|
+
end
|
161
|
+
|
162
|
+
multi_hook_controller.include_and_extend( A, B, C )
|
163
|
+
|
164
|
+
# A
|
165
|
+
|
166
|
+
HookControllerA.stack[ 0 ].module.should == A
|
167
|
+
HookControllerA.stack[ 0 ].owner.should == instance_controller.instance
|
168
|
+
HookControllerA.stack[ 0 ].action.should == :include
|
169
|
+
HookControllerA.stack[ 0 ].cascades.should == nil
|
170
|
+
HookControllerA.stack[ 0 ].block.should == nil
|
171
|
+
|
172
|
+
HookControllerA.stack[ 1 ].module.should == A
|
173
|
+
HookControllerA.stack[ 1 ].owner.should == instance_controller.instance
|
174
|
+
HookControllerA.stack[ 1 ].action.should == :extend
|
175
|
+
HookControllerA.stack[ 1 ].cascades.should == nil
|
176
|
+
HookControllerA.stack[ 1 ].block.should == nil
|
177
|
+
|
178
|
+
# B
|
179
|
+
|
180
|
+
HookControllerA.stack[ 2 ].module.should == B
|
181
|
+
HookControllerA.stack[ 2 ].owner.should == instance_controller.instance
|
182
|
+
HookControllerA.stack[ 2 ].action.should == :include
|
183
|
+
HookControllerA.stack[ 2 ].cascades.should == nil
|
184
|
+
HookControllerA.stack[ 2 ].block.should == nil
|
185
|
+
|
186
|
+
HookControllerA.stack[ 3 ].module.should == B
|
187
|
+
HookControllerA.stack[ 3 ].owner.should == instance_controller.instance
|
188
|
+
HookControllerA.stack[ 3 ].action.should == :extend
|
189
|
+
HookControllerA.stack[ 3 ].cascades.should == nil
|
190
|
+
HookControllerA.stack[ 3 ].block.should == nil
|
191
|
+
|
192
|
+
# C
|
193
|
+
|
194
|
+
HookControllerA.stack[ 4 ].module.should == C
|
195
|
+
HookControllerA.stack[ 4 ].owner.should == instance_controller.instance
|
196
|
+
HookControllerA.stack[ 4 ].action.should == :include
|
197
|
+
HookControllerA.stack[ 4 ].cascades.should == nil
|
198
|
+
HookControllerA.stack[ 4 ].block.should == nil
|
199
|
+
|
200
|
+
HookControllerA.stack[ 5 ].module.should == C
|
201
|
+
HookControllerA.stack[ 5 ].owner.should == instance_controller.instance
|
202
|
+
HookControllerA.stack[ 5 ].action.should == :extend
|
203
|
+
HookControllerA.stack[ 5 ].cascades.should == nil
|
204
|
+
HookControllerA.stack[ 5 ].block.should == nil
|
205
|
+
|
206
|
+
# A
|
207
|
+
|
208
|
+
HookControllerB.stack[ 0 ].module.should == A
|
209
|
+
HookControllerB.stack[ 0 ].owner.should == instance_controller.instance
|
210
|
+
HookControllerB.stack[ 0 ].action.should == :include
|
211
|
+
HookControllerB.stack[ 0 ].cascades.should == nil
|
212
|
+
HookControllerB.stack[ 0 ].block.should == nil
|
213
|
+
|
214
|
+
HookControllerB.stack[ 1 ].module.should == A
|
215
|
+
HookControllerB.stack[ 1 ].owner.should == instance_controller.instance
|
216
|
+
HookControllerB.stack[ 1 ].action.should == :extend
|
217
|
+
HookControllerB.stack[ 1 ].cascades.should == nil
|
218
|
+
HookControllerB.stack[ 1 ].block.should == nil
|
219
|
+
|
220
|
+
# B
|
221
|
+
|
222
|
+
HookControllerB.stack[ 2 ].module.should == B
|
223
|
+
HookControllerB.stack[ 2 ].owner.should == instance_controller.instance
|
224
|
+
HookControllerB.stack[ 2 ].action.should == :include
|
225
|
+
HookControllerB.stack[ 2 ].cascades.should == nil
|
226
|
+
HookControllerB.stack[ 2 ].block.should == nil
|
227
|
+
|
228
|
+
HookControllerB.stack[ 3 ].module.should == B
|
229
|
+
HookControllerB.stack[ 3 ].owner.should == instance_controller.instance
|
230
|
+
HookControllerB.stack[ 3 ].action.should == :extend
|
231
|
+
HookControllerB.stack[ 3 ].cascades.should == nil
|
232
|
+
HookControllerB.stack[ 3 ].block.should == nil
|
233
|
+
|
234
|
+
# C
|
235
|
+
|
236
|
+
HookControllerB.stack[ 4 ].module.should == C
|
237
|
+
HookControllerB.stack[ 4 ].owner.should == instance_controller.instance
|
238
|
+
HookControllerB.stack[ 4 ].action.should == :include
|
239
|
+
HookControllerB.stack[ 4 ].cascades.should == nil
|
240
|
+
HookControllerB.stack[ 4 ].block.should == nil
|
241
|
+
|
242
|
+
HookControllerB.stack[ 5 ].module.should == C
|
243
|
+
HookControllerB.stack[ 5 ].owner.should == instance_controller.instance
|
244
|
+
HookControllerB.stack[ 5 ].action.should == :extend
|
245
|
+
HookControllerB.stack[ 5 ].cascades.should == nil
|
246
|
+
HookControllerB.stack[ 5 ].block.should == nil
|
247
|
+
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
############
|
252
|
+
# action #
|
253
|
+
############
|
254
|
+
|
255
|
+
it 'can create a block action to perform at hook' do
|
256
|
+
module ::Module::Cluster::InstanceController::MultipleHookControllerProxy::ActionMock
|
257
|
+
|
258
|
+
instance_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy::Mock::InstanceController
|
259
|
+
HookControllerA = ::Module::Cluster::InstanceController::HookController.new( :mock_A, instance_controller )
|
260
|
+
HookControllerB = ::Module::Cluster::InstanceController::HookController.new( :mock_B, instance_controller )
|
261
|
+
multi_hook_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy.new( :mock, HookControllerA, HookControllerB )
|
262
|
+
|
263
|
+
block_ran = false
|
264
|
+
action_proc = ::Proc.new do
|
265
|
+
block_ran = true
|
266
|
+
end
|
267
|
+
|
268
|
+
multi_hook_controller.action( & action_proc )
|
269
|
+
|
270
|
+
HookControllerA.stack[ 0 ].module.should == nil
|
271
|
+
HookControllerA.stack[ 0 ].owner.should == instance_controller.instance
|
272
|
+
HookControllerA.stack[ 0 ].action.should == nil
|
273
|
+
HookControllerA.stack[ 0 ].cascades.should == nil
|
274
|
+
HookControllerA.stack[ 0 ].block.should == action_proc
|
275
|
+
|
276
|
+
HookControllerB.stack[ 0 ].module.should == nil
|
277
|
+
HookControllerB.stack[ 0 ].owner.should == instance_controller.instance
|
278
|
+
HookControllerB.stack[ 0 ].action.should == nil
|
279
|
+
HookControllerB.stack[ 0 ].cascades.should == nil
|
280
|
+
HookControllerB.stack[ 0 ].block.should == action_proc
|
281
|
+
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
#################
|
286
|
+
# chain_proxy #
|
287
|
+
#################
|
288
|
+
|
289
|
+
it 'can provide a proxy to return context-chained calls to self' do
|
290
|
+
module ::Module::Cluster::InstanceController::MultipleHookControllerProxy::ProxyMock
|
291
|
+
|
292
|
+
instance_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy::Mock::InstanceController
|
293
|
+
HookControllerA = ::Module::Cluster::InstanceController::HookController.new( :mock_A, instance_controller )
|
294
|
+
HookControllerB = ::Module::Cluster::InstanceController::HookController.new( :mock_B, instance_controller )
|
295
|
+
multi_hook_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy.new( :mock, HookControllerA, HookControllerB )
|
296
|
+
|
297
|
+
chain_proxy = multi_hook_controller.chain_proxy
|
298
|
+
chain_proxy.is_a?( ::Module::Cluster::InstanceController::MultipleHookControllerProxy::ChainProxy ).should == true
|
299
|
+
chain_proxy.should == multi_hook_controller.chain_proxy
|
300
|
+
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
####################
|
305
|
+
# before_include #
|
306
|
+
####################
|
307
|
+
|
308
|
+
it 'can chain methods specifying context for include/extend as before a given module include event' do
|
309
|
+
module ::Module::Cluster::InstanceController::MultipleHookControllerProxy::BeforeIncludeMock
|
310
|
+
|
311
|
+
instance_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy::Mock::InstanceController
|
312
|
+
HookControllerA = ::Module::Cluster::InstanceController::HookController.new( :mock_A, instance_controller )
|
313
|
+
HookControllerB = ::Module::Cluster::InstanceController::HookController.new( :mock_B, instance_controller )
|
314
|
+
multi_hook_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy.new( :mock, HookControllerA, HookControllerB )
|
315
|
+
|
316
|
+
module A
|
317
|
+
end
|
318
|
+
module B
|
319
|
+
end
|
320
|
+
module C
|
321
|
+
end
|
322
|
+
module D
|
323
|
+
end
|
324
|
+
module E
|
325
|
+
end
|
326
|
+
module F
|
327
|
+
end
|
328
|
+
|
329
|
+
multi_hook_controller.include( A, B ).extend( C, D )
|
330
|
+
|
331
|
+
multi_hook_controller.before_include( B ).extend( F )
|
332
|
+
multi_hook_controller.before_include( A ).include( E )
|
333
|
+
|
334
|
+
# E
|
335
|
+
|
336
|
+
HookControllerA.stack[ 0 ].module.should == E
|
337
|
+
HookControllerA.stack[ 0 ].owner.should == instance_controller.instance
|
338
|
+
HookControllerA.stack[ 0 ].action.should == :include
|
339
|
+
HookControllerA.stack[ 0 ].cascades.should == nil
|
340
|
+
HookControllerA.stack[ 0 ].block.should == nil
|
341
|
+
|
342
|
+
# A
|
343
|
+
|
344
|
+
HookControllerA.stack[ 1 ].module.should == A
|
345
|
+
HookControllerA.stack[ 1 ].owner.should == instance_controller.instance
|
346
|
+
HookControllerA.stack[ 1 ].action.should == :include
|
347
|
+
HookControllerA.stack[ 1 ].cascades.should == nil
|
348
|
+
HookControllerA.stack[ 1 ].block.should == nil
|
349
|
+
|
350
|
+
# F
|
351
|
+
|
352
|
+
HookControllerA.stack[ 2 ].module.should == F
|
353
|
+
HookControllerA.stack[ 2 ].owner.should == instance_controller.instance
|
354
|
+
HookControllerA.stack[ 2 ].action.should == :extend
|
355
|
+
HookControllerA.stack[ 2 ].cascades.should == nil
|
356
|
+
HookControllerA.stack[ 2 ].block.should == nil
|
357
|
+
|
358
|
+
# B
|
359
|
+
|
360
|
+
HookControllerA.stack[ 3 ].module.should == B
|
361
|
+
HookControllerA.stack[ 3 ].owner.should == instance_controller.instance
|
362
|
+
HookControllerA.stack[ 3 ].action.should == :include
|
363
|
+
HookControllerA.stack[ 3 ].cascades.should == nil
|
364
|
+
HookControllerA.stack[ 3 ].block.should == nil
|
365
|
+
|
366
|
+
# C
|
367
|
+
|
368
|
+
HookControllerA.stack[ 4 ].module.should == C
|
369
|
+
HookControllerA.stack[ 4 ].owner.should == instance_controller.instance
|
370
|
+
HookControllerA.stack[ 4 ].action.should == :extend
|
371
|
+
HookControllerA.stack[ 4 ].cascades.should == nil
|
372
|
+
HookControllerA.stack[ 4 ].block.should == nil
|
373
|
+
|
374
|
+
# D
|
375
|
+
|
376
|
+
HookControllerA.stack[ 5 ].module.should == D
|
377
|
+
HookControllerA.stack[ 5 ].owner.should == instance_controller.instance
|
378
|
+
HookControllerA.stack[ 5 ].action.should == :extend
|
379
|
+
HookControllerA.stack[ 5 ].cascades.should == nil
|
380
|
+
HookControllerA.stack[ 5 ].block.should == nil
|
381
|
+
|
382
|
+
# E
|
383
|
+
|
384
|
+
HookControllerB.stack[ 0 ].module.should == E
|
385
|
+
HookControllerB.stack[ 0 ].owner.should == instance_controller.instance
|
386
|
+
HookControllerB.stack[ 0 ].action.should == :include
|
387
|
+
HookControllerB.stack[ 0 ].cascades.should == nil
|
388
|
+
HookControllerB.stack[ 0 ].block.should == nil
|
389
|
+
|
390
|
+
# A
|
391
|
+
|
392
|
+
HookControllerB.stack[ 1 ].module.should == A
|
393
|
+
HookControllerB.stack[ 1 ].owner.should == instance_controller.instance
|
394
|
+
HookControllerB.stack[ 1 ].action.should == :include
|
395
|
+
HookControllerB.stack[ 1 ].cascades.should == nil
|
396
|
+
HookControllerB.stack[ 1 ].block.should == nil
|
397
|
+
|
398
|
+
# F
|
399
|
+
|
400
|
+
HookControllerB.stack[ 2 ].module.should == F
|
401
|
+
HookControllerB.stack[ 2 ].owner.should == instance_controller.instance
|
402
|
+
HookControllerB.stack[ 2 ].action.should == :extend
|
403
|
+
HookControllerB.stack[ 2 ].cascades.should == nil
|
404
|
+
HookControllerB.stack[ 2 ].block.should == nil
|
405
|
+
|
406
|
+
# B
|
407
|
+
|
408
|
+
HookControllerB.stack[ 3 ].module.should == B
|
409
|
+
HookControllerB.stack[ 3 ].owner.should == instance_controller.instance
|
410
|
+
HookControllerB.stack[ 3 ].action.should == :include
|
411
|
+
HookControllerB.stack[ 3 ].cascades.should == nil
|
412
|
+
HookControllerB.stack[ 3 ].block.should == nil
|
413
|
+
|
414
|
+
# C
|
415
|
+
|
416
|
+
HookControllerB.stack[ 4 ].module.should == C
|
417
|
+
HookControllerB.stack[ 4 ].owner.should == instance_controller.instance
|
418
|
+
HookControllerB.stack[ 4 ].action.should == :extend
|
419
|
+
HookControllerB.stack[ 4 ].cascades.should == nil
|
420
|
+
HookControllerB.stack[ 4 ].block.should == nil
|
421
|
+
|
422
|
+
# D
|
423
|
+
|
424
|
+
HookControllerB.stack[ 5 ].module.should == D
|
425
|
+
HookControllerB.stack[ 5 ].owner.should == instance_controller.instance
|
426
|
+
HookControllerB.stack[ 5 ].action.should == :extend
|
427
|
+
HookControllerB.stack[ 5 ].cascades.should == nil
|
428
|
+
HookControllerB.stack[ 5 ].block.should == nil
|
429
|
+
|
430
|
+
end
|
431
|
+
end
|
432
|
+
|
433
|
+
###################
|
434
|
+
# before_extend #
|
435
|
+
###################
|
436
|
+
|
437
|
+
it 'can chain methods specifying context for include/extend as before a given module extend event' do
|
438
|
+
module ::Module::Cluster::InstanceController::MultipleHookControllerProxy::BeforeExtendMock
|
439
|
+
|
440
|
+
instance_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy::Mock::InstanceController
|
441
|
+
HookControllerA = ::Module::Cluster::InstanceController::HookController.new( :mock_A, instance_controller )
|
442
|
+
HookControllerB = ::Module::Cluster::InstanceController::HookController.new( :mock_B, instance_controller )
|
443
|
+
multi_hook_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy.new( :mock, HookControllerA, HookControllerB )
|
444
|
+
|
445
|
+
module A
|
446
|
+
end
|
447
|
+
module B
|
448
|
+
end
|
449
|
+
module C
|
450
|
+
end
|
451
|
+
module D
|
452
|
+
end
|
453
|
+
module E
|
454
|
+
end
|
455
|
+
module F
|
456
|
+
end
|
457
|
+
|
458
|
+
multi_hook_controller.include( A, B ).extend( C, D )
|
459
|
+
|
460
|
+
multi_hook_controller.before_extend( C ).extend( F )
|
461
|
+
multi_hook_controller.before_extend( D ).include( E )
|
462
|
+
|
463
|
+
# A
|
464
|
+
|
465
|
+
HookControllerA.stack[ 0 ].module.should == A
|
466
|
+
HookControllerA.stack[ 0 ].owner.should == instance_controller.instance
|
467
|
+
HookControllerA.stack[ 0 ].action.should == :include
|
468
|
+
HookControllerA.stack[ 0 ].cascades.should == nil
|
469
|
+
HookControllerA.stack[ 0 ].block.should == nil
|
470
|
+
|
471
|
+
# B
|
472
|
+
|
473
|
+
HookControllerA.stack[ 1 ].module.should == B
|
474
|
+
HookControllerA.stack[ 1 ].owner.should == instance_controller.instance
|
475
|
+
HookControllerA.stack[ 1 ].action.should == :include
|
476
|
+
HookControllerA.stack[ 1 ].cascades.should == nil
|
477
|
+
HookControllerA.stack[ 1 ].block.should == nil
|
478
|
+
|
479
|
+
# F
|
480
|
+
|
481
|
+
HookControllerA.stack[ 2 ].module.should == F
|
482
|
+
HookControllerA.stack[ 2 ].owner.should == instance_controller.instance
|
483
|
+
HookControllerA.stack[ 2 ].action.should == :extend
|
484
|
+
HookControllerA.stack[ 2 ].cascades.should == nil
|
485
|
+
HookControllerA.stack[ 2 ].block.should == nil
|
486
|
+
|
487
|
+
# C
|
488
|
+
|
489
|
+
HookControllerA.stack[ 3 ].module.should == C
|
490
|
+
HookControllerA.stack[ 3 ].owner.should == instance_controller.instance
|
491
|
+
HookControllerA.stack[ 3 ].action.should == :extend
|
492
|
+
HookControllerA.stack[ 3 ].cascades.should == nil
|
493
|
+
HookControllerA.stack[ 3 ].block.should == nil
|
494
|
+
|
495
|
+
# E
|
496
|
+
|
497
|
+
HookControllerA.stack[ 4 ].module.should == E
|
498
|
+
HookControllerA.stack[ 4 ].owner.should == instance_controller.instance
|
499
|
+
HookControllerA.stack[ 4 ].action.should == :include
|
500
|
+
HookControllerA.stack[ 4 ].cascades.should == nil
|
501
|
+
HookControllerA.stack[ 4 ].block.should == nil
|
502
|
+
|
503
|
+
# D
|
504
|
+
|
505
|
+
HookControllerA.stack[ 5 ].module.should == D
|
506
|
+
HookControllerA.stack[ 5 ].owner.should == instance_controller.instance
|
507
|
+
HookControllerA.stack[ 5 ].action.should == :extend
|
508
|
+
HookControllerA.stack[ 5 ].cascades.should == nil
|
509
|
+
HookControllerA.stack[ 5 ].block.should == nil
|
510
|
+
|
511
|
+
# A
|
512
|
+
|
513
|
+
HookControllerB.stack[ 0 ].module.should == A
|
514
|
+
HookControllerB.stack[ 0 ].owner.should == instance_controller.instance
|
515
|
+
HookControllerB.stack[ 0 ].action.should == :include
|
516
|
+
HookControllerB.stack[ 0 ].cascades.should == nil
|
517
|
+
HookControllerB.stack[ 0 ].block.should == nil
|
518
|
+
|
519
|
+
# B
|
520
|
+
|
521
|
+
HookControllerB.stack[ 1 ].module.should == B
|
522
|
+
HookControllerB.stack[ 1 ].owner.should == instance_controller.instance
|
523
|
+
HookControllerB.stack[ 1 ].action.should == :include
|
524
|
+
HookControllerB.stack[ 1 ].cascades.should == nil
|
525
|
+
HookControllerB.stack[ 1 ].block.should == nil
|
526
|
+
|
527
|
+
# F
|
528
|
+
|
529
|
+
HookControllerB.stack[ 2 ].module.should == F
|
530
|
+
HookControllerB.stack[ 2 ].owner.should == instance_controller.instance
|
531
|
+
HookControllerB.stack[ 2 ].action.should == :extend
|
532
|
+
HookControllerB.stack[ 2 ].cascades.should == nil
|
533
|
+
HookControllerB.stack[ 2 ].block.should == nil
|
534
|
+
|
535
|
+
# C
|
536
|
+
|
537
|
+
HookControllerB.stack[ 3 ].module.should == C
|
538
|
+
HookControllerB.stack[ 3 ].owner.should == instance_controller.instance
|
539
|
+
HookControllerB.stack[ 3 ].action.should == :extend
|
540
|
+
HookControllerB.stack[ 3 ].cascades.should == nil
|
541
|
+
HookControllerB.stack[ 3 ].block.should == nil
|
542
|
+
|
543
|
+
# E
|
544
|
+
|
545
|
+
HookControllerB.stack[ 4 ].module.should == E
|
546
|
+
HookControllerB.stack[ 4 ].owner.should == instance_controller.instance
|
547
|
+
HookControllerB.stack[ 4 ].action.should == :include
|
548
|
+
HookControllerB.stack[ 4 ].cascades.should == nil
|
549
|
+
HookControllerB.stack[ 4 ].block.should == nil
|
550
|
+
|
551
|
+
# D
|
552
|
+
|
553
|
+
HookControllerB.stack[ 5 ].module.should == D
|
554
|
+
HookControllerB.stack[ 5 ].owner.should == instance_controller.instance
|
555
|
+
HookControllerB.stack[ 5 ].action.should == :extend
|
556
|
+
HookControllerB.stack[ 5 ].cascades.should == nil
|
557
|
+
HookControllerB.stack[ 5 ].block.should == nil
|
558
|
+
|
559
|
+
end
|
560
|
+
end
|
561
|
+
|
562
|
+
##############################
|
563
|
+
# before_include_or_extend #
|
564
|
+
##############################
|
565
|
+
|
566
|
+
it 'can chain methods specifying context for include/extend as before a given module include or extend event' do
|
567
|
+
module ::Module::Cluster::InstanceController::MultipleHookControllerProxy::BeforeIncludeOrExtendMock
|
568
|
+
|
569
|
+
instance_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy::Mock::InstanceController
|
570
|
+
HookControllerA = ::Module::Cluster::InstanceController::HookController.new( :mock_A, instance_controller )
|
571
|
+
HookControllerB = ::Module::Cluster::InstanceController::HookController.new( :mock_B, instance_controller )
|
572
|
+
multi_hook_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy.new( :mock, HookControllerA, HookControllerB )
|
573
|
+
|
574
|
+
module A
|
575
|
+
end
|
576
|
+
module B
|
577
|
+
end
|
578
|
+
module C
|
579
|
+
end
|
580
|
+
module D
|
581
|
+
end
|
582
|
+
module E
|
583
|
+
end
|
584
|
+
module F
|
585
|
+
end
|
586
|
+
|
587
|
+
multi_hook_controller.include( A, B ).extend( B, C ).include( C ).include_and_extend( D ).extend( A )
|
588
|
+
|
589
|
+
multi_hook_controller.before_include_or_extend( B ).extend( F )
|
590
|
+
multi_hook_controller.before_include_or_extend( A ).include_and_extend( E )
|
591
|
+
|
592
|
+
# E - include
|
593
|
+
|
594
|
+
HookControllerA.stack[ 0 ].module.should == E
|
595
|
+
HookControllerA.stack[ 0 ].owner.should == instance_controller.instance
|
596
|
+
HookControllerA.stack[ 0 ].action.should == :include
|
597
|
+
HookControllerA.stack[ 0 ].cascades.should == nil
|
598
|
+
HookControllerA.stack[ 0 ].block.should == nil
|
599
|
+
|
600
|
+
# E - extend
|
601
|
+
|
602
|
+
HookControllerA.stack[ 1 ].module.should == E
|
603
|
+
HookControllerA.stack[ 1 ].owner.should == instance_controller.instance
|
604
|
+
HookControllerA.stack[ 1 ].action.should == :extend
|
605
|
+
HookControllerA.stack[ 1 ].cascades.should == nil
|
606
|
+
HookControllerA.stack[ 1 ].block.should == nil
|
607
|
+
|
608
|
+
# A - include
|
609
|
+
|
610
|
+
HookControllerA.stack[ 2 ].module.should == A
|
611
|
+
HookControllerA.stack[ 2 ].owner.should == instance_controller.instance
|
612
|
+
HookControllerA.stack[ 2 ].action.should == :include
|
613
|
+
HookControllerA.stack[ 2 ].cascades.should == nil
|
614
|
+
HookControllerA.stack[ 2 ].block.should == nil
|
615
|
+
|
616
|
+
# F - extend
|
617
|
+
|
618
|
+
HookControllerA.stack[ 3 ].module.should == F
|
619
|
+
HookControllerA.stack[ 3 ].owner.should == instance_controller.instance
|
620
|
+
HookControllerA.stack[ 3 ].action.should == :extend
|
621
|
+
HookControllerA.stack[ 3 ].cascades.should == nil
|
622
|
+
HookControllerA.stack[ 3 ].block.should == nil
|
623
|
+
|
624
|
+
# B - include
|
625
|
+
|
626
|
+
HookControllerA.stack[ 4 ].module.should == B
|
627
|
+
HookControllerA.stack[ 4 ].owner.should == instance_controller.instance
|
628
|
+
HookControllerA.stack[ 4 ].action.should == :include
|
629
|
+
HookControllerA.stack[ 4 ].cascades.should == nil
|
630
|
+
HookControllerA.stack[ 4 ].block.should == nil
|
631
|
+
|
632
|
+
# B - extend
|
633
|
+
|
634
|
+
HookControllerA.stack[ 5 ].module.should == B
|
635
|
+
HookControllerA.stack[ 5 ].owner.should == instance_controller.instance
|
636
|
+
HookControllerA.stack[ 5 ].action.should == :extend
|
637
|
+
HookControllerA.stack[ 5 ].cascades.should == nil
|
638
|
+
HookControllerA.stack[ 5 ].block.should == nil
|
639
|
+
|
640
|
+
# C - extend
|
641
|
+
|
642
|
+
HookControllerA.stack[ 6 ].module.should == C
|
643
|
+
HookControllerA.stack[ 6 ].owner.should == instance_controller.instance
|
644
|
+
HookControllerA.stack[ 6 ].action.should == :extend
|
645
|
+
HookControllerA.stack[ 6 ].cascades.should == nil
|
646
|
+
HookControllerA.stack[ 6 ].block.should == nil
|
647
|
+
|
648
|
+
# C - include
|
649
|
+
|
650
|
+
HookControllerA.stack[ 7 ].module.should == C
|
651
|
+
HookControllerA.stack[ 7 ].owner.should == instance_controller.instance
|
652
|
+
HookControllerA.stack[ 7 ].action.should == :include
|
653
|
+
HookControllerA.stack[ 7 ].cascades.should == nil
|
654
|
+
HookControllerA.stack[ 7 ].block.should == nil
|
655
|
+
|
656
|
+
# D - include
|
657
|
+
|
658
|
+
HookControllerA.stack[ 8 ].module.should == D
|
659
|
+
HookControllerA.stack[ 8 ].owner.should == instance_controller.instance
|
660
|
+
HookControllerA.stack[ 8 ].action.should == :include
|
661
|
+
HookControllerA.stack[ 8 ].cascades.should == nil
|
662
|
+
HookControllerA.stack[ 8 ].block.should == nil
|
663
|
+
|
664
|
+
# D - extend
|
665
|
+
|
666
|
+
HookControllerA.stack[ 9 ].module.should == D
|
667
|
+
HookControllerA.stack[ 9 ].owner.should == instance_controller.instance
|
668
|
+
HookControllerA.stack[ 9 ].action.should == :extend
|
669
|
+
HookControllerA.stack[ 9 ].cascades.should == nil
|
670
|
+
HookControllerA.stack[ 9 ].block.should == nil
|
671
|
+
|
672
|
+
# A - extend
|
673
|
+
|
674
|
+
HookControllerA.stack[ 10 ].module.should == A
|
675
|
+
HookControllerA.stack[ 10 ].owner.should == instance_controller.instance
|
676
|
+
HookControllerA.stack[ 10 ].action.should == :extend
|
677
|
+
HookControllerA.stack[ 10 ].cascades.should == nil
|
678
|
+
HookControllerA.stack[ 10 ].block.should == nil
|
679
|
+
|
680
|
+
# E - include
|
681
|
+
|
682
|
+
HookControllerB.stack[ 0 ].module.should == E
|
683
|
+
HookControllerB.stack[ 0 ].owner.should == instance_controller.instance
|
684
|
+
HookControllerB.stack[ 0 ].action.should == :include
|
685
|
+
HookControllerB.stack[ 0 ].cascades.should == nil
|
686
|
+
HookControllerB.stack[ 0 ].block.should == nil
|
687
|
+
|
688
|
+
# E - extend
|
689
|
+
|
690
|
+
HookControllerB.stack[ 1 ].module.should == E
|
691
|
+
HookControllerB.stack[ 1 ].owner.should == instance_controller.instance
|
692
|
+
HookControllerB.stack[ 1 ].action.should == :extend
|
693
|
+
HookControllerB.stack[ 1 ].cascades.should == nil
|
694
|
+
HookControllerB.stack[ 1 ].block.should == nil
|
695
|
+
|
696
|
+
# A - include
|
697
|
+
|
698
|
+
HookControllerB.stack[ 2 ].module.should == A
|
699
|
+
HookControllerB.stack[ 2 ].owner.should == instance_controller.instance
|
700
|
+
HookControllerB.stack[ 2 ].action.should == :include
|
701
|
+
HookControllerB.stack[ 2 ].cascades.should == nil
|
702
|
+
HookControllerB.stack[ 2 ].block.should == nil
|
703
|
+
|
704
|
+
# F - extend
|
705
|
+
|
706
|
+
HookControllerB.stack[ 3 ].module.should == F
|
707
|
+
HookControllerB.stack[ 3 ].owner.should == instance_controller.instance
|
708
|
+
HookControllerB.stack[ 3 ].action.should == :extend
|
709
|
+
HookControllerB.stack[ 3 ].cascades.should == nil
|
710
|
+
HookControllerB.stack[ 3 ].block.should == nil
|
711
|
+
|
712
|
+
# B - include
|
713
|
+
|
714
|
+
HookControllerB.stack[ 4 ].module.should == B
|
715
|
+
HookControllerB.stack[ 4 ].owner.should == instance_controller.instance
|
716
|
+
HookControllerB.stack[ 4 ].action.should == :include
|
717
|
+
HookControllerB.stack[ 4 ].cascades.should == nil
|
718
|
+
HookControllerB.stack[ 4 ].block.should == nil
|
719
|
+
|
720
|
+
# B - extend
|
721
|
+
|
722
|
+
HookControllerB.stack[ 5 ].module.should == B
|
723
|
+
HookControllerB.stack[ 5 ].owner.should == instance_controller.instance
|
724
|
+
HookControllerB.stack[ 5 ].action.should == :extend
|
725
|
+
HookControllerB.stack[ 5 ].cascades.should == nil
|
726
|
+
HookControllerB.stack[ 5 ].block.should == nil
|
727
|
+
|
728
|
+
# C - extend
|
729
|
+
|
730
|
+
HookControllerB.stack[ 6 ].module.should == C
|
731
|
+
HookControllerB.stack[ 6 ].owner.should == instance_controller.instance
|
732
|
+
HookControllerB.stack[ 6 ].action.should == :extend
|
733
|
+
HookControllerB.stack[ 6 ].cascades.should == nil
|
734
|
+
HookControllerB.stack[ 6 ].block.should == nil
|
735
|
+
|
736
|
+
# C - include
|
737
|
+
|
738
|
+
HookControllerB.stack[ 7 ].module.should == C
|
739
|
+
HookControllerB.stack[ 7 ].owner.should == instance_controller.instance
|
740
|
+
HookControllerB.stack[ 7 ].action.should == :include
|
741
|
+
HookControllerB.stack[ 7 ].cascades.should == nil
|
742
|
+
HookControllerB.stack[ 7 ].block.should == nil
|
743
|
+
|
744
|
+
# D - include
|
745
|
+
|
746
|
+
HookControllerB.stack[ 8 ].module.should == D
|
747
|
+
HookControllerB.stack[ 8 ].owner.should == instance_controller.instance
|
748
|
+
HookControllerB.stack[ 8 ].action.should == :include
|
749
|
+
HookControllerB.stack[ 8 ].cascades.should == nil
|
750
|
+
HookControllerB.stack[ 8 ].block.should == nil
|
751
|
+
|
752
|
+
# D - extend
|
753
|
+
|
754
|
+
HookControllerB.stack[ 9 ].module.should == D
|
755
|
+
HookControllerB.stack[ 9 ].owner.should == instance_controller.instance
|
756
|
+
HookControllerB.stack[ 9 ].action.should == :extend
|
757
|
+
HookControllerB.stack[ 9 ].cascades.should == nil
|
758
|
+
HookControllerB.stack[ 9 ].block.should == nil
|
759
|
+
|
760
|
+
# A - extend
|
761
|
+
|
762
|
+
HookControllerB.stack[ 10 ].module.should == A
|
763
|
+
HookControllerB.stack[ 10 ].owner.should == instance_controller.instance
|
764
|
+
HookControllerB.stack[ 10 ].action.should == :extend
|
765
|
+
HookControllerB.stack[ 10 ].cascades.should == nil
|
766
|
+
HookControllerB.stack[ 10 ].block.should == nil
|
767
|
+
|
768
|
+
end
|
769
|
+
end
|
770
|
+
|
771
|
+
###################
|
772
|
+
# after_include #
|
773
|
+
###################
|
774
|
+
|
775
|
+
it 'can chain methods specifying context for include/extend as after a given module include event' do
|
776
|
+
module ::Module::Cluster::InstanceController::MultipleHookControllerProxy::AfterIncludeMock
|
777
|
+
|
778
|
+
instance_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy::Mock::InstanceController
|
779
|
+
HookControllerA = ::Module::Cluster::InstanceController::HookController.new( :mock_A, instance_controller )
|
780
|
+
HookControllerB = ::Module::Cluster::InstanceController::HookController.new( :mock_B, instance_controller )
|
781
|
+
multi_hook_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy.new( :mock, HookControllerA, HookControllerB )
|
782
|
+
|
783
|
+
module A
|
784
|
+
end
|
785
|
+
module B
|
786
|
+
end
|
787
|
+
module C
|
788
|
+
end
|
789
|
+
module D
|
790
|
+
end
|
791
|
+
module E
|
792
|
+
end
|
793
|
+
module F
|
794
|
+
end
|
795
|
+
|
796
|
+
multi_hook_controller.include( A, B ).extend( C, D )
|
797
|
+
|
798
|
+
multi_hook_controller.after_include( B ).extend( F )
|
799
|
+
multi_hook_controller.after_include( A ).include( E )
|
800
|
+
|
801
|
+
# A
|
802
|
+
|
803
|
+
HookControllerA.stack[ 0 ].module.should == A
|
804
|
+
HookControllerA.stack[ 0 ].owner.should == instance_controller.instance
|
805
|
+
HookControllerA.stack[ 0 ].action.should == :include
|
806
|
+
HookControllerA.stack[ 0 ].cascades.should == nil
|
807
|
+
HookControllerA.stack[ 0 ].block.should == nil
|
808
|
+
|
809
|
+
# E
|
810
|
+
|
811
|
+
HookControllerA.stack[ 1 ].module.should == E
|
812
|
+
HookControllerA.stack[ 1 ].owner.should == instance_controller.instance
|
813
|
+
HookControllerA.stack[ 1 ].action.should == :include
|
814
|
+
HookControllerA.stack[ 1 ].cascades.should == nil
|
815
|
+
HookControllerA.stack[ 1 ].block.should == nil
|
816
|
+
|
817
|
+
# B
|
818
|
+
|
819
|
+
HookControllerA.stack[ 2 ].module.should == B
|
820
|
+
HookControllerA.stack[ 2 ].owner.should == instance_controller.instance
|
821
|
+
HookControllerA.stack[ 2 ].action.should == :include
|
822
|
+
HookControllerA.stack[ 2 ].cascades.should == nil
|
823
|
+
HookControllerA.stack[ 2 ].block.should == nil
|
824
|
+
|
825
|
+
# F
|
826
|
+
|
827
|
+
HookControllerA.stack[ 3 ].module.should == F
|
828
|
+
HookControllerA.stack[ 3 ].owner.should == instance_controller.instance
|
829
|
+
HookControllerA.stack[ 3 ].action.should == :extend
|
830
|
+
HookControllerA.stack[ 3 ].cascades.should == nil
|
831
|
+
HookControllerA.stack[ 3 ].block.should == nil
|
832
|
+
|
833
|
+
# C
|
834
|
+
|
835
|
+
HookControllerA.stack[ 4 ].module.should == C
|
836
|
+
HookControllerA.stack[ 4 ].owner.should == instance_controller.instance
|
837
|
+
HookControllerA.stack[ 4 ].action.should == :extend
|
838
|
+
HookControllerA.stack[ 4 ].cascades.should == nil
|
839
|
+
HookControllerA.stack[ 4 ].block.should == nil
|
840
|
+
|
841
|
+
# D
|
842
|
+
|
843
|
+
HookControllerA.stack[ 5 ].module.should == D
|
844
|
+
HookControllerA.stack[ 5 ].owner.should == instance_controller.instance
|
845
|
+
HookControllerA.stack[ 5 ].action.should == :extend
|
846
|
+
HookControllerA.stack[ 5 ].cascades.should == nil
|
847
|
+
HookControllerA.stack[ 5 ].block.should == nil
|
848
|
+
|
849
|
+
# A
|
850
|
+
|
851
|
+
HookControllerB.stack[ 0 ].module.should == A
|
852
|
+
HookControllerB.stack[ 0 ].owner.should == instance_controller.instance
|
853
|
+
HookControllerB.stack[ 0 ].action.should == :include
|
854
|
+
HookControllerB.stack[ 0 ].cascades.should == nil
|
855
|
+
HookControllerB.stack[ 0 ].block.should == nil
|
856
|
+
|
857
|
+
# E
|
858
|
+
|
859
|
+
HookControllerB.stack[ 1 ].module.should == E
|
860
|
+
HookControllerB.stack[ 1 ].owner.should == instance_controller.instance
|
861
|
+
HookControllerB.stack[ 1 ].action.should == :include
|
862
|
+
HookControllerB.stack[ 1 ].cascades.should == nil
|
863
|
+
HookControllerB.stack[ 1 ].block.should == nil
|
864
|
+
|
865
|
+
# B
|
866
|
+
|
867
|
+
HookControllerB.stack[ 2 ].module.should == B
|
868
|
+
HookControllerB.stack[ 2 ].owner.should == instance_controller.instance
|
869
|
+
HookControllerB.stack[ 2 ].action.should == :include
|
870
|
+
HookControllerB.stack[ 2 ].cascades.should == nil
|
871
|
+
HookControllerB.stack[ 2 ].block.should == nil
|
872
|
+
|
873
|
+
# F
|
874
|
+
|
875
|
+
HookControllerB.stack[ 3 ].module.should == F
|
876
|
+
HookControllerB.stack[ 3 ].owner.should == instance_controller.instance
|
877
|
+
HookControllerB.stack[ 3 ].action.should == :extend
|
878
|
+
HookControllerB.stack[ 3 ].cascades.should == nil
|
879
|
+
HookControllerB.stack[ 3 ].block.should == nil
|
880
|
+
|
881
|
+
# C
|
882
|
+
|
883
|
+
HookControllerB.stack[ 4 ].module.should == C
|
884
|
+
HookControllerB.stack[ 4 ].owner.should == instance_controller.instance
|
885
|
+
HookControllerB.stack[ 4 ].action.should == :extend
|
886
|
+
HookControllerB.stack[ 4 ].cascades.should == nil
|
887
|
+
HookControllerB.stack[ 4 ].block.should == nil
|
888
|
+
|
889
|
+
# D
|
890
|
+
|
891
|
+
HookControllerB.stack[ 5 ].module.should == D
|
892
|
+
HookControllerB.stack[ 5 ].owner.should == instance_controller.instance
|
893
|
+
HookControllerB.stack[ 5 ].action.should == :extend
|
894
|
+
HookControllerB.stack[ 5 ].cascades.should == nil
|
895
|
+
HookControllerB.stack[ 5 ].block.should == nil
|
896
|
+
|
897
|
+
end
|
898
|
+
end
|
899
|
+
|
900
|
+
##################
|
901
|
+
# after_extend #
|
902
|
+
##################
|
903
|
+
|
904
|
+
it 'can chain methods specifying context for include/extend as after a given module extend event' do
|
905
|
+
module ::Module::Cluster::InstanceController::MultipleHookControllerProxy::AfterExtendMock
|
906
|
+
|
907
|
+
instance_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy::Mock::InstanceController
|
908
|
+
HookControllerA = ::Module::Cluster::InstanceController::HookController.new( :mock_A, instance_controller )
|
909
|
+
HookControllerB = ::Module::Cluster::InstanceController::HookController.new( :mock_B, instance_controller )
|
910
|
+
multi_hook_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy.new( :mock, HookControllerA, HookControllerB )
|
911
|
+
|
912
|
+
module A
|
913
|
+
end
|
914
|
+
module B
|
915
|
+
end
|
916
|
+
module C
|
917
|
+
end
|
918
|
+
module D
|
919
|
+
end
|
920
|
+
module E
|
921
|
+
end
|
922
|
+
module F
|
923
|
+
end
|
924
|
+
|
925
|
+
multi_hook_controller.include( A, B ).extend( C, D )
|
926
|
+
|
927
|
+
multi_hook_controller.after_extend( C ).extend( F )
|
928
|
+
multi_hook_controller.after_extend( D ).include( E )
|
929
|
+
|
930
|
+
# A
|
931
|
+
|
932
|
+
HookControllerA.stack[ 0 ].module.should == A
|
933
|
+
HookControllerA.stack[ 0 ].owner.should == instance_controller.instance
|
934
|
+
HookControllerA.stack[ 0 ].action.should == :include
|
935
|
+
HookControllerA.stack[ 0 ].cascades.should == nil
|
936
|
+
HookControllerA.stack[ 0 ].block.should == nil
|
937
|
+
|
938
|
+
# B
|
939
|
+
|
940
|
+
HookControllerA.stack[ 1 ].module.should == B
|
941
|
+
HookControllerA.stack[ 1 ].owner.should == instance_controller.instance
|
942
|
+
HookControllerA.stack[ 1 ].action.should == :include
|
943
|
+
HookControllerA.stack[ 1 ].cascades.should == nil
|
944
|
+
HookControllerA.stack[ 1 ].block.should == nil
|
945
|
+
|
946
|
+
# C
|
947
|
+
|
948
|
+
HookControllerA.stack[ 2 ].module.should == C
|
949
|
+
HookControllerA.stack[ 2 ].owner.should == instance_controller.instance
|
950
|
+
HookControllerA.stack[ 2 ].action.should == :extend
|
951
|
+
HookControllerA.stack[ 2 ].cascades.should == nil
|
952
|
+
HookControllerA.stack[ 2 ].block.should == nil
|
953
|
+
|
954
|
+
# F
|
955
|
+
|
956
|
+
HookControllerA.stack[ 3 ].module.should == F
|
957
|
+
HookControllerA.stack[ 3 ].owner.should == instance_controller.instance
|
958
|
+
HookControllerA.stack[ 3 ].action.should == :extend
|
959
|
+
HookControllerA.stack[ 3 ].cascades.should == nil
|
960
|
+
HookControllerA.stack[ 3 ].block.should == nil
|
961
|
+
|
962
|
+
# D
|
963
|
+
|
964
|
+
HookControllerA.stack[ 4 ].module.should == D
|
965
|
+
HookControllerA.stack[ 4 ].owner.should == instance_controller.instance
|
966
|
+
HookControllerA.stack[ 4 ].action.should == :extend
|
967
|
+
HookControllerA.stack[ 4 ].cascades.should == nil
|
968
|
+
HookControllerA.stack[ 4 ].block.should == nil
|
969
|
+
|
970
|
+
# E
|
971
|
+
|
972
|
+
HookControllerA.stack[ 5 ].module.should == E
|
973
|
+
HookControllerA.stack[ 5 ].owner.should == instance_controller.instance
|
974
|
+
HookControllerA.stack[ 5 ].action.should == :include
|
975
|
+
HookControllerA.stack[ 5 ].cascades.should == nil
|
976
|
+
HookControllerA.stack[ 5 ].block.should == nil
|
977
|
+
|
978
|
+
# A
|
979
|
+
|
980
|
+
HookControllerB.stack[ 0 ].module.should == A
|
981
|
+
HookControllerB.stack[ 0 ].owner.should == instance_controller.instance
|
982
|
+
HookControllerB.stack[ 0 ].action.should == :include
|
983
|
+
HookControllerB.stack[ 0 ].cascades.should == nil
|
984
|
+
HookControllerB.stack[ 0 ].block.should == nil
|
985
|
+
|
986
|
+
# B
|
987
|
+
|
988
|
+
HookControllerB.stack[ 1 ].module.should == B
|
989
|
+
HookControllerB.stack[ 1 ].owner.should == instance_controller.instance
|
990
|
+
HookControllerB.stack[ 1 ].action.should == :include
|
991
|
+
HookControllerB.stack[ 1 ].cascades.should == nil
|
992
|
+
HookControllerB.stack[ 1 ].block.should == nil
|
993
|
+
|
994
|
+
# C
|
995
|
+
|
996
|
+
HookControllerB.stack[ 2 ].module.should == C
|
997
|
+
HookControllerB.stack[ 2 ].owner.should == instance_controller.instance
|
998
|
+
HookControllerB.stack[ 2 ].action.should == :extend
|
999
|
+
HookControllerB.stack[ 2 ].cascades.should == nil
|
1000
|
+
HookControllerB.stack[ 2 ].block.should == nil
|
1001
|
+
|
1002
|
+
# F
|
1003
|
+
|
1004
|
+
HookControllerB.stack[ 3 ].module.should == F
|
1005
|
+
HookControllerB.stack[ 3 ].owner.should == instance_controller.instance
|
1006
|
+
HookControllerB.stack[ 3 ].action.should == :extend
|
1007
|
+
HookControllerB.stack[ 3 ].cascades.should == nil
|
1008
|
+
HookControllerB.stack[ 3 ].block.should == nil
|
1009
|
+
|
1010
|
+
# D
|
1011
|
+
|
1012
|
+
HookControllerB.stack[ 4 ].module.should == D
|
1013
|
+
HookControllerB.stack[ 4 ].owner.should == instance_controller.instance
|
1014
|
+
HookControllerB.stack[ 4 ].action.should == :extend
|
1015
|
+
HookControllerB.stack[ 4 ].cascades.should == nil
|
1016
|
+
HookControllerB.stack[ 4 ].block.should == nil
|
1017
|
+
|
1018
|
+
# E
|
1019
|
+
|
1020
|
+
HookControllerB.stack[ 5 ].module.should == E
|
1021
|
+
HookControllerB.stack[ 5 ].owner.should == instance_controller.instance
|
1022
|
+
HookControllerB.stack[ 5 ].action.should == :include
|
1023
|
+
HookControllerB.stack[ 5 ].cascades.should == nil
|
1024
|
+
HookControllerB.stack[ 5 ].block.should == nil
|
1025
|
+
|
1026
|
+
end
|
1027
|
+
end
|
1028
|
+
|
1029
|
+
#############################
|
1030
|
+
# after_include_or_extend #
|
1031
|
+
#############################
|
1032
|
+
|
1033
|
+
it 'can chain methods specifying context for include/extend as after a given module include or extend event' do
|
1034
|
+
module ::Module::Cluster::InstanceController::MultipleHookControllerProxy::AfterIncludeOrExtendMock
|
1035
|
+
|
1036
|
+
instance_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy::Mock::InstanceController
|
1037
|
+
HookControllerA = ::Module::Cluster::InstanceController::HookController.new( :mock_A, instance_controller )
|
1038
|
+
HookControllerB = ::Module::Cluster::InstanceController::HookController.new( :mock_B, instance_controller )
|
1039
|
+
multi_hook_controller = ::Module::Cluster::InstanceController::MultipleHookControllerProxy.new( :mock, HookControllerA, HookControllerB )
|
1040
|
+
|
1041
|
+
module A
|
1042
|
+
end
|
1043
|
+
module B
|
1044
|
+
end
|
1045
|
+
module C
|
1046
|
+
end
|
1047
|
+
module D
|
1048
|
+
end
|
1049
|
+
module E
|
1050
|
+
end
|
1051
|
+
module F
|
1052
|
+
end
|
1053
|
+
|
1054
|
+
multi_hook_controller.include( A, B ).extend( B, C ).include( C ).include_and_extend( D ).extend( A )
|
1055
|
+
|
1056
|
+
multi_hook_controller.after_include_or_extend( B ).extend( F )
|
1057
|
+
multi_hook_controller.after_include_or_extend( A ).include_and_extend( E )
|
1058
|
+
|
1059
|
+
# A - include
|
1060
|
+
|
1061
|
+
HookControllerA.stack[ 0 ].module.should == A
|
1062
|
+
HookControllerA.stack[ 0 ].owner.should == instance_controller.instance
|
1063
|
+
HookControllerA.stack[ 0 ].action.should == :include
|
1064
|
+
HookControllerA.stack[ 0 ].cascades.should == nil
|
1065
|
+
HookControllerA.stack[ 0 ].block.should == nil
|
1066
|
+
|
1067
|
+
# B - include
|
1068
|
+
|
1069
|
+
HookControllerA.stack[ 1 ].module.should == B
|
1070
|
+
HookControllerA.stack[ 1 ].owner.should == instance_controller.instance
|
1071
|
+
HookControllerA.stack[ 1 ].action.should == :include
|
1072
|
+
HookControllerA.stack[ 1 ].cascades.should == nil
|
1073
|
+
HookControllerA.stack[ 1 ].block.should == nil
|
1074
|
+
|
1075
|
+
# B - extend
|
1076
|
+
|
1077
|
+
HookControllerA.stack[ 2 ].module.should == B
|
1078
|
+
HookControllerA.stack[ 2 ].owner.should == instance_controller.instance
|
1079
|
+
HookControllerA.stack[ 2 ].action.should == :extend
|
1080
|
+
HookControllerA.stack[ 2 ].cascades.should == nil
|
1081
|
+
HookControllerA.stack[ 2 ].block.should == nil
|
1082
|
+
|
1083
|
+
# F - extend
|
1084
|
+
|
1085
|
+
HookControllerA.stack[ 3 ].module.should == F
|
1086
|
+
HookControllerA.stack[ 3 ].owner.should == instance_controller.instance
|
1087
|
+
HookControllerA.stack[ 3 ].action.should == :extend
|
1088
|
+
HookControllerA.stack[ 3 ].cascades.should == nil
|
1089
|
+
HookControllerA.stack[ 3 ].block.should == nil
|
1090
|
+
|
1091
|
+
|
1092
|
+
# C - extend
|
1093
|
+
|
1094
|
+
HookControllerA.stack[ 4 ].module.should == C
|
1095
|
+
HookControllerA.stack[ 4 ].owner.should == instance_controller.instance
|
1096
|
+
HookControllerA.stack[ 4 ].action.should == :extend
|
1097
|
+
HookControllerA.stack[ 4 ].cascades.should == nil
|
1098
|
+
HookControllerA.stack[ 4 ].block.should == nil
|
1099
|
+
|
1100
|
+
# C - include
|
1101
|
+
|
1102
|
+
HookControllerA.stack[ 5 ].module.should == C
|
1103
|
+
HookControllerA.stack[ 5 ].owner.should == instance_controller.instance
|
1104
|
+
HookControllerA.stack[ 5 ].action.should == :include
|
1105
|
+
HookControllerA.stack[ 5 ].cascades.should == nil
|
1106
|
+
HookControllerA.stack[ 5 ].block.should == nil
|
1107
|
+
|
1108
|
+
# D - include
|
1109
|
+
|
1110
|
+
HookControllerA.stack[ 6 ].module.should == D
|
1111
|
+
HookControllerA.stack[ 6 ].owner.should == instance_controller.instance
|
1112
|
+
HookControllerA.stack[ 6 ].action.should == :include
|
1113
|
+
HookControllerA.stack[ 6 ].cascades.should == nil
|
1114
|
+
HookControllerA.stack[ 6 ].block.should == nil
|
1115
|
+
|
1116
|
+
# D - extend
|
1117
|
+
|
1118
|
+
HookControllerA.stack[ 7 ].module.should == D
|
1119
|
+
HookControllerA.stack[ 7 ].owner.should == instance_controller.instance
|
1120
|
+
HookControllerA.stack[ 7 ].action.should == :extend
|
1121
|
+
HookControllerA.stack[ 7 ].cascades.should == nil
|
1122
|
+
HookControllerA.stack[ 7 ].block.should == nil
|
1123
|
+
|
1124
|
+
# A - extend
|
1125
|
+
|
1126
|
+
HookControllerA.stack[ 8 ].module.should == A
|
1127
|
+
HookControllerA.stack[ 8 ].owner.should == instance_controller.instance
|
1128
|
+
HookControllerA.stack[ 8 ].action.should == :extend
|
1129
|
+
HookControllerA.stack[ 8 ].cascades.should == nil
|
1130
|
+
HookControllerA.stack[ 8 ].block.should == nil
|
1131
|
+
|
1132
|
+
# E - include
|
1133
|
+
|
1134
|
+
HookControllerA.stack[ 9 ].module.should == E
|
1135
|
+
HookControllerA.stack[ 9 ].owner.should == instance_controller.instance
|
1136
|
+
HookControllerA.stack[ 9 ].action.should == :include
|
1137
|
+
HookControllerA.stack[ 9 ].cascades.should == nil
|
1138
|
+
HookControllerA.stack[ 9 ].block.should == nil
|
1139
|
+
|
1140
|
+
# E - extend
|
1141
|
+
|
1142
|
+
HookControllerA.stack[ 10 ].module.should == E
|
1143
|
+
HookControllerA.stack[ 10 ].owner.should == instance_controller.instance
|
1144
|
+
HookControllerA.stack[ 10 ].action.should == :extend
|
1145
|
+
HookControllerA.stack[ 10 ].cascades.should == nil
|
1146
|
+
HookControllerA.stack[ 10 ].block.should == nil
|
1147
|
+
|
1148
|
+
# A - include
|
1149
|
+
|
1150
|
+
HookControllerB.stack[ 0 ].module.should == A
|
1151
|
+
HookControllerB.stack[ 0 ].owner.should == instance_controller.instance
|
1152
|
+
HookControllerB.stack[ 0 ].action.should == :include
|
1153
|
+
HookControllerB.stack[ 0 ].cascades.should == nil
|
1154
|
+
HookControllerB.stack[ 0 ].block.should == nil
|
1155
|
+
|
1156
|
+
# B - include
|
1157
|
+
|
1158
|
+
HookControllerB.stack[ 1 ].module.should == B
|
1159
|
+
HookControllerB.stack[ 1 ].owner.should == instance_controller.instance
|
1160
|
+
HookControllerB.stack[ 1 ].action.should == :include
|
1161
|
+
HookControllerB.stack[ 1 ].cascades.should == nil
|
1162
|
+
HookControllerB.stack[ 1 ].block.should == nil
|
1163
|
+
|
1164
|
+
# B - extend
|
1165
|
+
|
1166
|
+
HookControllerB.stack[ 2 ].module.should == B
|
1167
|
+
HookControllerB.stack[ 2 ].owner.should == instance_controller.instance
|
1168
|
+
HookControllerB.stack[ 2 ].action.should == :extend
|
1169
|
+
HookControllerB.stack[ 2 ].cascades.should == nil
|
1170
|
+
HookControllerB.stack[ 2 ].block.should == nil
|
1171
|
+
|
1172
|
+
# F - extend
|
1173
|
+
|
1174
|
+
HookControllerB.stack[ 3 ].module.should == F
|
1175
|
+
HookControllerB.stack[ 3 ].owner.should == instance_controller.instance
|
1176
|
+
HookControllerB.stack[ 3 ].action.should == :extend
|
1177
|
+
HookControllerB.stack[ 3 ].cascades.should == nil
|
1178
|
+
HookControllerB.stack[ 3 ].block.should == nil
|
1179
|
+
|
1180
|
+
|
1181
|
+
# C - extend
|
1182
|
+
|
1183
|
+
HookControllerB.stack[ 4 ].module.should == C
|
1184
|
+
HookControllerB.stack[ 4 ].owner.should == instance_controller.instance
|
1185
|
+
HookControllerB.stack[ 4 ].action.should == :extend
|
1186
|
+
HookControllerB.stack[ 4 ].cascades.should == nil
|
1187
|
+
HookControllerB.stack[ 4 ].block.should == nil
|
1188
|
+
|
1189
|
+
# C - include
|
1190
|
+
|
1191
|
+
HookControllerB.stack[ 5 ].module.should == C
|
1192
|
+
HookControllerB.stack[ 5 ].owner.should == instance_controller.instance
|
1193
|
+
HookControllerB.stack[ 5 ].action.should == :include
|
1194
|
+
HookControllerB.stack[ 5 ].cascades.should == nil
|
1195
|
+
HookControllerB.stack[ 5 ].block.should == nil
|
1196
|
+
|
1197
|
+
# D - include
|
1198
|
+
|
1199
|
+
HookControllerB.stack[ 6 ].module.should == D
|
1200
|
+
HookControllerB.stack[ 6 ].owner.should == instance_controller.instance
|
1201
|
+
HookControllerB.stack[ 6 ].action.should == :include
|
1202
|
+
HookControllerB.stack[ 6 ].cascades.should == nil
|
1203
|
+
HookControllerB.stack[ 6 ].block.should == nil
|
1204
|
+
|
1205
|
+
# D - extend
|
1206
|
+
|
1207
|
+
HookControllerB.stack[ 7 ].module.should == D
|
1208
|
+
HookControllerB.stack[ 7 ].owner.should == instance_controller.instance
|
1209
|
+
HookControllerB.stack[ 7 ].action.should == :extend
|
1210
|
+
HookControllerB.stack[ 7 ].cascades.should == nil
|
1211
|
+
HookControllerB.stack[ 7 ].block.should == nil
|
1212
|
+
|
1213
|
+
# A - extend
|
1214
|
+
|
1215
|
+
HookControllerB.stack[ 8 ].module.should == A
|
1216
|
+
HookControllerB.stack[ 8 ].owner.should == instance_controller.instance
|
1217
|
+
HookControllerB.stack[ 8 ].action.should == :extend
|
1218
|
+
HookControllerB.stack[ 8 ].cascades.should == nil
|
1219
|
+
HookControllerB.stack[ 8 ].block.should == nil
|
1220
|
+
|
1221
|
+
# E - include
|
1222
|
+
|
1223
|
+
HookControllerB.stack[ 9 ].module.should == E
|
1224
|
+
HookControllerB.stack[ 9 ].owner.should == instance_controller.instance
|
1225
|
+
HookControllerB.stack[ 9 ].action.should == :include
|
1226
|
+
HookControllerB.stack[ 9 ].cascades.should == nil
|
1227
|
+
HookControllerB.stack[ 9 ].block.should == nil
|
1228
|
+
|
1229
|
+
# E - extend
|
1230
|
+
|
1231
|
+
HookControllerB.stack[ 10 ].module.should == E
|
1232
|
+
HookControllerB.stack[ 10 ].owner.should == instance_controller.instance
|
1233
|
+
HookControllerB.stack[ 10 ].action.should == :extend
|
1234
|
+
HookControllerB.stack[ 10 ].cascades.should == nil
|
1235
|
+
HookControllerB.stack[ 10 ].block.should == nil
|
1236
|
+
|
1237
|
+
end
|
1238
|
+
end
|
1239
|
+
|
1240
|
+
end
|