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
@@ -0,0 +1,102 @@
1
+
2
+ require_relative '../../../lib/module-cluster.rb'
3
+
4
+ describe ModuleCluster::Define::InstanceCluster do
5
+
6
+ ####################################
7
+ # self.should_include_or_extend? #
8
+ ####################################
9
+
10
+ it 'should return true if instance, false otherwise' do
11
+ ModuleCluster::Define::InstanceCluster.should_include_or_extend?( Kernel ).should == false
12
+ ModuleCluster::Define::InstanceCluster.should_include_or_extend?( Class ).should == false
13
+ ModuleCluster::Define::InstanceCluster.should_include_or_extend?( Object.new ).should == true
14
+ end
15
+
16
+ ##########################
17
+ # self.should_cascade? #
18
+ ##########################
19
+
20
+ it 'should report false' do
21
+ ModuleCluster::Define::InstanceCluster.should_cascade?( Kernel ).should == false
22
+ ModuleCluster::Define::InstanceCluster.should_cascade?( Class ).should == false
23
+ ModuleCluster::Define::InstanceCluster.should_cascade?( Object.new ).should == false
24
+ end
25
+
26
+ ##################################
27
+ # instance_extend_also_extends #
28
+ ##################################
29
+
30
+ it 'can extend other modules when this one extends a module or instance' do
31
+ module ModuleCluster::Define::InstanceCluster::Mock01
32
+ extend ModuleCluster::Define::InstanceCluster
33
+ module Module1
34
+ end
35
+ module Module2
36
+ end
37
+ instance_extend_also_extends( Module1, Module2 )
38
+ respond_to?( :extended ).should == true
39
+ module ModuleProof
40
+ extend ModuleCluster::Define::InstanceCluster::Mock01
41
+ ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock01::Module1 ).should == false
42
+ ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock01::Module2 ).should == false
43
+ eigenclass = class << self ; self ; end
44
+ eigenclass.ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock01::Module1 ).should == false
45
+ eigenclass.ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock01::Module2 ).should == false
46
+ end
47
+ class ClassProof
48
+ extend ModuleCluster::Define::InstanceCluster::Mock01
49
+ ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock01::Module1 ).should == false
50
+ ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock01::Module2 ).should == false
51
+ eigenclass = class << self ; self ; end
52
+ eigenclass.ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock01::Module1 ).should == false
53
+ eigenclass.ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock01::Module2 ).should == false
54
+ end
55
+ Object.new.instance_eval do
56
+ extend ModuleCluster::Define::InstanceCluster::Mock01
57
+ eigenclass = class << self ; self ; end
58
+ eigenclass.ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock01::Module1 ).should == true
59
+ eigenclass.ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock01::Module2 ).should == true
60
+ end
61
+ end
62
+ end
63
+
64
+ ######################################
65
+ # instance_extend_prepends_extends #
66
+ ######################################
67
+
68
+ it 'can extend other modules before this one when this one extends an instance' do
69
+ module ModuleCluster::Define::InstanceCluster::Mock02
70
+ extend ModuleCluster::Define::InstanceCluster
71
+ module Module1
72
+ end
73
+ module Module2
74
+ end
75
+ instance_extend_prepends_extends( Module1, Module2 )
76
+ respond_to?( :extend_object ).should == true
77
+ module ModuleProof
78
+ extend ModuleCluster::Define::InstanceCluster::Mock02
79
+ ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock02::Module1 ).should == false
80
+ ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock02::Module2 ).should == false
81
+ eigenclass = class << self ; self ; end
82
+ eigenclass.ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock02::Module1 ).should == false
83
+ eigenclass.ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock02::Module2 ).should == false
84
+ end
85
+ class ClassProof
86
+ extend ModuleCluster::Define::InstanceCluster::Mock02
87
+ ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock02::Module1 ).should == false
88
+ ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock02::Module2 ).should == false
89
+ eigenclass = class << self ; self ; end
90
+ eigenclass.ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock02::Module1 ).should == false
91
+ eigenclass.ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock02::Module2 ).should == false
92
+ end
93
+ Object.new.instance_eval do
94
+ extend ModuleCluster::Define::InstanceCluster::Mock02
95
+ eigenclass = class << self ; self ; end
96
+ eigenclass.ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock02::Module1 ).should == true
97
+ eigenclass.ancestors.include?( ModuleCluster::Define::InstanceCluster::Mock02::Module2 ).should == true
98
+ end
99
+ end
100
+ end
101
+
102
+ end
@@ -0,0 +1,728 @@
1
+
2
+ require_relative '../../../lib/module-cluster.rb'
3
+
4
+ describe ModuleCluster::Define::ModuleCluster do
5
+
6
+ ####################################
7
+ # self.should_include_or_extend? #
8
+ ####################################
9
+
10
+ it 'should return true if module (not class), false otherwise' do
11
+ ModuleCluster::Define::ModuleCluster.should_include_or_extend?( Kernel ).should == true
12
+ ModuleCluster::Define::ModuleCluster.should_include_or_extend?( Class ).should == false
13
+ ModuleCluster::Define::ModuleCluster.should_include_or_extend?( Object.new ).should == false
14
+ end
15
+
16
+ ##########################
17
+ # self.should_cascade? #
18
+ ##########################
19
+
20
+ it 'should report false' do
21
+ ModuleCluster::Define::ModuleCluster.should_cascade?( Kernel ).should == false
22
+ ModuleCluster::Define::ModuleCluster.should_cascade?( Class ).should == false
23
+ ModuleCluster::Define::ModuleCluster.should_cascade?( Object.new ).should == false
24
+ end
25
+
26
+ ##################################
27
+ # module_include_also_includes #
28
+ ##################################
29
+
30
+ it 'can include other modules when this one is included in a module' do
31
+ module ModuleCluster::Define::ModuleCluster::Mock01
32
+ extend ModuleCluster::Define::ModuleCluster
33
+ module Module1
34
+ end
35
+ module Module2
36
+ end
37
+ module_include_also_includes( Module1, Module2 )
38
+ respond_to?( :included ).should == true
39
+ module ModuleProof
40
+ include ModuleCluster::Define::ModuleCluster::Mock01
41
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock01::Module1 ).should == true
42
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock01::Module2 ).should == true
43
+ eigenclass = class << self ; self ; end
44
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock01::Module1 ).should == false
45
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock01::Module2 ).should == false
46
+ end
47
+ class ClassProof
48
+ include ModuleCluster::Define::ModuleCluster::Mock01
49
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock01::Module1 ).should == false
50
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock01::Module2 ).should == false
51
+ eigenclass = class << self ; self ; end
52
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock01::Module1 ).should == false
53
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock01::Module2 ).should == false
54
+ end
55
+ end
56
+ end
57
+
58
+ #################################
59
+ # module_include_also_extends #
60
+ #################################
61
+
62
+ it 'can extend other modules when this one is included in a module' do
63
+ module ModuleCluster::Define::ModuleCluster::Mock02
64
+ extend ModuleCluster::Define::ModuleCluster
65
+ module Module1
66
+ end
67
+ module Module2
68
+ end
69
+ module_include_also_extends( Module1, Module2 )
70
+ respond_to?( :included ).should == true
71
+ module ModuleProof
72
+ include ModuleCluster::Define::ModuleCluster::Mock02
73
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock02::Module1 ).should == false
74
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock02::Module2 ).should == false
75
+ eigenclass = class << self ; self ; end
76
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock02::Module1 ).should == true
77
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock02::Module2 ).should == true
78
+ end
79
+ class ClassProof
80
+ include ModuleCluster::Define::ModuleCluster::Mock02
81
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock02::Module1 ).should == false
82
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock02::Module2 ).should == false
83
+ eigenclass = class << self ; self ; end
84
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock02::Module1 ).should == false
85
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock02::Module2 ).should == false
86
+ end
87
+ end
88
+ end
89
+
90
+ ##############################################
91
+ # module_include_also_includes_and_extends #
92
+ ##############################################
93
+
94
+ it 'can include and extend other modules when this one is included in a module' do
95
+ module ModuleCluster::Define::ModuleCluster::Mock03
96
+ extend ModuleCluster::Define::ModuleCluster
97
+ module Module1
98
+ end
99
+ module Module2
100
+ end
101
+ module_include_also_includes_and_extends( Module1, Module2 )
102
+ respond_to?( :included ).should == true
103
+ module ModuleProof
104
+ include ModuleCluster::Define::ModuleCluster::Mock03
105
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock03::Module1 ).should == true
106
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock03::Module2 ).should == true
107
+ eigenclass = class << self ; self ; end
108
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock03::Module1 ).should == true
109
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock03::Module2 ).should == true
110
+ end
111
+ class ClassProof
112
+ include ModuleCluster::Define::ModuleCluster::Mock03
113
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock03::Module1 ).should == false
114
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock03::Module2 ).should == false
115
+ eigenclass = class << self ; self ; end
116
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock03::Module1 ).should == false
117
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock03::Module2 ).should == false
118
+ end
119
+ end
120
+ end
121
+
122
+ #################################
123
+ # module_extend_also_includes #
124
+ #################################
125
+
126
+ it 'can include other modules when this one extends a module' do
127
+ module ModuleCluster::Define::ModuleCluster::Mock04
128
+ extend ModuleCluster::Define::ModuleCluster
129
+ module Module1
130
+ end
131
+ module Module2
132
+ end
133
+ module_extend_also_includes( Module1, Module2 )
134
+ respond_to?( :extended ).should == true
135
+ module ModuleProof
136
+ extend ModuleCluster::Define::ModuleCluster::Mock04
137
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock04::Module1 ).should == true
138
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock04::Module2 ).should == true
139
+ eigenclass = class << self ; self ; end
140
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock04::Module1 ).should == false
141
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock04::Module2 ).should == false
142
+ end
143
+ class ClassProof
144
+ extend ModuleCluster::Define::ModuleCluster::Mock04
145
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock04::Module1 ).should == false
146
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock04::Module2 ).should == false
147
+ eigenclass = class << self ; self ; end
148
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock04::Module1 ).should == false
149
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock04::Module2 ).should == false
150
+ end
151
+ end
152
+ end
153
+
154
+ ################################
155
+ # module_extend_also_extends #
156
+ ################################
157
+
158
+ it 'can extend other modules when this one extends a module' do
159
+ module ModuleCluster::Define::ModuleCluster::Mock05
160
+ extend ModuleCluster::Define::ModuleCluster
161
+ module Module1
162
+ end
163
+ module Module2
164
+ end
165
+ module_extend_also_extends( Module1, Module2 )
166
+ respond_to?( :extended ).should == true
167
+ module ModuleProof
168
+ extend ModuleCluster::Define::ModuleCluster::Mock05
169
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock05::Module1 ).should == false
170
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock05::Module2 ).should == false
171
+ eigenclass = class << self ; self ; end
172
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock05::Module1 ).should == true
173
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock05::Module2 ).should == true
174
+ end
175
+ class ClassProof
176
+ extend ModuleCluster::Define::ModuleCluster::Mock05
177
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock05::Module1 ).should == false
178
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock05::Module2 ).should == false
179
+ eigenclass = class << self ; self ; end
180
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock05::Module1 ).should == false
181
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock05::Module2 ).should == false
182
+ end
183
+ Object.new.instance_eval do
184
+ extend ModuleCluster::Define::ModuleCluster::Mock05
185
+ eigenclass = class << self ; self ; end
186
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock05::Module1 ).should == false
187
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock05::Module2 ).should == false
188
+ end
189
+ end
190
+ end
191
+
192
+ #############################################
193
+ # module_extend_also_includes_and_extends #
194
+ #############################################
195
+
196
+ it 'can include and extend other modules when this one extends a module' do
197
+ module ModuleCluster::Define::ModuleCluster::Mock06
198
+ extend ModuleCluster::Define::ModuleCluster
199
+ module Module1
200
+ end
201
+ module Module2
202
+ end
203
+ module_extend_also_includes_and_extends( Module1, Module2 )
204
+ respond_to?( :extended ).should == true
205
+ module ModuleProof
206
+ extend ModuleCluster::Define::ModuleCluster::Mock06
207
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock06::Module1 ).should == true
208
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock06::Module2 ).should == true
209
+ eigenclass = class << self ; self ; end
210
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock06::Module1 ).should == true
211
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock06::Module2 ).should == true
212
+ end
213
+ class ClassProof
214
+ extend ModuleCluster::Define::ModuleCluster::Mock06
215
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock06::Module1 ).should == false
216
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock06::Module2 ).should == false
217
+ eigenclass = class << self ; self ; end
218
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock06::Module1 ).should == false
219
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock06::Module2 ).should == false
220
+ end
221
+ Object.new.instance_eval do
222
+ extend ModuleCluster::Define::ModuleCluster::Mock06
223
+ eigenclass = class << self ; self ; end
224
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock06::Module1 ).should == false
225
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock06::Module2 ).should == false
226
+ end
227
+ end
228
+ end
229
+
230
+ ######################################
231
+ # module_include_prepends_includes #
232
+ ######################################
233
+
234
+ it 'can include other modules before this one when this one is included in a module' do
235
+ module ModuleCluster::Define::ModuleCluster::Mock07
236
+ extend ModuleCluster::Define::ModuleCluster
237
+ module Module1
238
+ end
239
+ module Module2
240
+ end
241
+ module_include_prepends_includes( Module1, Module2 )
242
+ respond_to?( :append_features ).should == true
243
+ module ModuleProof
244
+ include ModuleCluster::Define::ModuleCluster::Mock07
245
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock07::Module1 ).should == true
246
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock07::Module2 ).should == true
247
+ eigenclass = class << self ; self ; end
248
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock07::Module1 ).should == false
249
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock07::Module2 ).should == false
250
+ end
251
+ class ClassProof
252
+ include ModuleCluster::Define::ModuleCluster::Mock07
253
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock07::Module1 ).should == false
254
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock07::Module2 ).should == false
255
+ eigenclass = class << self ; self ; end
256
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock07::Module1 ).should == false
257
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock07::Module2 ).should == false
258
+ end
259
+ end
260
+ end
261
+
262
+ #####################################
263
+ # module_include_prepends_extends #
264
+ #####################################
265
+
266
+ it 'can extend other modules before this one when this one is included in a module' do
267
+ module ModuleCluster::Define::ModuleCluster::Mock08
268
+ extend ModuleCluster::Define::ModuleCluster
269
+ module Module1
270
+ end
271
+ module Module2
272
+ end
273
+ module_include_prepends_extends( Module1, Module2 )
274
+ respond_to?( :append_features ).should == true
275
+ module ModuleProof
276
+ include ModuleCluster::Define::ModuleCluster::Mock08
277
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock08::Module1 ).should == false
278
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock08::Module2 ).should == false
279
+ eigenclass = class << self ; self ; end
280
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock08::Module1 ).should == true
281
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock08::Module2 ).should == true
282
+ end
283
+ class ClassProof
284
+ include ModuleCluster::Define::ModuleCluster::Mock08
285
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock08::Module1 ).should == false
286
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock08::Module2 ).should == false
287
+ eigenclass = class << self ; self ; end
288
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock08::Module1 ).should == false
289
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock08::Module2 ).should == false
290
+ end
291
+ end
292
+ end
293
+
294
+ ##################################################
295
+ # module_include_prepends_includes_and_extends #
296
+ ##################################################
297
+
298
+ it 'can include and extend other modules before this one when this one is included in a module' do
299
+ module ModuleCluster::Define::ModuleCluster::Mock09
300
+ extend ModuleCluster::Define::ModuleCluster
301
+ module Module1
302
+ end
303
+ module Module2
304
+ end
305
+ module_include_prepends_includes_and_extends( Module1, Module2 )
306
+ respond_to?( :append_features ).should == true
307
+ module ModuleProof
308
+ include ModuleCluster::Define::ModuleCluster::Mock09
309
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock09::Module1 ).should == true
310
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock09::Module2 ).should == true
311
+ eigenclass = class << self ; self ; end
312
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock09::Module1 ).should == true
313
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock09::Module2 ).should == true
314
+ end
315
+ class ClassProof
316
+ include ModuleCluster::Define::ModuleCluster::Mock09
317
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock09::Module1 ).should == false
318
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock09::Module2 ).should == false
319
+ eigenclass = class << self ; self ; end
320
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock09::Module1 ).should == false
321
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock09::Module2 ).should == false
322
+ end
323
+ end
324
+ end
325
+
326
+ #####################################
327
+ # module_extend_prepends_includes #
328
+ #####################################
329
+
330
+ it 'can include other modules before this one when this one extends a module' do
331
+ module ModuleCluster::Define::ModuleCluster::Mock10
332
+ extend ModuleCluster::Define::ModuleCluster
333
+ module Module1
334
+ end
335
+ module Module2
336
+ end
337
+ module_extend_prepends_includes( Module1, Module2 )
338
+ respond_to?( :extend_object ).should == true
339
+ module ModuleProof
340
+ extend ModuleCluster::Define::ModuleCluster::Mock10
341
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock10::Module1 ).should == true
342
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock10::Module2 ).should == true
343
+ eigenclass = class << self ; self ; end
344
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock10::Module1 ).should == false
345
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock10::Module2 ).should == false
346
+ end
347
+ class ClassProof
348
+ extend ModuleCluster::Define::ModuleCluster::Mock10
349
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock10::Module1 ).should == false
350
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock10::Module2 ).should == false
351
+ eigenclass = class << self ; self ; end
352
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock10::Module1 ).should == false
353
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock10::Module2 ).should == false
354
+ end
355
+ end
356
+ end
357
+
358
+ ####################################
359
+ # module_extend_prepends_extends #
360
+ ####################################
361
+
362
+ it 'can extend other modules before this one when this one extends a module' do
363
+ module ModuleCluster::Define::ModuleCluster::Mock11
364
+ extend ModuleCluster::Define::ModuleCluster
365
+ module Module1
366
+ end
367
+ module Module2
368
+ end
369
+ module_extend_prepends_extends( Module1, Module2 )
370
+ respond_to?( :extend_object ).should == true
371
+ module ModuleProof
372
+ extend ModuleCluster::Define::ModuleCluster::Mock11
373
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock11::Module1 ).should == false
374
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock11::Module2 ).should == false
375
+ eigenclass = class << self ; self ; end
376
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock11::Module1 ).should == true
377
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock11::Module2 ).should == true
378
+ end
379
+ class ClassProof
380
+ extend ModuleCluster::Define::ModuleCluster::Mock11
381
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock11::Module1 ).should == false
382
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock11::Module2 ).should == false
383
+ eigenclass = class << self ; self ; end
384
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock11::Module1 ).should == false
385
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock11::Module2 ).should == false
386
+ end
387
+ Object.new.instance_eval do
388
+ extend ModuleCluster::Define::ModuleCluster::Mock11
389
+ eigenclass = class << self ; self ; end
390
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock11::Module1 ).should == false
391
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock11::Module2 ).should == false
392
+ end
393
+ end
394
+ end
395
+
396
+ #################################################
397
+ # module_extend_prepends_includes_and_extends #
398
+ #################################################
399
+
400
+ it 'can include and extend other modules before this one when this one extends a module' do
401
+ module ModuleCluster::Define::ModuleCluster::Mock12
402
+ extend ModuleCluster::Define::ModuleCluster
403
+ module Module1
404
+ end
405
+ module Module2
406
+ end
407
+ module_extend_prepends_includes_and_extends( Module1, Module2 )
408
+ respond_to?( :extend_object ).should == true
409
+ module ModuleProof
410
+ extend ModuleCluster::Define::ModuleCluster::Mock12
411
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock12::Module1 ).should == true
412
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock12::Module2 ).should == true
413
+ eigenclass = class << self ; self ; end
414
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock12::Module1 ).should == true
415
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock12::Module2 ).should == true
416
+ end
417
+ class ClassProof
418
+ extend ModuleCluster::Define::ModuleCluster::Mock12
419
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock12::Module1 ).should == false
420
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock12::Module2 ).should == false
421
+ eigenclass = class << self ; self ; end
422
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock12::Module1 ).should == false
423
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock12::Module2 ).should == false
424
+ end
425
+ Object.new.instance_eval do
426
+ extend ModuleCluster::Define::ModuleCluster::Mock12
427
+ eigenclass = class << self ; self ; end
428
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock12::Module1 ).should == false
429
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock12::Module2 ).should == false
430
+ end
431
+ end
432
+ end
433
+
434
+ ############################################
435
+ # module_include_or_extend_also_includes #
436
+ ############################################
437
+
438
+ it 'can include other modules when this one is included in or extends a module' do
439
+ module ModuleCluster::Define::ModuleCluster::Mock13
440
+ extend ModuleCluster::Define::ModuleCluster
441
+ module Module1
442
+ end
443
+ module Module2
444
+ end
445
+ module_include_or_extend_also_includes( Module1, Module2 )
446
+ respond_to?( :append_features ).should == true
447
+ module ModuleProof
448
+ include ModuleCluster::Define::ModuleCluster::Mock13
449
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module1 ).should == true
450
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module2 ).should == true
451
+ eigenclass = class << self ; self ; end
452
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module1 ).should == false
453
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module2 ).should == false
454
+ end
455
+ module ModuleProof2
456
+ extend ModuleCluster::Define::ModuleCluster::Mock13
457
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module1 ).should == true
458
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module2 ).should == true
459
+ eigenclass = class << self ; self ; end
460
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module1 ).should == false
461
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module2 ).should == false
462
+ end
463
+ class ClassProof
464
+ include ModuleCluster::Define::ModuleCluster::Mock13
465
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module1 ).should == false
466
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module2 ).should == false
467
+ eigenclass = class << self ; self ; end
468
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module1 ).should == false
469
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module2 ).should == false
470
+ end
471
+ class ClassProof2
472
+ include ModuleCluster::Define::ModuleCluster::Mock13
473
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module1 ).should == false
474
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module2 ).should == false
475
+ eigenclass = class << self ; self ; end
476
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module1 ).should == false
477
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock13::Module2 ).should == false
478
+ end
479
+ end
480
+ end
481
+
482
+ ###########################################
483
+ # module_include_or_extend_also_extends #
484
+ ###########################################
485
+
486
+ it 'can extend other modules when this one is included in or extends a module' do
487
+ module ModuleCluster::Define::ModuleCluster::Mock14
488
+ extend ModuleCluster::Define::ModuleCluster
489
+ module Module1
490
+ end
491
+ module Module2
492
+ end
493
+ module_include_or_extend_also_extends( Module1, Module2 )
494
+ respond_to?( :included ).should == true
495
+ module ModuleProof
496
+ include ModuleCluster::Define::ModuleCluster::Mock14
497
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module1 ).should == false
498
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module2 ).should == false
499
+ eigenclass = class << self ; self ; end
500
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module1 ).should == true
501
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module2 ).should == true
502
+ end
503
+ module ModuleProof2
504
+ extend ModuleCluster::Define::ModuleCluster::Mock14
505
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module1 ).should == false
506
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module2 ).should == false
507
+ eigenclass = class << self ; self ; end
508
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module1 ).should == true
509
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module2 ).should == true
510
+ end
511
+ class ClassProof
512
+ include ModuleCluster::Define::ModuleCluster::Mock14
513
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module1 ).should == false
514
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module2 ).should == false
515
+ eigenclass = class << self ; self ; end
516
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module1 ).should == false
517
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module2 ).should == false
518
+ end
519
+ class ClassProof2
520
+ extend ModuleCluster::Define::ModuleCluster::Mock14
521
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module1 ).should == false
522
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module2 ).should == false
523
+ eigenclass = class << self ; self ; end
524
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module1 ).should == false
525
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock14::Module2 ).should == false
526
+ end
527
+ end
528
+ end
529
+
530
+ ########################################################
531
+ # module_include_or_extend_also_includes_and_extends #
532
+ ########################################################
533
+
534
+ it 'can include and extend other modules when this one is included in or extends a module' do
535
+ module ModuleCluster::Define::ModuleCluster::Mock15
536
+ extend ModuleCluster::Define::ModuleCluster
537
+ module Module1
538
+ end
539
+ module Module2
540
+ end
541
+ module_include_or_extend_also_includes_and_extends( Module1, Module2 )
542
+ respond_to?( :included ).should == true
543
+ module ModuleProof
544
+ include ModuleCluster::Define::ModuleCluster::Mock15
545
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module1 ).should == true
546
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module2 ).should == true
547
+ eigenclass = class << self ; self ; end
548
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module1 ).should == true
549
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module2 ).should == true
550
+ end
551
+ module ModuleProo2
552
+ extend ModuleCluster::Define::ModuleCluster::Mock15
553
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module1 ).should == true
554
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module2 ).should == true
555
+ eigenclass = class << self ; self ; end
556
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module1 ).should == true
557
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module2 ).should == true
558
+ end
559
+ class ClassProof
560
+ include ModuleCluster::Define::ModuleCluster::Mock15
561
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module1 ).should == false
562
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module2 ).should == false
563
+ eigenclass = class << self ; self ; end
564
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module1 ).should == false
565
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module2 ).should == false
566
+ end
567
+ class ClassProof2
568
+ extend ModuleCluster::Define::ModuleCluster::Mock15
569
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module1 ).should == false
570
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module2 ).should == false
571
+ eigenclass = class << self ; self ; end
572
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module1 ).should == false
573
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock15::Module2 ).should == false
574
+ end
575
+ end
576
+ end
577
+
578
+ ################################################
579
+ # module_include_or_extend_prepends_includes #
580
+ ################################################
581
+
582
+ it 'can include other modules before this one when this one is included in or extends a module' do
583
+ module ModuleCluster::Define::ModuleCluster::Mock16
584
+ extend ModuleCluster::Define::ModuleCluster
585
+ module Module1
586
+ end
587
+ module Module2
588
+ end
589
+ module_include_or_extend_prepends_includes( Module1, Module2 )
590
+ respond_to?( :append_features ).should == true
591
+ module ModuleProof
592
+ include ModuleCluster::Define::ModuleCluster::Mock16
593
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module1 ).should == true
594
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module2 ).should == true
595
+ eigenclass = class << self ; self ; end
596
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module1 ).should == false
597
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module2 ).should == false
598
+ end
599
+ module ModuleProof2
600
+ extend ModuleCluster::Define::ModuleCluster::Mock16
601
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module1 ).should == true
602
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module2 ).should == true
603
+ eigenclass = class << self ; self ; end
604
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module1 ).should == false
605
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module2 ).should == false
606
+ end
607
+ class ClassProof
608
+ include ModuleCluster::Define::ModuleCluster::Mock16
609
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module1 ).should == false
610
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module2 ).should == false
611
+ eigenclass = class << self ; self ; end
612
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module1 ).should == false
613
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module2 ).should == false
614
+ end
615
+ class ClassProof2
616
+ extend ModuleCluster::Define::ModuleCluster::Mock16
617
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module1 ).should == false
618
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module2 ).should == false
619
+ eigenclass = class << self ; self ; end
620
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module1 ).should == false
621
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock16::Module2 ).should == false
622
+ end
623
+ end
624
+ end
625
+
626
+ ###############################################
627
+ # module_include_or_extend_prepends_extends #
628
+ ###############################################
629
+
630
+ it 'can extend other modules before this one when this one is included in or extends a module' do
631
+ module ModuleCluster::Define::ModuleCluster::Mock17
632
+ extend ModuleCluster::Define::ModuleCluster
633
+ module Module1
634
+ end
635
+ module Module2
636
+ end
637
+ module_include_or_extend_prepends_extends( Module1, Module2 )
638
+ respond_to?( :extend_object ).should == true
639
+ module ModuleProof
640
+ include ModuleCluster::Define::ModuleCluster::Mock17
641
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module1 ).should == false
642
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module2 ).should == false
643
+ eigenclass = class << self ; self ; end
644
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module1 ).should == true
645
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module2 ).should == true
646
+ end
647
+ module ModuleProof2
648
+ extend ModuleCluster::Define::ModuleCluster::Mock17
649
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module1 ).should == false
650
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module2 ).should == false
651
+ eigenclass = class << self ; self ; end
652
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module1 ).should == true
653
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module2 ).should == true
654
+ end
655
+ class ClassProof
656
+ include ModuleCluster::Define::ModuleCluster::Mock17
657
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module1 ).should == false
658
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module2 ).should == false
659
+ eigenclass = class << self ; self ; end
660
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module1 ).should == false
661
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module2 ).should == false
662
+ end
663
+ class ClassProof2
664
+ extend ModuleCluster::Define::ModuleCluster::Mock17
665
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module1 ).should == false
666
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module2 ).should == false
667
+ eigenclass = class << self ; self ; end
668
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module1 ).should == false
669
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module2 ).should == false
670
+ end
671
+ Object.new.instance_eval do
672
+ extend ModuleCluster::Define::ModuleCluster::Mock17
673
+ eigenclass = class << self ; self ; end
674
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module1 ).should == false
675
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock17::Module2 ).should == false
676
+ end
677
+ end
678
+ end
679
+
680
+ ############################################################
681
+ # module_include_or_extend_prepends_includes_and_extends #
682
+ ############################################################
683
+
684
+ it 'can include and extend other modules before this one when this one is included in or extends a module' do
685
+ module ModuleCluster::Define::ModuleCluster::Mock18
686
+ extend ModuleCluster::Define::ModuleCluster
687
+ module Module1
688
+ end
689
+ module Module2
690
+ end
691
+ module_include_or_extend_prepends_includes_and_extends( Module1, Module2 )
692
+ respond_to?( :append_features ).should == true
693
+ module ModuleProof
694
+ include ModuleCluster::Define::ModuleCluster::Mock18
695
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module1 ).should == true
696
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module2 ).should == true
697
+ eigenclass = class << self ; self ; end
698
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module1 ).should == true
699
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module2 ).should == true
700
+ end
701
+ module ModuleProof2
702
+ extend ModuleCluster::Define::ModuleCluster::Mock18
703
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module1 ).should == true
704
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module2 ).should == true
705
+ eigenclass = class << self ; self ; end
706
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module1 ).should == true
707
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module2 ).should == true
708
+ end
709
+ class ClassProof
710
+ include ModuleCluster::Define::ModuleCluster::Mock18
711
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module1 ).should == false
712
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module2 ).should == false
713
+ eigenclass = class << self ; self ; end
714
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module1 ).should == false
715
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module2 ).should == false
716
+ end
717
+ class ClassProof2
718
+ extend ModuleCluster::Define::ModuleCluster::Mock18
719
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module1 ).should == false
720
+ ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module2 ).should == false
721
+ eigenclass = class << self ; self ; end
722
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module1 ).should == false
723
+ eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock18::Module2 ).should == false
724
+ end
725
+ end
726
+ end
727
+
728
+ end