module-cluster 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. data/lib/module-cluster.rb +17 -13
  2. data/lib/module-cluster/ModuleCluster.rb +8 -8
  3. data/lib/module-cluster/ModuleCluster/CascadeFeatures.rb +155 -0
  4. data/lib/module-cluster/ModuleCluster/ClusterStack.rb +102 -0
  5. data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +203 -0
  6. data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +220 -0
  7. data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +209 -0
  8. data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +209 -0
  9. data/lib/module-cluster/ModuleCluster/Define/ClusterStack.rb +26 -0
  10. data/lib/module-cluster/ModuleCluster/Define/DedoubleAncestors.rb +22 -0
  11. data/lib/module-cluster/ModuleCluster/ExtendForCascade.rb +15 -0
  12. data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +421 -0
  13. data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +432 -0
  14. data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +345 -0
  15. data/spec/ModuleCluster/Define/Cluster_spec.rb +275 -0
  16. data/spec/ModuleCluster_spec.rb +4 -4
  17. metadata +16 -14
  18. data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +0 -211
  19. data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascades.rb +0 -223
  20. data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascadesToClass.rb +0 -223
  21. data/lib/module-cluster/ModuleCluster/Define/ModuleClusterCascadesToModule.rb +0 -227
  22. data/lib/module-cluster/ModuleCluster/Define/_private_/AnonymousModule.rb +0 -121
  23. data/lib/module-cluster/ModuleCluster/Define/_private_/ClusterStack.rb +0 -55
  24. data/spec/ModuleCluster/Define/ModuleClusterCascadesToClass_spec.rb +0 -421
  25. data/spec/ModuleCluster/Define/ModuleClusterCascadesToModule_spec.rb +0 -432
  26. data/spec/ModuleCluster/Define/ModuleClusterCascades_spec.rb +0 -345
  27. data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +0 -275
  28. data/spec/ModuleCluster/Define/_private_/ClusterStack_spec.rb +0 -24
@@ -1,275 +0,0 @@
1
-
2
- require_relative '../../../lib/module-cluster.rb'
3
-
4
- describe ModuleCluster::Define::ModuleCluster do
5
-
6
- ###########################
7
- # include_also_includes #
8
- ###########################
9
-
10
- it 'include other modules when this one is included' do
11
- module ModuleCluster::Define::ModuleCluster::Mock01
12
- extend ModuleCluster::Define::ModuleCluster
13
- module Module1
14
- end
15
- module Module2
16
- end
17
- include_also_includes( Module1, Module2 )
18
- respond_to?( :included ).should == true
19
- module Proof
20
- include ModuleCluster::Define::ModuleCluster::Mock01
21
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock01::Module1 ).should == true
22
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock01::Module2 ).should == true
23
- end
24
- end
25
- end
26
-
27
- ##########################
28
- # include_also_extends #
29
- ##########################
30
-
31
- it 'extend other modules when this one is included' do
32
- module ModuleCluster::Define::ModuleCluster::Mock02
33
- extend ModuleCluster::Define::ModuleCluster
34
- module Module1
35
- end
36
- module Module2
37
- end
38
- include_also_extends( Module1, Module2 )
39
- respond_to?( :included ).should == true
40
- module Proof
41
- include ModuleCluster::Define::ModuleCluster::Mock02
42
- eigenclass = class << self ; self ; end
43
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock02::Module1 ).should == true
44
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock02::Module2 ).should == true
45
- end
46
- end
47
- end
48
-
49
- #######################################
50
- # include_also_includes_and_extends #
51
- #######################################
52
-
53
- it 'include and extend other modules when this one is included' do
54
- module ModuleCluster::Define::ModuleCluster::Mock03
55
- extend ModuleCluster::Define::ModuleCluster
56
- module Module1
57
- end
58
- module Module2
59
- end
60
- include_also_includes_and_extends( Module1, Module2 )
61
- respond_to?( :included ).should == true
62
- module Proof
63
- include ModuleCluster::Define::ModuleCluster::Mock03
64
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock03::Module1 ).should == true
65
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock03::Module2 ).should == true
66
- eigenclass = class << self ; self ; end
67
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock03::Module1 ).should == true
68
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock03::Module2 ).should == true
69
- end
70
- end
71
-
72
- end
73
-
74
- ##########################
75
- # extend_also_includes #
76
- ##########################
77
-
78
- it 'include other modules when this one is extended' do
79
- module ModuleCluster::Define::ModuleCluster::Mock04
80
- extend ModuleCluster::Define::ModuleCluster
81
- module Module1
82
- end
83
- module Module2
84
- end
85
- extend_also_includes( Module1, Module2 )
86
- respond_to?( :extended ).should == true
87
- module Proof
88
- extend ModuleCluster::Define::ModuleCluster::Mock04
89
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock04::Module1 ).should == true
90
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock04::Module2 ).should == true
91
- end
92
- end
93
- end
94
-
95
- #########################
96
- # extend_also_extends #
97
- #########################
98
-
99
- it 'extend other modules when this one is extended' do
100
- module ModuleCluster::Define::ModuleCluster::Mock05
101
- extend ModuleCluster::Define::ModuleCluster
102
- module Module1
103
- end
104
- module Module2
105
- end
106
- extend_also_extends( Module1, Module2 )
107
- respond_to?( :extended ).should == true
108
- module Proof
109
- extend ModuleCluster::Define::ModuleCluster::Mock05
110
- eigenclass = class << self ; self ; end
111
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock05::Module1 ).should == true
112
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock05::Module2 ).should == true
113
- end
114
- end
115
- end
116
-
117
- ######################################
118
- # extend_also_includes_and_extends #
119
- ######################################
120
-
121
- it 'include and extend other modules when this one is extended' do
122
- module ModuleCluster::Define::ModuleCluster::Mock06
123
- extend ModuleCluster::Define::ModuleCluster
124
- module Module1
125
- end
126
- module Module2
127
- end
128
- extend_also_includes_and_extends( Module1, Module2 )
129
- respond_to?( :extended ).should == true
130
- module Proof
131
- extend ModuleCluster::Define::ModuleCluster::Mock06
132
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock06::Module1 ).should == true
133
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock06::Module2 ).should == true
134
- eigenclass = class << self ; self ; end
135
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock06::Module1 ).should == true
136
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock06::Module2 ).should == true
137
- end
138
- end
139
- end
140
-
141
- ###############################
142
- # include_prepends_includes #
143
- ###############################
144
-
145
- it 'include other modules before this one is included' do
146
- module ModuleCluster::Define::ModuleCluster::Mock07
147
- extend ModuleCluster::Define::ModuleCluster
148
- module Module1
149
- end
150
- module Module2
151
- end
152
- include_prepends_includes( Module1, Module2 )
153
- respond_to?( :append_features ).should == true
154
- module Proof
155
- include ModuleCluster::Define::ModuleCluster::Mock07
156
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock07::Module1 ).should == true
157
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock07::Module2 ).should == true
158
- end
159
- end
160
- end
161
-
162
- ##############################
163
- # include_prepends_extends #
164
- ##############################
165
-
166
- it 'extend other modules before this one is included' do
167
- module ModuleCluster::Define::ModuleCluster::Mock08
168
- extend ModuleCluster::Define::ModuleCluster
169
- module Module1
170
- end
171
- module Module2
172
- end
173
- include_prepends_extends( Module1, Module2 )
174
- respond_to?( :append_features ).should == true
175
- module Proof
176
- include ModuleCluster::Define::ModuleCluster::Mock08
177
- eigenclass = class << self ; self ; end
178
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock08::Module1 ).should == true
179
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock08::Module2 ).should == true
180
- end
181
- end
182
- end
183
-
184
- ###########################################
185
- # include_prepends_includes_and_extends #
186
- ###########################################
187
-
188
- it 'include and extend other modules before this one is included' do
189
- module ModuleCluster::Define::ModuleCluster::Mock09
190
- extend ModuleCluster::Define::ModuleCluster
191
- module Module1
192
- end
193
- module Module2
194
- end
195
- include_prepends_includes_and_extends( Module1, Module2 )
196
- respond_to?( :append_features ).should == true
197
- module Proof
198
- include ModuleCluster::Define::ModuleCluster::Mock09
199
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock09::Module1 ).should == true
200
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock09::Module2 ).should == true
201
- eigenclass = class << self ; self ; end
202
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock09::Module1 ).should == true
203
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock09::Module2 ).should == true
204
- end
205
- end
206
- end
207
-
208
- ##############################
209
- # extend_prepends_includes #
210
- ##############################
211
-
212
- it 'include other modules before this one is extended' do
213
- module ModuleCluster::Define::ModuleCluster::Mock10
214
- extend ModuleCluster::Define::ModuleCluster
215
- module Module1
216
- end
217
- module Module2
218
- end
219
- extend_prepends_includes( Module1, Module2 )
220
- respond_to?( :extend_object ).should == true
221
- module Proof
222
- extend ModuleCluster::Define::ModuleCluster::Mock10
223
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock10::Module1 ).should == true
224
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock10::Module2 ).should == true
225
- end
226
- end
227
- end
228
-
229
- #############################
230
- # extend_prepends_extends #
231
- #############################
232
-
233
- it 'extend other modules before this one is extended' do
234
- module ModuleCluster::Define::ModuleCluster::Mock11
235
- extend ModuleCluster::Define::ModuleCluster
236
- module Module1
237
- end
238
- module Module2
239
- end
240
- extend_prepends_extends( Module1, Module2 )
241
- respond_to?( :extend_object ).should == true
242
- module Proof
243
- extend ModuleCluster::Define::ModuleCluster::Mock11
244
- eigenclass = class << self ; self ; end
245
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock11::Module1 ).should == true
246
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock11::Module2 ).should == true
247
- end
248
- end
249
- end
250
-
251
- ##########################################
252
- # extend_prepends_includes_and_extends #
253
- ##########################################
254
-
255
- it 'include and extend other modules before this one is extended' do
256
- module ModuleCluster::Define::ModuleCluster::Mock12
257
- extend ModuleCluster::Define::ModuleCluster
258
- module Module1
259
- end
260
- module Module2
261
- end
262
- extend_prepends_includes_and_extends( Module1, Module2 )
263
- respond_to?( :extend_object ).should == true
264
- module Proof
265
- extend ModuleCluster::Define::ModuleCluster::Mock12
266
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock12::Module1 ).should == true
267
- ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock12::Module2 ).should == true
268
- eigenclass = class << self ; self ; end
269
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock12::Module1 ).should == true
270
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::Mock12::Module2 ).should == true
271
- end
272
- end
273
- end
274
-
275
- end
@@ -1,24 +0,0 @@
1
-
2
- require_relative '../../../../lib/module-cluster.rb'
3
-
4
- describe ModuleCluster::Define::ClusterStack do
5
-
6
- #########################
7
- # clusterstack_module #
8
- #########################
9
-
10
- it 'constructs an anonymous module to stack the included/extended/append_features/extend_object chain' do
11
-
12
- class ModuleCluster::Define::ClusterStack::Mock
13
- extend ModuleCluster::Define::ClusterStack
14
- # get instance of module
15
- clusterstack_module_instance = clusterstack_module
16
- # make sure it's a module
17
- clusterstack_module_instance.is_a?( Module ).should == true
18
- # make sure we get the same one after the first time
19
- clusterstack_module.should == clusterstack_module_instance
20
- end
21
-
22
- end
23
-
24
- end