module-cluster 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. data/lib/module-cluster.rb +17 -13
  2. data/lib/module-cluster/ModuleCluster.rb +8 -8
  3. data/lib/module-cluster/ModuleCluster/CascadeFeatures.rb +155 -0
  4. data/lib/module-cluster/ModuleCluster/ClusterStack.rb +102 -0
  5. data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +203 -0
  6. data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +220 -0
  7. data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +209 -0
  8. data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +209 -0
  9. data/lib/module-cluster/ModuleCluster/Define/ClusterStack.rb +26 -0
  10. data/lib/module-cluster/ModuleCluster/Define/DedoubleAncestors.rb +22 -0
  11. data/lib/module-cluster/ModuleCluster/ExtendForCascade.rb +15 -0
  12. data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +421 -0
  13. data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +432 -0
  14. data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +345 -0
  15. data/spec/ModuleCluster/Define/Cluster_spec.rb +275 -0
  16. data/spec/ModuleCluster_spec.rb +4 -4
  17. metadata +16 -14
  18. data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +0 -211
  19. data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascades.rb +0 -223
  20. data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascadesToClass.rb +0 -223
  21. data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascadesToModule.rb +0 -227
  22. data/lib/module-cluster/ModuleCluster/Define/_private_/AnonymousModule.rb +0 -121
  23. data/lib/module-cluster/ModuleCluster/Define/_private_/ClusterStack.rb +0 -55
  24. data/spec/ModuleCluster/Define/ModuleClusterCascadesToClass_spec.rb +0 -421
  25. data/spec/ModuleCluster/Define/ModuleClusterCascadesToModule_spec.rb +0 -432
  26. data/spec/ModuleCluster/Define/ModuleClusterCascades_spec.rb +0 -345
  27. data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +0 -275
  28. data/spec/ModuleCluster/Define/_private_/ClusterStack_spec.rb +0 -24
@@ -0,0 +1,26 @@
1
+
2
+ module ModuleCluster::Define::ClusterStack
3
+
4
+ ###################
5
+ # cluster_stack #
6
+ ###################
7
+
8
+ def cluster_stack
9
+
10
+ cluster_stack = nil
11
+
12
+ class_or_module_self = self
13
+
14
+ ModuleCluster::Define::ClusterStack.module_eval do
15
+ @cluster_stacks ||= Hash.new
16
+ unless cluster_stack = @cluster_stacks[ class_or_module_self ]
17
+ cluster_stack ||= ModuleCluster::ClusterStack.new
18
+ @cluster_stacks[ class_or_module_self ] = cluster_stack
19
+ end
20
+ end
21
+
22
+ return cluster_stack
23
+
24
+ end
25
+
26
+ end
@@ -0,0 +1,22 @@
1
+
2
+ module ModuleCluster::Define::DedoubleAncestors
3
+
4
+ ####################################
5
+ # dedouble_modules_for_ancestors #
6
+ ####################################
7
+
8
+ def dedouble_modules_for_ancestors( include_or_extend, *modules )
9
+
10
+ case include_or_extend
11
+ when :include
12
+ modules -= ancestors
13
+ when :extend
14
+ eigenclass = class << self ; self ; end
15
+ modules -= eigenclass.ancestors
16
+ end
17
+
18
+ return modules
19
+
20
+ end
21
+
22
+ end
@@ -0,0 +1,15 @@
1
+
2
+ module ModuleCluster::ExtendForCascade
3
+
4
+ ##############
5
+ # extended #
6
+ ##############
7
+
8
+ def extended( class_or_module )
9
+ super
10
+ class_or_module.module_eval do
11
+ extend ModuleCluster::CascadeFeatures
12
+ end unless class_or_module.is_a?( Class )
13
+ end
14
+
15
+ end
@@ -0,0 +1,421 @@
1
+
2
+ require_relative '../../../lib/module-cluster.rb'
3
+
4
+ describe ModuleCluster::Define::ClusterCascadesToClass do
5
+
6
+ ########################################
7
+ # include_cascades_includes_to_class #
8
+ ########################################
9
+
10
+ it 'include modules for any class this module or any including modules are included in' do
11
+ module ModuleCluster::Define::ClusterCascadesToClass::Mock01
12
+ extend ModuleCluster::Define::ClusterCascadesToClass
13
+ module Module1
14
+ end
15
+ module Module2
16
+ end
17
+ include_cascades_includes_to_class( Module1, Module2 )
18
+ respond_to?( :included ).should == true
19
+ module Proof1
20
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock01
21
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock01::Module1 ).should == false
22
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock01::Module2 ).should == false
23
+ end
24
+ module Proof2
25
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock01::Proof1
26
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock01::Module1 ).should == false
27
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock01::Module2 ).should == false
28
+ end
29
+ class Proof3
30
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock01::Proof2
31
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock01::Module1 ).should == true
32
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock01::Module2 ).should == true
33
+ end
34
+ end
35
+ end
36
+
37
+ #######################################
38
+ # include_cascades_extends_to_class #
39
+ #######################################
40
+
41
+ it 'extends modules for any class this module or any including modules are included in' do
42
+ module ModuleCluster::Define::ClusterCascadesToClass::Mock02
43
+ extend ModuleCluster::Define::ClusterCascadesToClass
44
+ module Module1
45
+ end
46
+ module Module2
47
+ end
48
+ include_cascades_extends_to_class( Module1, Module2 )
49
+ respond_to?( :included ).should == true
50
+ module Proof1
51
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock02
52
+ eigenclass = class << self ; self ; end
53
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock02::Module1 ).should == false
54
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock02::Module2 ).should == false
55
+ end
56
+ module Proof2
57
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock02::Proof1
58
+ eigenclass = class << self ; self ; end
59
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock02::Module1 ).should == false
60
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock02::Module2 ).should == false
61
+ end
62
+ class Proof3
63
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock02::Proof2
64
+ eigenclass = class << self ; self ; end
65
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock02::Module1 ).should == true
66
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock02::Module2 ).should == true
67
+ end
68
+ end
69
+ end
70
+
71
+ ####################################################
72
+ # include_cascades_includes_and_extends_to_class #
73
+ ####################################################
74
+
75
+ it 'include and extends modules for any class this module or any including modules are included in' do
76
+ module ModuleCluster::Define::ClusterCascadesToClass::Mock03
77
+ extend ModuleCluster::Define::ClusterCascadesToClass
78
+ module Module1
79
+ end
80
+ module Module2
81
+ end
82
+ include_cascades_includes_and_extends_to_class( Module1, Module2 )
83
+ respond_to?( :included ).should == true
84
+ module Proof1
85
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock03
86
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock03::Module1 ).should == false
87
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock03::Module2 ).should == false
88
+ eigenclass = class << self ; self ; end
89
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock03::Module1 ).should == false
90
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock03::Module2 ).should == false
91
+ end
92
+ module Proof2
93
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock03::Proof1
94
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock03::Module1 ).should == false
95
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock03::Module2 ).should == false
96
+ eigenclass = class << self ; self ; end
97
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock03::Module1 ).should == false
98
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock03::Module2 ).should == false
99
+ end
100
+ class Proof3
101
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock03::Proof2
102
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock03::Module1 ).should == true
103
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock03::Module2 ).should == true
104
+ eigenclass = class << self ; self ; end
105
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock03::Module1 ).should == true
106
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock03::Module2 ).should == true
107
+ end
108
+ end
109
+ end
110
+
111
+ #######################################
112
+ # extend_cascades_includes_to_class #
113
+ #######################################
114
+
115
+ it 'include modules for any class this module is extended in' do
116
+ module ModuleCluster::Define::ClusterCascadesToClass::Mock04
117
+ extend ModuleCluster::Define::ClusterCascadesToClass
118
+ module Module1
119
+ end
120
+ module Module2
121
+ end
122
+ extend_cascades_includes_to_class( Module1, Module2 )
123
+ respond_to?( :extended ).should == true
124
+ module Proof1
125
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock04
126
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock04::Module1 ).should == false
127
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock04::Module2 ).should == false
128
+ end
129
+ module Proof2
130
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock04::Proof1
131
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock04::Module1 ).should == false
132
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock04::Module2 ).should == false
133
+ end
134
+ class Proof3
135
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock04::Proof2
136
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock04::Module1 ).should == true
137
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock04::Module2 ).should == true
138
+ end
139
+ end
140
+ end
141
+
142
+ ######################################
143
+ # extend_cascades_extends_to_class #
144
+ ######################################
145
+
146
+ it 'extend modules for any class this module is extended in' do
147
+ module ModuleCluster::Define::ClusterCascadesToClass::Mock05
148
+ extend ModuleCluster::Define::ClusterCascadesToClass
149
+ module Module1
150
+ end
151
+ module Module2
152
+ end
153
+ extend_cascades_extends_to_class( Module1, Module2 )
154
+ respond_to?( :extended ).should == true
155
+ module Proof1
156
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock05
157
+ eigenclass = class << self ; self ; end
158
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock05::Module1 ).should == false
159
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock05::Module2 ).should == false
160
+ end
161
+ module Proof2
162
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock05::Proof1
163
+ eigenclass = class << self ; self ; end
164
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock05::Module1 ).should == false
165
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock05::Module2 ).should == false
166
+ end
167
+ class Proof3
168
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock05::Proof2
169
+ eigenclass = class << self ; self ; end
170
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock05::Module1 ).should == true
171
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock05::Module2 ).should == true
172
+ end
173
+ end
174
+ end
175
+
176
+ ###################################################
177
+ # extend_cascades_includes_and_extends_to_class #
178
+ ###################################################
179
+
180
+ it 'include and extend modules for any class this module is extended in' do
181
+ module ModuleCluster::Define::ClusterCascadesToClass::Mock06
182
+ extend ModuleCluster::Define::ClusterCascadesToClass
183
+ module Module1
184
+ end
185
+ module Module2
186
+ end
187
+ extend_cascades_includes_and_extends_to_class( Module1, Module2 )
188
+ respond_to?( :extended ).should == true
189
+ module Proof1
190
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock06
191
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock06::Module1 ).should == false
192
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock06::Module2 ).should == false
193
+ eigenclass = class << self ; self ; end
194
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock06::Module1 ).should == false
195
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock06::Module2 ).should == false
196
+ end
197
+ module Proof2
198
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock06::Proof1
199
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock06::Module1 ).should == false
200
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock06::Module2 ).should == false
201
+ eigenclass = class << self ; self ; end
202
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock06::Module1 ).should == false
203
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock06::Module2 ).should == false
204
+ end
205
+ class Proof3
206
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock06::Proof2
207
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock06::Module1 ).should == true
208
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock06::Module2 ).should == true
209
+ eigenclass = class << self ; self ; end
210
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock06::Module1 ).should == true
211
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock06::Module2 ).should == true
212
+ end
213
+ end
214
+ end
215
+
216
+ ###################################################
217
+ # include_cascades_to_class_prepending_includes #
218
+ ###################################################
219
+
220
+ it 'include other modules for any class this module or any including modules are included in, before this module or including module is included' do
221
+ module ModuleCluster::Define::ClusterCascadesToClass::Mock07
222
+ extend ModuleCluster::Define::ClusterCascadesToClass
223
+ module Module1
224
+ end
225
+ module Module2
226
+ end
227
+ include_cascades_to_class_prepending_includes( Module1, Module2 )
228
+ respond_to?( :append_features ).should == true
229
+ module Proof1
230
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock07
231
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock07::Module1 ).should == false
232
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock07::Module2 ).should == false
233
+ end
234
+ module Proof2
235
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock07::Proof1
236
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock07::Module1 ).should == false
237
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock07::Module2 ).should == false
238
+ end
239
+ class Proof3
240
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock07::Proof2
241
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock07::Module1 ).should == true
242
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock07::Module2 ).should == true
243
+ end
244
+ end
245
+ end
246
+
247
+ ##################################################
248
+ # include_cascades_to_class_prepending_extends #
249
+ ##################################################
250
+
251
+ it 'extend other modules for any class this module or any including modules are included in, before this module or including module is included' do
252
+ module ModuleCluster::Define::ClusterCascadesToClass::Mock08
253
+ extend ModuleCluster::Define::ClusterCascadesToClass
254
+ module Module1
255
+ end
256
+ module Module2
257
+ end
258
+ include_cascades_to_class_prepending_extends( Module1, Module2 )
259
+ respond_to?( :append_features ).should == true
260
+ module Proof1
261
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock08
262
+ eigenclass = class << self ; self ; end
263
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock08::Module1 ).should == false
264
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock08::Module2 ).should == false
265
+ end
266
+ module Proof2
267
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock08::Proof1
268
+ eigenclass = class << self ; self ; end
269
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock08::Module1 ).should == false
270
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock08::Module2 ).should == false
271
+ end
272
+ class Proof3
273
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock08::Proof2
274
+ eigenclass = class << self ; self ; end
275
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock08::Module1 ).should == true
276
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock08::Module2 ).should == true
277
+ end
278
+ end
279
+ end
280
+
281
+ ###############################################################
282
+ # include_cascades_to_class_prepending_includes_and_extends #
283
+ ###############################################################
284
+
285
+ it 'include and extend other modules for any class this module or any including modules are included in, before this module or including module is included' do
286
+ module ModuleCluster::Define::ClusterCascadesToClass::Mock09
287
+ extend ModuleCluster::Define::ClusterCascadesToClass
288
+ module Module1
289
+ end
290
+ module Module2
291
+ end
292
+ include_cascades_to_class_prepending_includes_and_extends( Module1, Module2 )
293
+ respond_to?( :append_features ).should == true
294
+ module Proof1
295
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock09
296
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock09::Module1 ).should == false
297
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock09::Module2 ).should == false
298
+ eigenclass = class << self ; self ; end
299
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock09::Module1 ).should == false
300
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock09::Module2 ).should == false
301
+ end
302
+ module Proof2
303
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock09::Proof1
304
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock09::Module1 ).should == false
305
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock09::Module2 ).should == false
306
+ eigenclass = class << self ; self ; end
307
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock09::Module1 ).should == false
308
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock09::Module2 ).should == false
309
+ end
310
+ class Proof3
311
+ include ModuleCluster::Define::ClusterCascadesToClass::Mock09::Proof2
312
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock09::Module1 ).should == true
313
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock09::Module2 ).should == true
314
+ eigenclass = class << self ; self ; end
315
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock09::Module1 ).should == true
316
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock09::Module2 ).should == true
317
+ end
318
+ end
319
+ end
320
+
321
+ ##################################################
322
+ # extend_cascades_to_class_prepending_includes #
323
+ ##################################################
324
+
325
+ it 'include other modules for any class this module or any including modules are included in, before this module is extended' do
326
+ module ModuleCluster::Define::ClusterCascadesToClass::Mock10
327
+ extend ModuleCluster::Define::ClusterCascadesToClass
328
+ module Module1
329
+ end
330
+ module Module2
331
+ end
332
+ extend_cascades_to_class_prepending_includes( Module1, Module2 )
333
+ respond_to?( :extend_object ).should == true
334
+ module Proof1
335
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock10
336
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock10::Module1 ).should == false
337
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock10::Module2 ).should == false
338
+ end
339
+ module Proof2
340
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock10::Proof1
341
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock10::Module1 ).should == false
342
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock10::Module2 ).should == false
343
+ end
344
+ class Proof3
345
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock10::Proof2
346
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock10::Module1 ).should == true
347
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock10::Module2 ).should == true
348
+ end
349
+ end
350
+ end
351
+
352
+ #################################################
353
+ # extend_cascades_to_class_prepending_extends #
354
+ #################################################
355
+
356
+ it 'extend other modules for any class this module or any including modules are included in, before this module is extended' do
357
+ module ModuleCluster::Define::ClusterCascadesToClass::Mock11
358
+ extend ModuleCluster::Define::ClusterCascadesToClass
359
+ module Module1
360
+ end
361
+ module Module2
362
+ end
363
+ extend_cascades_to_class_prepending_extends( Module1, Module2 )
364
+ respond_to?( :extend_object ).should == true
365
+ module Proof1
366
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock11
367
+ eigenclass = class << self ; self ; end
368
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock11::Module1 ).should == false
369
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock11::Module2 ).should == false
370
+ end
371
+ module Proof2
372
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock11::Proof1
373
+ eigenclass = class << self ; self ; end
374
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock11::Module1 ).should == false
375
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock11::Module2 ).should == false
376
+ end
377
+ class Proof3
378
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock11::Proof2
379
+ eigenclass = class << self ; self ; end
380
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock11::Module1 ).should == true
381
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock11::Module2 ).should == true
382
+ end
383
+ end
384
+ end
385
+
386
+ ##############################################################
387
+ # extend_cascades_to_class_prepending_includes_and_extends #
388
+ ##############################################################
389
+
390
+ it 'include and extend other modules for any class this module or any including modules are included in, before this module is extended' do
391
+ module ModuleCluster::Define::ClusterCascadesToClass::Mock12
392
+ extend ModuleCluster::Define::ClusterCascadesToClass
393
+ module Module1
394
+ end
395
+ module Module2
396
+ end
397
+ extend_cascades_to_class_prepending_includes_and_extends( Module1, Module2 )
398
+ respond_to?( :extend_object ).should == true
399
+ module Proof1
400
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock12
401
+ end
402
+ module Proof2
403
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock12::Proof1
404
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock12::Module1 ).should == false
405
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock12::Module2 ).should == false
406
+ eigenclass = class << self ; self ; end
407
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock12::Module1 ).should == false
408
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock12::Module2 ).should == false
409
+ end
410
+ class Proof3
411
+ extend ModuleCluster::Define::ClusterCascadesToClass::Mock12::Proof2
412
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock12::Module1 ).should == true
413
+ ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock12::Module2 ).should == true
414
+ eigenclass = class << self ; self ; end
415
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock12::Module1 ).should == true
416
+ eigenclass.ancestors.include?( ModuleCluster::Define::ClusterCascadesToClass::Mock12::Module2 ).should == true
417
+ end
418
+ end
419
+ end
420
+
421
+ end