module-cluster 1.3.7 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/README.md +146 -1
  2. data/README.rdoc +146 -1
  3. data/lib/module-cluster.rb +54 -12
  4. data/lib/module-cluster/ModuleCluster/Define/Block.rb +3 -0
  5. data/lib/module-cluster/ModuleCluster/Define/Block/Class.rb +16 -4
  6. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrInstance.rb +63 -0
  7. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb +2 -0
  8. data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrInstance.rb +63 -0
  9. data/lib/module-cluster/ModuleCluster/Define/Block/Instance.rb +32 -0
  10. data/lib/module-cluster/ModuleCluster/Define/Block/Module.rb +16 -4
  11. data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrInstance.rb +63 -0
  12. data/lib/module-cluster/ModuleCluster/Define/ClassCluster.rb +200 -0
  13. data/lib/module-cluster/ModuleCluster/Define/ClassOrInstanceCluster.rb +127 -0
  14. data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +7 -19
  15. data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +5 -20
  16. data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +9 -26
  17. data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +9 -26
  18. data/lib/module-cluster/ModuleCluster/Define/InstanceCluster.rb +46 -0
  19. data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +200 -0
  20. data/lib/module-cluster/ModuleCluster/Define/ModuleOrClassCluster.rb +208 -0
  21. data/lib/module-cluster/ModuleCluster/Define/ModuleOrInstanceCluster.rb +127 -0
  22. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures.rb +54 -0
  23. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/ClusterStack.rb +44 -0
  24. data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/PerformCascades.rb +209 -0
  25. data/lib/module-cluster/{ModuleCluster → _private_/ModuleCluster}/ClusterStack.rb +0 -2
  26. data/lib/module-cluster/{ModuleCluster → _private_/ModuleCluster}/ClusterStack/Block.rb +1 -2
  27. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Class.rb +36 -0
  28. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Instance.rb +20 -0
  29. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Module.rb +36 -0
  30. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Set.rb +2 -0
  31. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Extends.rb +108 -0
  32. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Includes.rb +84 -0
  33. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsExtends.rb +108 -0
  34. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsIncludes.rb +84 -0
  35. data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set.rb +7 -0
  36. data/lib/module-cluster/{ModuleCluster → _private_/ModuleCluster}/ExtendForCascade.rb +0 -0
  37. data/spec/ModuleCluster/Define/Block/ClassOrInstance_spec.rb +230 -0
  38. data/spec/ModuleCluster/Define/Block/ClassOrModuleOrInstance_spec.rb +238 -0
  39. data/spec/ModuleCluster/Define/Block/ClassOrModule_spec.rb +231 -0
  40. data/spec/ModuleCluster/Define/Block/Class_spec.rb +224 -0
  41. data/spec/ModuleCluster/Define/Block/Instance_spec.rb +78 -0
  42. data/spec/ModuleCluster/Define/Block/ModuleOrInstance_spec.rb +54 -0
  43. data/spec/ModuleCluster/Define/Block/Module_spec.rb +224 -0
  44. data/spec/ModuleCluster/Define/Block_spec.rb +18 -0
  45. data/spec/ModuleCluster/Define/ClassCluster_spec.rb +728 -0
  46. data/spec/ModuleCluster/Define/ClassOrInstanceCluster_spec.rb +576 -0
  47. data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +298 -60
  48. data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +307 -61
  49. data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +335 -36
  50. data/spec/ModuleCluster/Define/Cluster_spec.rb +447 -14
  51. data/spec/ModuleCluster/Define/InstanceCluster_spec.rb +102 -0
  52. data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +728 -0
  53. data/spec/ModuleCluster/Define/ModuleOrClassCluster_spec.rb +728 -0
  54. data/spec/ModuleCluster/Define/ModuleOrInstanceCluster_spec.rb +576 -0
  55. data/spec/_private_/ModuleCluster/CascadeFeatures/PerformCascades_spec.rb +278 -0
  56. metadata +42 -13
  57. data/lib/module-cluster/ModuleCluster/CascadeFeatures.rb +0 -197
  58. data/lib/module-cluster/ModuleCluster/ClusterStack/Block/Class.rb +0 -36
  59. data/lib/module-cluster/ModuleCluster/ClusterStack/Block/Module.rb +0 -36
  60. data/lib/module-cluster/ModuleCluster/ClusterStack/Extends.rb +0 -29
  61. data/lib/module-cluster/ModuleCluster/ClusterStack/Includes.rb +0 -28
  62. data/lib/module-cluster/ModuleCluster/ClusterStack/PrependsExtends.rb +0 -28
  63. data/lib/module-cluster/ModuleCluster/ClusterStack/PrependsIncludes.rb +0 -28
  64. data/lib/module-cluster/ModuleCluster/Define/ClusterStack.rb +0 -26
@@ -16,10 +16,21 @@ describe ModuleCluster::Define::Cluster do
16
16
  end
17
17
  include_also_includes( Module1, Module2 )
18
18
  respond_to?( :included ).should == true
19
- module Proof
19
+ module ModuleProof
20
20
  include ModuleCluster::Define::Cluster::Mock01
21
21
  ancestors.include?( ModuleCluster::Define::Cluster::Mock01::Module1 ).should == true
22
22
  ancestors.include?( ModuleCluster::Define::Cluster::Mock01::Module2 ).should == true
23
+ eigenclass = class << self ; self ; end
24
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock01::Module1 ).should == false
25
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock01::Module2 ).should == false
26
+ end
27
+ class ClassProof
28
+ include ModuleCluster::Define::Cluster::Mock01
29
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock01::Module1 ).should == true
30
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock01::Module2 ).should == true
31
+ eigenclass = class << self ; self ; end
32
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock01::Module1 ).should == false
33
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock01::Module2 ).should == false
23
34
  end
24
35
  end
25
36
  end
@@ -37,8 +48,18 @@ describe ModuleCluster::Define::Cluster do
37
48
  end
38
49
  include_also_extends( Module1, Module2 )
39
50
  respond_to?( :included ).should == true
40
- module Proof
51
+ module ModuleProof
41
52
  include ModuleCluster::Define::Cluster::Mock02
53
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock02::Module1 ).should == false
54
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock02::Module2 ).should == false
55
+ eigenclass = class << self ; self ; end
56
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock02::Module1 ).should == true
57
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock02::Module2 ).should == true
58
+ end
59
+ class ClassProof
60
+ include ModuleCluster::Define::Cluster::Mock02
61
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock02::Module1 ).should == false
62
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock02::Module2 ).should == false
42
63
  eigenclass = class << self ; self ; end
43
64
  eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock02::Module1 ).should == true
44
65
  eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock02::Module2 ).should == true
@@ -59,7 +80,7 @@ describe ModuleCluster::Define::Cluster do
59
80
  end
60
81
  include_also_includes_and_extends( Module1, Module2 )
61
82
  respond_to?( :included ).should == true
62
- module Proof
83
+ module ModuleProof
63
84
  include ModuleCluster::Define::Cluster::Mock03
64
85
  ancestors.include?( ModuleCluster::Define::Cluster::Mock03::Module1 ).should == true
65
86
  ancestors.include?( ModuleCluster::Define::Cluster::Mock03::Module2 ).should == true
@@ -67,8 +88,15 @@ describe ModuleCluster::Define::Cluster do
67
88
  eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock03::Module1 ).should == true
68
89
  eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock03::Module2 ).should == true
69
90
  end
70
- end
71
-
91
+ class ClassProof
92
+ include ModuleCluster::Define::Cluster::Mock03
93
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock03::Module1 ).should == true
94
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock03::Module2 ).should == true
95
+ eigenclass = class << self ; self ; end
96
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock03::Module1 ).should == true
97
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock03::Module2 ).should == true
98
+ end
99
+ end
72
100
  end
73
101
 
74
102
  ##########################
@@ -84,10 +112,21 @@ describe ModuleCluster::Define::Cluster do
84
112
  end
85
113
  extend_also_includes( Module1, Module2 )
86
114
  respond_to?( :extended ).should == true
87
- module Proof
115
+ module ModuleProof
88
116
  extend ModuleCluster::Define::Cluster::Mock04
89
117
  ancestors.include?( ModuleCluster::Define::Cluster::Mock04::Module1 ).should == true
90
118
  ancestors.include?( ModuleCluster::Define::Cluster::Mock04::Module2 ).should == true
119
+ eigenclass = class << self ; self ; end
120
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock04::Module1 ).should == false
121
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock04::Module2 ).should == false
122
+ end
123
+ class ClassProof
124
+ extend ModuleCluster::Define::Cluster::Mock04
125
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock04::Module1 ).should == true
126
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock04::Module2 ).should == true
127
+ eigenclass = class << self ; self ; end
128
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock04::Module1 ).should == false
129
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock04::Module2 ).should == false
91
130
  end
92
131
  end
93
132
  end
@@ -105,7 +144,23 @@ describe ModuleCluster::Define::Cluster do
105
144
  end
106
145
  extend_also_extends( Module1, Module2 )
107
146
  respond_to?( :extended ).should == true
108
- module Proof
147
+ module ModuleProof
148
+ extend ModuleCluster::Define::Cluster::Mock05
149
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock05::Module1 ).should == false
150
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock05::Module2 ).should == false
151
+ eigenclass = class << self ; self ; end
152
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock05::Module1 ).should == true
153
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock05::Module2 ).should == true
154
+ end
155
+ class ClassProof
156
+ extend ModuleCluster::Define::Cluster::Mock05
157
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock05::Module1 ).should == false
158
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock05::Module2 ).should == false
159
+ eigenclass = class << self ; self ; end
160
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock05::Module1 ).should == true
161
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock05::Module2 ).should == true
162
+ end
163
+ Object.new.instance_eval do
109
164
  extend ModuleCluster::Define::Cluster::Mock05
110
165
  eigenclass = class << self ; self ; end
111
166
  eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock05::Module1 ).should == true
@@ -127,7 +182,7 @@ describe ModuleCluster::Define::Cluster do
127
182
  end
128
183
  extend_also_includes_and_extends( Module1, Module2 )
129
184
  respond_to?( :extended ).should == true
130
- module Proof
185
+ module ModuleProof
131
186
  extend ModuleCluster::Define::Cluster::Mock06
132
187
  ancestors.include?( ModuleCluster::Define::Cluster::Mock06::Module1 ).should == true
133
188
  ancestors.include?( ModuleCluster::Define::Cluster::Mock06::Module2 ).should == true
@@ -135,6 +190,20 @@ describe ModuleCluster::Define::Cluster do
135
190
  eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock06::Module1 ).should == true
136
191
  eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock06::Module2 ).should == true
137
192
  end
193
+ class ClassProof
194
+ extend ModuleCluster::Define::Cluster::Mock06
195
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock06::Module1 ).should == true
196
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock06::Module2 ).should == true
197
+ eigenclass = class << self ; self ; end
198
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock06::Module1 ).should == true
199
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock06::Module2 ).should == true
200
+ end
201
+ Object.new.instance_eval do
202
+ extend ModuleCluster::Define::Cluster::Mock06
203
+ eigenclass = class << self ; self ; end
204
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock06::Module1 ).should == true
205
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock06::Module2 ).should == true
206
+ end
138
207
  end
139
208
  end
140
209
 
@@ -151,10 +220,21 @@ describe ModuleCluster::Define::Cluster do
151
220
  end
152
221
  include_prepends_includes( Module1, Module2 )
153
222
  respond_to?( :append_features ).should == true
154
- module Proof
223
+ module ModuleProof
155
224
  include ModuleCluster::Define::Cluster::Mock07
156
225
  ancestors.include?( ModuleCluster::Define::Cluster::Mock07::Module1 ).should == true
157
226
  ancestors.include?( ModuleCluster::Define::Cluster::Mock07::Module2 ).should == true
227
+ eigenclass = class << self ; self ; end
228
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock07::Module1 ).should == false
229
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock07::Module2 ).should == false
230
+ end
231
+ class ClassProof
232
+ include ModuleCluster::Define::Cluster::Mock07
233
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock07::Module1 ).should == true
234
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock07::Module2 ).should == true
235
+ eigenclass = class << self ; self ; end
236
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock07::Module1 ).should == false
237
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock07::Module2 ).should == false
158
238
  end
159
239
  end
160
240
  end
@@ -172,8 +252,18 @@ describe ModuleCluster::Define::Cluster do
172
252
  end
173
253
  include_prepends_extends( Module1, Module2 )
174
254
  respond_to?( :append_features ).should == true
175
- module Proof
255
+ module ModuleProof
256
+ include ModuleCluster::Define::Cluster::Mock08
257
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock08::Module1 ).should == false
258
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock08::Module2 ).should == false
259
+ eigenclass = class << self ; self ; end
260
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock08::Module1 ).should == true
261
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock08::Module2 ).should == true
262
+ end
263
+ class ClassProof
176
264
  include ModuleCluster::Define::Cluster::Mock08
265
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock08::Module1 ).should == false
266
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock08::Module2 ).should == false
177
267
  eigenclass = class << self ; self ; end
178
268
  eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock08::Module1 ).should == true
179
269
  eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock08::Module2 ).should == true
@@ -194,7 +284,15 @@ describe ModuleCluster::Define::Cluster do
194
284
  end
195
285
  include_prepends_includes_and_extends( Module1, Module2 )
196
286
  respond_to?( :append_features ).should == true
197
- module Proof
287
+ module ModuleProof
288
+ include ModuleCluster::Define::Cluster::Mock09
289
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock09::Module1 ).should == true
290
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock09::Module2 ).should == true
291
+ eigenclass = class << self ; self ; end
292
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock09::Module1 ).should == true
293
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock09::Module2 ).should == true
294
+ end
295
+ class ClassProof
198
296
  include ModuleCluster::Define::Cluster::Mock09
199
297
  ancestors.include?( ModuleCluster::Define::Cluster::Mock09::Module1 ).should == true
200
298
  ancestors.include?( ModuleCluster::Define::Cluster::Mock09::Module2 ).should == true
@@ -218,10 +316,21 @@ describe ModuleCluster::Define::Cluster do
218
316
  end
219
317
  extend_prepends_includes( Module1, Module2 )
220
318
  respond_to?( :extend_object ).should == true
221
- module Proof
319
+ module ModuleProof
320
+ extend ModuleCluster::Define::Cluster::Mock10
321
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock10::Module1 ).should == true
322
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock10::Module2 ).should == true
323
+ eigenclass = class << self ; self ; end
324
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock10::Module1 ).should == false
325
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock10::Module2 ).should == false
326
+ end
327
+ class ClassProof
222
328
  extend ModuleCluster::Define::Cluster::Mock10
223
329
  ancestors.include?( ModuleCluster::Define::Cluster::Mock10::Module1 ).should == true
224
330
  ancestors.include?( ModuleCluster::Define::Cluster::Mock10::Module2 ).should == true
331
+ eigenclass = class << self ; self ; end
332
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock10::Module1 ).should == false
333
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock10::Module2 ).should == false
225
334
  end
226
335
  end
227
336
  end
@@ -239,7 +348,23 @@ describe ModuleCluster::Define::Cluster do
239
348
  end
240
349
  extend_prepends_extends( Module1, Module2 )
241
350
  respond_to?( :extend_object ).should == true
242
- module Proof
351
+ module ModuleProof
352
+ extend ModuleCluster::Define::Cluster::Mock11
353
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock11::Module1 ).should == false
354
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock11::Module2 ).should == false
355
+ eigenclass = class << self ; self ; end
356
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock11::Module1 ).should == true
357
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock11::Module2 ).should == true
358
+ end
359
+ class ClassProof
360
+ extend ModuleCluster::Define::Cluster::Mock11
361
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock11::Module1 ).should == false
362
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock11::Module2 ).should == false
363
+ eigenclass = class << self ; self ; end
364
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock11::Module1 ).should == true
365
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock11::Module2 ).should == true
366
+ end
367
+ Object.new.instance_eval do
243
368
  extend ModuleCluster::Define::Cluster::Mock11
244
369
  eigenclass = class << self ; self ; end
245
370
  eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock11::Module1 ).should == true
@@ -261,7 +386,7 @@ describe ModuleCluster::Define::Cluster do
261
386
  end
262
387
  extend_prepends_includes_and_extends( Module1, Module2 )
263
388
  respond_to?( :extend_object ).should == true
264
- module Proof
389
+ module ModuleProof
265
390
  extend ModuleCluster::Define::Cluster::Mock12
266
391
  ancestors.include?( ModuleCluster::Define::Cluster::Mock12::Module1 ).should == true
267
392
  ancestors.include?( ModuleCluster::Define::Cluster::Mock12::Module2 ).should == true
@@ -269,7 +394,315 @@ describe ModuleCluster::Define::Cluster do
269
394
  eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock12::Module1 ).should == true
270
395
  eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock12::Module2 ).should == true
271
396
  end
397
+ class ClassProof
398
+ extend ModuleCluster::Define::Cluster::Mock12
399
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock12::Module1 ).should == true
400
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock12::Module2 ).should == true
401
+ eigenclass = class << self ; self ; end
402
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock12::Module1 ).should == true
403
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock12::Module2 ).should == true
404
+ end
405
+ Object.new.instance_eval do
406
+ extend ModuleCluster::Define::Cluster::Mock12
407
+ eigenclass = class << self ; self ; end
408
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock12::Module1 ).should == true
409
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock12::Module2 ).should == true
410
+ end
272
411
  end
273
412
  end
274
413
 
414
+ #####################################
415
+ # include_or_extend_also_includes #
416
+ #####################################
417
+
418
+ it 'can include other modules when this one is included in or extends a class' do
419
+ module ModuleCluster::Define::Cluster::Mock13
420
+ extend ModuleCluster::Define::Cluster
421
+ module Module1
422
+ end
423
+ module Module2
424
+ end
425
+ include_or_extend_also_includes( Module1, Module2 )
426
+ respond_to?( :append_features ).should == true
427
+ module ModuleProof
428
+ include ModuleCluster::Define::Cluster::Mock13
429
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module1 ).should == true
430
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module2 ).should == true
431
+ eigenclass = class << self ; self ; end
432
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module1 ).should == false
433
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module2 ).should == false
434
+ end
435
+ module ModuleProof2
436
+ extend ModuleCluster::Define::Cluster::Mock13
437
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module1 ).should == true
438
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module2 ).should == true
439
+ eigenclass = class << self ; self ; end
440
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module1 ).should == false
441
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module2 ).should == false
442
+ end
443
+ class ClassProof
444
+ include ModuleCluster::Define::Cluster::Mock13
445
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module1 ).should == true
446
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module2 ).should == true
447
+ eigenclass = class << self ; self ; end
448
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module1 ).should == false
449
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module2 ).should == false
450
+ end
451
+ class ClassProof2
452
+ include ModuleCluster::Define::Cluster::Mock13
453
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module1 ).should == true
454
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module2 ).should == true
455
+ eigenclass = class << self ; self ; end
456
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module1 ).should == false
457
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock13::Module2 ).should == false
458
+ end
459
+ end
460
+ end
461
+
462
+ ####################################
463
+ # include_or_extend_also_extends #
464
+ ####################################
465
+
466
+ it 'can extend other modules when this one is included in or extends a class' do
467
+ module ModuleCluster::Define::Cluster::Mock14
468
+ extend ModuleCluster::Define::Cluster
469
+ module Module1
470
+ end
471
+ module Module2
472
+ end
473
+ include_or_extend_also_extends( Module1, Module2 )
474
+ respond_to?( :included ).should == true
475
+ module ModuleProof
476
+ include ModuleCluster::Define::Cluster::Mock14
477
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module1 ).should == false
478
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module2 ).should == false
479
+ eigenclass = class << self ; self ; end
480
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module1 ).should == true
481
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module2 ).should == true
482
+ end
483
+ module ModuleProof2
484
+ extend ModuleCluster::Define::Cluster::Mock14
485
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module1 ).should == false
486
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module2 ).should == false
487
+ eigenclass = class << self ; self ; end
488
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module1 ).should == true
489
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module2 ).should == true
490
+ end
491
+ class ClassProof
492
+ include ModuleCluster::Define::Cluster::Mock14
493
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module1 ).should == false
494
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module2 ).should == false
495
+ eigenclass = class << self ; self ; end
496
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module1 ).should == true
497
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module2 ).should == true
498
+ end
499
+ class ClassProof2
500
+ extend ModuleCluster::Define::Cluster::Mock14
501
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module1 ).should == false
502
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module2 ).should == false
503
+ eigenclass = class << self ; self ; end
504
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module1 ).should == true
505
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock14::Module2 ).should == true
506
+ end
507
+ end
508
+ end
509
+
510
+ #################################################
511
+ # include_or_extend_also_includes_and_extends #
512
+ #################################################
513
+
514
+ it 'can include and extend other modules when this one is included in or extends a class' do
515
+ module ModuleCluster::Define::Cluster::Mock15
516
+ extend ModuleCluster::Define::Cluster
517
+ module Module1
518
+ end
519
+ module Module2
520
+ end
521
+ include_or_extend_also_includes_and_extends( Module1, Module2 )
522
+ respond_to?( :included ).should == true
523
+ module ModuleProof
524
+ include ModuleCluster::Define::Cluster::Mock15
525
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module1 ).should == true
526
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module2 ).should == true
527
+ eigenclass = class << self ; self ; end
528
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module1 ).should == true
529
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module2 ).should == true
530
+ end
531
+ module ModuleProo2
532
+ extend ModuleCluster::Define::Cluster::Mock15
533
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module1 ).should == true
534
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module2 ).should == true
535
+ eigenclass = class << self ; self ; end
536
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module1 ).should == true
537
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module2 ).should == true
538
+ end
539
+ class ClassProof
540
+ include ModuleCluster::Define::Cluster::Mock15
541
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module1 ).should == true
542
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module2 ).should == true
543
+ eigenclass = class << self ; self ; end
544
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module1 ).should == true
545
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module2 ).should == true
546
+ end
547
+ class ClassProof2
548
+ extend ModuleCluster::Define::Cluster::Mock15
549
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module1 ).should == true
550
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module2 ).should == true
551
+ eigenclass = class << self ; self ; end
552
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module1 ).should == true
553
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock15::Module2 ).should == true
554
+ end
555
+ end
556
+ end
557
+
558
+ #########################################
559
+ # include_or_extend_prepends_includes #
560
+ #########################################
561
+
562
+ it 'can include other modules before this one when this one is included in or extends a class' do
563
+ module ModuleCluster::Define::Cluster::Mock16
564
+ extend ModuleCluster::Define::Cluster
565
+ module Module1
566
+ end
567
+ module Module2
568
+ end
569
+ include_or_extend_prepends_includes( Module1, Module2 )
570
+ respond_to?( :append_features ).should == true
571
+ module ModuleProof
572
+ include ModuleCluster::Define::Cluster::Mock16
573
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module1 ).should == true
574
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module2 ).should == true
575
+ eigenclass = class << self ; self ; end
576
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module1 ).should == false
577
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module2 ).should == false
578
+ end
579
+ module ModuleProof2
580
+ extend ModuleCluster::Define::Cluster::Mock16
581
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module1 ).should == true
582
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module2 ).should == true
583
+ eigenclass = class << self ; self ; end
584
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module1 ).should == false
585
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module2 ).should == false
586
+ end
587
+ class ClassProof
588
+ include ModuleCluster::Define::Cluster::Mock16
589
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module1 ).should == true
590
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module2 ).should == true
591
+ eigenclass = class << self ; self ; end
592
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module1 ).should == false
593
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module2 ).should == false
594
+ end
595
+ class ClassProof2
596
+ extend ModuleCluster::Define::Cluster::Mock16
597
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module1 ).should == true
598
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module2 ).should == true
599
+ eigenclass = class << self ; self ; end
600
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module1 ).should == false
601
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock16::Module2 ).should == false
602
+ end
603
+ end
604
+ end
605
+
606
+ ########################################
607
+ # include_or_extend_prepends_extends #
608
+ ########################################
609
+
610
+ it 'can extend other modules before this one when this one is included in or extends a class' do
611
+ module ModuleCluster::Define::Cluster::Mock17
612
+ extend ModuleCluster::Define::Cluster
613
+ module Module1
614
+ end
615
+ module Module2
616
+ end
617
+ include_or_extend_prepends_extends( Module1, Module2 )
618
+ respond_to?( :extend_object ).should == true
619
+ module ModuleProof
620
+ include ModuleCluster::Define::Cluster::Mock17
621
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module1 ).should == false
622
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module2 ).should == false
623
+ eigenclass = class << self ; self ; end
624
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module1 ).should == true
625
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module2 ).should == true
626
+ end
627
+ module ModuleProof2
628
+ extend ModuleCluster::Define::Cluster::Mock17
629
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module1 ).should == false
630
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module2 ).should == false
631
+ eigenclass = class << self ; self ; end
632
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module1 ).should == true
633
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module2 ).should == true
634
+ end
635
+ class ClassProof
636
+ include ModuleCluster::Define::Cluster::Mock17
637
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module1 ).should == false
638
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module2 ).should == false
639
+ eigenclass = class << self ; self ; end
640
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module1 ).should == true
641
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module2 ).should == true
642
+ end
643
+ class ClassProof2
644
+ extend ModuleCluster::Define::Cluster::Mock17
645
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module1 ).should == false
646
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module2 ).should == false
647
+ eigenclass = class << self ; self ; end
648
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module1 ).should == true
649
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module2 ).should == true
650
+ end
651
+ Object.new.instance_eval do
652
+ extend ModuleCluster::Define::Cluster::Mock17
653
+ eigenclass = class << self ; self ; end
654
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module1 ).should == true
655
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock17::Module2 ).should == true
656
+ end
657
+ end
658
+ end
659
+
660
+ #####################################################
661
+ # include_or_extend_prepends_includes_and_extends #
662
+ #####################################################
663
+
664
+ it 'can include and extend other modules before this one when this one is included in or extends a class' do
665
+ module ModuleCluster::Define::Cluster::Mock18
666
+ extend ModuleCluster::Define::Cluster
667
+ module Module1
668
+ end
669
+ module Module2
670
+ end
671
+ include_or_extend_prepends_includes_and_extends( Module1, Module2 )
672
+ respond_to?( :append_features ).should == true
673
+ module ModuleProof
674
+ include ModuleCluster::Define::Cluster::Mock18
675
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module1 ).should == true
676
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module2 ).should == true
677
+ eigenclass = class << self ; self ; end
678
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module1 ).should == true
679
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module2 ).should == true
680
+ end
681
+ module ModuleProof2
682
+ extend ModuleCluster::Define::Cluster::Mock18
683
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module1 ).should == true
684
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module2 ).should == true
685
+ eigenclass = class << self ; self ; end
686
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module1 ).should == true
687
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module2 ).should == true
688
+ end
689
+ class ClassProof
690
+ include ModuleCluster::Define::Cluster::Mock18
691
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module1 ).should == true
692
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module2 ).should == true
693
+ eigenclass = class << self ; self ; end
694
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module1 ).should == true
695
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module2 ).should == true
696
+ end
697
+ class ClassProof2
698
+ extend ModuleCluster::Define::Cluster::Mock18
699
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module1 ).should == true
700
+ ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module2 ).should == true
701
+ eigenclass = class << self ; self ; end
702
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module1 ).should == true
703
+ eigenclass.ancestors.include?( ModuleCluster::Define::Cluster::Mock18::Module2 ).should == true
704
+ end
705
+ end
706
+ end
707
+
275
708
  end