module-cluster 1.1.1 → 1.2.0

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