module-cluster 1.4.4 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +21 -0
- data/README.rdoc +21 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClass.rb +83 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClassOrModule.rb +70 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModule.rb +79 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModuleOrSubclass.rb +22 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/Class.rb +15 -7
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrInstance.rb +15 -7
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb +15 -7
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrInstance.rb +15 -7
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrSubclass.rb +11 -3
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrSubclass.rb +10 -2
- data/lib/module-cluster/ModuleCluster/Define/Block/Instance.rb +15 -3
- data/lib/module-cluster/ModuleCluster/Define/Block/Module.rb +15 -7
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrInstance.rb +15 -7
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrSubclass.rb +10 -2
- data/lib/module-cluster/ModuleCluster/Define/Block/Subclass.rb +13 -2
- data/lib/module-cluster/ModuleCluster/Define/Block.rb +1 -1
- data/lib/module-cluster/ModuleCluster/Define/ClassCluster.rb +19 -19
- data/lib/module-cluster/ModuleCluster/Define/ClassOrInstanceCluster.rb +34 -34
- data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +19 -19
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +19 -19
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +19 -19
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +19 -19
- data/lib/module-cluster/ModuleCluster/Define/Deprecated.rb +1 -1
- data/lib/module-cluster/ModuleCluster/Define/InstanceCluster.rb +3 -3
- data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +19 -19
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrClassCluster.rb +43 -43
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrInstanceCluster.rb +34 -34
- data/lib/module-cluster/ModuleCluster/Define/Status.rb +1 -1
- data/lib/module-cluster/ModuleCluster/Define.rb +1 -1
- data/lib/module-cluster/ModuleCluster/Suspend/Hooks.rb +1 -1
- data/lib/module-cluster/ModuleCluster/Suspend/WithoutHooks.rb +1 -1
- data/lib/module-cluster/ModuleCluster/Suspend.rb +1 -1
- data/lib/module-cluster/ModuleCluster.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/ClusterStack.rb +3 -3
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/PerformCascades.rb +85 -32
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/Subclass.rb +6 -3
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures.rb +5 -5
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Class.rb +9 -9
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Inherited.rb +3 -3
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Instance.rb +5 -5
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Module.rb +9 -9
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Set.rb +1 -0
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Extends.rb +13 -13
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Includes.rb +10 -10
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsExtends.rb +13 -13
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsIncludes.rb +10 -10
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Status.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Suspend.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/ExtendForCascade/Subclass.rb +1 -1
- data/lib/module-cluster/_private_/ModuleCluster/ExtendForCascade.rb +1 -1
- data/lib/module-cluster.rb +14 -2
- data/spec/ModuleCluster/Define/Block/CascadingClassOrModule_spec.rb +285 -0
- data/spec/ModuleCluster/Define/Block/CascadingClass_spec.rb +241 -0
- data/spec/ModuleCluster/Define/Block/CascadingModuleOrSubclass_spec.rb +56 -0
- data/spec/ModuleCluster/Define/Block/CascadingModule_spec.rb +278 -0
- data/spec/ModuleCluster/Define/Block/ClassOrInstance_spec.rb +13 -13
- data/spec/ModuleCluster/Define/Block/ClassOrModuleOrInstance_spec.rb +13 -13
- data/spec/ModuleCluster/Define/Block/ClassOrModuleOrSubclass_spec.rb +2 -3
- data/spec/ModuleCluster/Define/Block/ClassOrModule_spec.rb +13 -13
- data/spec/ModuleCluster/Define/Block/ClassOrSubclass_spec.rb +2 -2
- data/spec/ModuleCluster/Define/Block/Class_spec.rb +13 -13
- data/spec/ModuleCluster/Define/Block/Instance_spec.rb +5 -5
- data/spec/ModuleCluster/Define/Block/ModuleOrInstance_spec.rb +1 -1
- data/spec/ModuleCluster/Define/Block/ModuleOrSubclass_spec.rb +2 -4
- data/spec/ModuleCluster/Define/Block/Module_spec.rb +13 -13
- data/spec/ModuleCluster/Define/Block/Subclass_spec.rb +8 -8
- data/spec/ModuleCluster/Define/Block_spec.rb +9 -9
- data/spec/ModuleCluster/Define/ClassCluster_spec.rb +227 -227
- data/spec/ModuleCluster/Define/ClassOrInstanceCluster_spec.rb +197 -197
- data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +228 -228
- data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +232 -232
- data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +224 -224
- data/spec/ModuleCluster/Define/Cluster_spec.rb +221 -221
- data/spec/ModuleCluster/Define/InstanceCluster_spec.rb +29 -29
- data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +227 -227
- data/spec/ModuleCluster/Define/ModuleOrClassCluster_spec.rb +227 -227
- data/spec/ModuleCluster/Define/ModuleOrInstanceCluster_spec.rb +197 -197
- data/spec/ModuleCluster/Suspend/Hooks_spec.rb +120 -120
- data/spec/ModuleCluster/Suspend/WithoutHooks_spec.rb +120 -120
- data/spec/ModuleCluster_spec.rb +2 -2
- data/spec/_private_/ModuleCluster/CascadeFeatures/PerformCascades_spec.rb +192 -192
- data/spec/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy_spec.rb +129 -129
- data/spec/_private_/ModuleCluster/ClusterStack/Suspend_spec.rb +17 -17
- metadata +9 -1
@@ -0,0 +1,241 @@
|
|
1
|
+
|
2
|
+
require_relative '../../../../lib/module-cluster.rb'
|
3
|
+
|
4
|
+
describe ::ModuleCluster::Define::Block::CascadingClass do
|
5
|
+
|
6
|
+
#############################
|
7
|
+
# cascading_class_include #
|
8
|
+
#############################
|
9
|
+
|
10
|
+
it 'can run a block on class include' do
|
11
|
+
module ::ModuleCluster::Define::Block::CascadingClass::Mock01
|
12
|
+
extend ::ModuleCluster::Define::Block::CascadingClass
|
13
|
+
block_ran = false
|
14
|
+
cascading_class_include do
|
15
|
+
block_ran = true
|
16
|
+
end
|
17
|
+
respond_to?( :included ).should == true
|
18
|
+
module ModuleProof
|
19
|
+
include ::ModuleCluster::Define::Block::CascadingClass::Mock01
|
20
|
+
end
|
21
|
+
block_ran.should == false
|
22
|
+
module ModuleProof2
|
23
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock01
|
24
|
+
end
|
25
|
+
block_ran.should == false
|
26
|
+
Object.new.instance_eval do
|
27
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock01
|
28
|
+
end
|
29
|
+
block_ran.should == false
|
30
|
+
class CascadingClassProofExtended
|
31
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock01
|
32
|
+
end
|
33
|
+
block_ran.should == false
|
34
|
+
class CascadingClassProof
|
35
|
+
include ::ModuleCluster::Define::Block::CascadingClass::Mock01
|
36
|
+
end
|
37
|
+
block_ran.should == true
|
38
|
+
block_ran = false
|
39
|
+
class CascadingClassProof2 < CascadingClassProof
|
40
|
+
end
|
41
|
+
block_ran.should == true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
############################
|
46
|
+
# cascading_class_extend #
|
47
|
+
############################
|
48
|
+
|
49
|
+
it 'can run a block on class extend' do
|
50
|
+
module ::ModuleCluster::Define::Block::CascadingClass::Mock02
|
51
|
+
extend ::ModuleCluster::Define::Block::CascadingClass
|
52
|
+
block_ran = false
|
53
|
+
cascading_class_extend do
|
54
|
+
block_ran = true
|
55
|
+
end
|
56
|
+
respond_to?( :extended ).should == true
|
57
|
+
module ModuleProof
|
58
|
+
include ::ModuleCluster::Define::Block::CascadingClass::Mock02
|
59
|
+
end
|
60
|
+
block_ran.should == false
|
61
|
+
module ModuleProof2
|
62
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock02
|
63
|
+
end
|
64
|
+
block_ran.should == false
|
65
|
+
Object.new.instance_eval do
|
66
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock02
|
67
|
+
end
|
68
|
+
block_ran.should == false
|
69
|
+
class CascadingClassProof
|
70
|
+
include ::ModuleCluster::Define::Block::CascadingClass::Mock02
|
71
|
+
end
|
72
|
+
block_ran.should == false
|
73
|
+
class CascadingClassProofExtended
|
74
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock02
|
75
|
+
end
|
76
|
+
block_ran.should == true
|
77
|
+
block_ran = false
|
78
|
+
class CascadingClassProof2 < CascadingClassProof
|
79
|
+
end
|
80
|
+
block_ran.should == true
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
#######################################
|
85
|
+
# cascading_class_include_or_extend #
|
86
|
+
#######################################
|
87
|
+
|
88
|
+
it 'can run a block on class include or extend' do
|
89
|
+
module ::ModuleCluster::Define::Block::CascadingClass::Mock03
|
90
|
+
extend ::ModuleCluster::Define::Block::CascadingClass
|
91
|
+
block_ran = false
|
92
|
+
cascading_class_include_or_extend do
|
93
|
+
block_ran = true
|
94
|
+
end
|
95
|
+
respond_to?( :extended ).should == true
|
96
|
+
module ModuleProof
|
97
|
+
include ::ModuleCluster::Define::Block::CascadingClass::Mock03
|
98
|
+
end
|
99
|
+
block_ran.should == false
|
100
|
+
module ModuleProof2
|
101
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock03
|
102
|
+
end
|
103
|
+
block_ran.should == false
|
104
|
+
Object.new.instance_eval do
|
105
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock03
|
106
|
+
end
|
107
|
+
block_ran.should == false
|
108
|
+
class CascadingClassProof
|
109
|
+
include ::ModuleCluster::Define::Block::CascadingClass::Mock03
|
110
|
+
end
|
111
|
+
block_ran.should == true
|
112
|
+
block_ran = false
|
113
|
+
class CascadingClassProofExtended
|
114
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock03
|
115
|
+
end
|
116
|
+
block_ran.should == true
|
117
|
+
block_ran = false
|
118
|
+
class CascadingClassProof2 < CascadingClassProof
|
119
|
+
end
|
120
|
+
block_ran.should == true
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
#####################################
|
125
|
+
# cascading_prepend_class_include #
|
126
|
+
#####################################
|
127
|
+
|
128
|
+
it 'can run a block before class include' do
|
129
|
+
module ::ModuleCluster::Define::Block::CascadingClass::Mock04
|
130
|
+
extend ::ModuleCluster::Define::Block::CascadingClass
|
131
|
+
block_ran = false
|
132
|
+
cascading_prepend_class_include do
|
133
|
+
block_ran = true
|
134
|
+
end
|
135
|
+
respond_to?( :included ).should == true
|
136
|
+
module ModuleProof
|
137
|
+
include ::ModuleCluster::Define::Block::CascadingClass::Mock04
|
138
|
+
end
|
139
|
+
block_ran.should == false
|
140
|
+
module ModuleProof2
|
141
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock04
|
142
|
+
end
|
143
|
+
block_ran.should == false
|
144
|
+
Object.new.instance_eval do
|
145
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock04
|
146
|
+
end
|
147
|
+
block_ran.should == false
|
148
|
+
class CascadingClassProof
|
149
|
+
include ::ModuleCluster::Define::Block::CascadingClass::Mock04
|
150
|
+
end
|
151
|
+
block_ran.should == true
|
152
|
+
class CascadingClassProofExtended
|
153
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock04
|
154
|
+
end
|
155
|
+
block_ran.should == true
|
156
|
+
class CascadingClassProof2 < CascadingClassProof
|
157
|
+
end
|
158
|
+
block_ran.should == true
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
####################################
|
163
|
+
# cascading_prepend_class_extend #
|
164
|
+
####################################
|
165
|
+
|
166
|
+
it 'can run a block before class extend' do
|
167
|
+
module ::ModuleCluster::Define::Block::CascadingClass::Mock05
|
168
|
+
extend ::ModuleCluster::Define::Block::CascadingClass
|
169
|
+
block_ran = false
|
170
|
+
cascading_prepend_class_extend do
|
171
|
+
block_ran = true
|
172
|
+
end
|
173
|
+
respond_to?( :extended ).should == true
|
174
|
+
module ModuleProof
|
175
|
+
include ::ModuleCluster::Define::Block::CascadingClass::Mock05
|
176
|
+
end
|
177
|
+
block_ran.should == false
|
178
|
+
module ModuleProof2
|
179
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock05
|
180
|
+
end
|
181
|
+
block_ran.should == false
|
182
|
+
Object.new.instance_eval do
|
183
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock05
|
184
|
+
end
|
185
|
+
block_ran.should == false
|
186
|
+
class CascadingClassProof
|
187
|
+
include ::ModuleCluster::Define::Block::CascadingClass::Mock05
|
188
|
+
end
|
189
|
+
block_ran.should == false
|
190
|
+
class CascadingClassProofExtended
|
191
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock05
|
192
|
+
end
|
193
|
+
block_ran.should == true
|
194
|
+
block_ran = false
|
195
|
+
class CascadingClassProof2 < CascadingClassProof
|
196
|
+
end
|
197
|
+
block_ran.should == true
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
###############################################
|
202
|
+
# cascading_prepend_class_include_or_extend #
|
203
|
+
###############################################
|
204
|
+
|
205
|
+
it 'can run a block before class include or extend' do
|
206
|
+
module ::ModuleCluster::Define::Block::CascadingClass::Mock06
|
207
|
+
extend ::ModuleCluster::Define::Block::CascadingClass
|
208
|
+
block_ran = false
|
209
|
+
cascading_prepend_class_include_or_extend do
|
210
|
+
block_ran = true
|
211
|
+
end
|
212
|
+
respond_to?( :extended ).should == true
|
213
|
+
module ModuleProof
|
214
|
+
include ::ModuleCluster::Define::Block::CascadingClass::Mock06
|
215
|
+
end
|
216
|
+
block_ran.should == false
|
217
|
+
module ModuleProof2
|
218
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock06
|
219
|
+
end
|
220
|
+
block_ran.should == false
|
221
|
+
Object.new.instance_eval do
|
222
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock06
|
223
|
+
end
|
224
|
+
block_ran.should == false
|
225
|
+
class CascadingClassProof
|
226
|
+
include ::ModuleCluster::Define::Block::CascadingClass::Mock06
|
227
|
+
end
|
228
|
+
block_ran.should == true
|
229
|
+
block_ran = false
|
230
|
+
class CascadingClassProofExtended
|
231
|
+
extend ::ModuleCluster::Define::Block::CascadingClass::Mock06
|
232
|
+
end
|
233
|
+
block_ran.should == true
|
234
|
+
block_ran = false
|
235
|
+
class CascadingClassProof2 < CascadingClassProof
|
236
|
+
end
|
237
|
+
block_ran.should == true
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
|
2
|
+
require_relative '../../../../lib/module-cluster.rb'
|
3
|
+
|
4
|
+
describe ::ModuleCluster::Define::Block::CascadingModuleOrSubclass do
|
5
|
+
|
6
|
+
##########################################
|
7
|
+
# cascading_module_include_or_subclass #
|
8
|
+
##########################################
|
9
|
+
|
10
|
+
it 'can run a block on class or module extend' do
|
11
|
+
module ::ModuleCluster::Define::Block::CascadingModuleOrSubclass::Mock01
|
12
|
+
extend ::ModuleCluster::Define::Block::CascadingModuleOrSubclass
|
13
|
+
block_ran = false
|
14
|
+
cascading_module_include_or_subclass do
|
15
|
+
block_ran = true
|
16
|
+
end
|
17
|
+
respond_to?( :extended ).should == true
|
18
|
+
module ModuleProof
|
19
|
+
include ::ModuleCluster::Define::Block::CascadingModuleOrSubclass::Mock01
|
20
|
+
end
|
21
|
+
block_ran.should == true
|
22
|
+
block_ran = false
|
23
|
+
module ModuleProof2
|
24
|
+
include ::ModuleCluster::Define::Block::CascadingModuleOrSubclass::Mock01::ModuleProof
|
25
|
+
end
|
26
|
+
block_ran.should == true
|
27
|
+
block_ran = false
|
28
|
+
module ModuleProofExtended
|
29
|
+
extend ::ModuleCluster::Define::Block::CascadingModuleOrSubclass::Mock01
|
30
|
+
end
|
31
|
+
block_ran.should == false
|
32
|
+
block_ran = false
|
33
|
+
class ClassProof
|
34
|
+
include ::ModuleCluster::Define::Block::CascadingModuleOrSubclass::Mock01
|
35
|
+
end
|
36
|
+
block_ran.should == false
|
37
|
+
class ClassProofExtended
|
38
|
+
extend ::ModuleCluster::Define::Block::CascadingModuleOrSubclass::Mock01
|
39
|
+
end
|
40
|
+
block_ran.should == false
|
41
|
+
block_ran = false
|
42
|
+
Object.new.instance_eval do
|
43
|
+
extend ::ModuleCluster::Define::Block::CascadingModuleOrSubclass::Mock01
|
44
|
+
end
|
45
|
+
block_ran.should == false
|
46
|
+
class SubClassProof < ClassProof
|
47
|
+
end
|
48
|
+
block_ran.should == true
|
49
|
+
block_ran = false
|
50
|
+
class SubSubClassProof < SubClassProof
|
51
|
+
end
|
52
|
+
block_ran.should == true
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,278 @@
|
|
1
|
+
|
2
|
+
require_relative '../../../../lib/module-cluster.rb'
|
3
|
+
|
4
|
+
describe ::ModuleCluster::Define::Block::CascadingModule do
|
5
|
+
|
6
|
+
##############################
|
7
|
+
# cascading_module_include #
|
8
|
+
##############################
|
9
|
+
|
10
|
+
it 'can run a block on module include' do
|
11
|
+
module ::ModuleCluster::Define::Block::CascadingModule::Mock01
|
12
|
+
extend ::ModuleCluster::Define::Block::CascadingModule
|
13
|
+
block_ran = false
|
14
|
+
cascading_module_include do
|
15
|
+
block_ran = true
|
16
|
+
end
|
17
|
+
respond_to?( :included ).should == true
|
18
|
+
class ClassProofExtended
|
19
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock01
|
20
|
+
end
|
21
|
+
block_ran.should == false
|
22
|
+
class ClassProof
|
23
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock01
|
24
|
+
end
|
25
|
+
block_ran.should == false
|
26
|
+
class ClassProof2 < ClassProof
|
27
|
+
end
|
28
|
+
block_ran.should == false
|
29
|
+
Object.new.instance_eval do
|
30
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock01
|
31
|
+
end
|
32
|
+
block_ran.should == false
|
33
|
+
module CascadingModuleProof
|
34
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock01
|
35
|
+
end
|
36
|
+
block_ran.should == true
|
37
|
+
block_ran = false
|
38
|
+
module CascadingModuleProof2
|
39
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock01::CascadingModuleProof
|
40
|
+
end
|
41
|
+
block_ran.should == true
|
42
|
+
block_ran = false
|
43
|
+
module CascadingModuleProofExtended
|
44
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock01
|
45
|
+
end
|
46
|
+
block_ran.should == false
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
#############################
|
51
|
+
# cascading_module_extend #
|
52
|
+
#############################
|
53
|
+
|
54
|
+
it 'can run a block on module extend' do
|
55
|
+
module ::ModuleCluster::Define::Block::CascadingModule::Mock02
|
56
|
+
extend ::ModuleCluster::Define::Block::CascadingModule
|
57
|
+
block_ran = false
|
58
|
+
cascading_module_extend do
|
59
|
+
block_ran = true
|
60
|
+
end
|
61
|
+
respond_to?( :extended ).should == true
|
62
|
+
class ClassProof
|
63
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock02
|
64
|
+
end
|
65
|
+
block_ran.should == false
|
66
|
+
class ClassProof2 < ClassProof
|
67
|
+
end
|
68
|
+
block_ran.should == false
|
69
|
+
class ClassProofExtended
|
70
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock02
|
71
|
+
end
|
72
|
+
block_ran.should == false
|
73
|
+
Object.new.instance_eval do
|
74
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock02
|
75
|
+
end
|
76
|
+
block_ran.should == false
|
77
|
+
module CascadingModuleProof
|
78
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock02
|
79
|
+
end
|
80
|
+
block_ran.should == false
|
81
|
+
module CascadingModuleProofExtended
|
82
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock02
|
83
|
+
end
|
84
|
+
block_ran.should == true
|
85
|
+
block_ran = false
|
86
|
+
module CascadingModuleProofExtended2
|
87
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock02::CascadingModuleProofExtended
|
88
|
+
end
|
89
|
+
block_ran.should == true
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
########################################
|
94
|
+
# cascading_module_include_or_extend #
|
95
|
+
########################################
|
96
|
+
|
97
|
+
it 'can run a block on module include or extend' do
|
98
|
+
module ::ModuleCluster::Define::Block::CascadingModule::Mock03
|
99
|
+
extend ::ModuleCluster::Define::Block::CascadingModule
|
100
|
+
block_ran = false
|
101
|
+
cascading_module_include_or_extend do
|
102
|
+
block_ran = true
|
103
|
+
end
|
104
|
+
respond_to?( :extended ).should == true
|
105
|
+
class ClassProof
|
106
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock03
|
107
|
+
end
|
108
|
+
block_ran.should == false
|
109
|
+
class ClassProof2 < ClassProof
|
110
|
+
end
|
111
|
+
block_ran.should == false
|
112
|
+
class ClassProofExtended
|
113
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock03
|
114
|
+
end
|
115
|
+
block_ran.should == false
|
116
|
+
Object.new.instance_eval do
|
117
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock03
|
118
|
+
end
|
119
|
+
block_ran.should == false
|
120
|
+
module CascadingModuleProof
|
121
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock03
|
122
|
+
end
|
123
|
+
block_ran.should == true
|
124
|
+
block_ran = false
|
125
|
+
module CascadingModuleProof2
|
126
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock03::CascadingModuleProof
|
127
|
+
end
|
128
|
+
block_ran.should == true
|
129
|
+
block_ran = false
|
130
|
+
module CascadingModuleProofExtended
|
131
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock03
|
132
|
+
end
|
133
|
+
block_ran.should == true
|
134
|
+
block_ran = false
|
135
|
+
module CascadingModuleProofExtended2
|
136
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock03::CascadingModuleProofExtended
|
137
|
+
end
|
138
|
+
block_ran.should == true
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
######################################
|
143
|
+
# cascading_prepend_module_include #
|
144
|
+
######################################
|
145
|
+
|
146
|
+
it 'can run a block before module include' do
|
147
|
+
module ::ModuleCluster::Define::Block::CascadingModule::Mock04
|
148
|
+
extend ::ModuleCluster::Define::Block::CascadingModule
|
149
|
+
block_ran = false
|
150
|
+
cascading_prepend_module_include do
|
151
|
+
block_ran = true
|
152
|
+
end
|
153
|
+
respond_to?( :included ).should == true
|
154
|
+
class ClassProofExtended
|
155
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock04
|
156
|
+
end
|
157
|
+
block_ran.should == false
|
158
|
+
class ClassProof
|
159
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock04
|
160
|
+
end
|
161
|
+
block_ran.should == false
|
162
|
+
class ClassProof2 < ClassProof
|
163
|
+
end
|
164
|
+
block_ran.should == false
|
165
|
+
Object.new.instance_eval do
|
166
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock04
|
167
|
+
end
|
168
|
+
block_ran.should == false
|
169
|
+
module CascadingModuleProof
|
170
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock04
|
171
|
+
end
|
172
|
+
block_ran.should == true
|
173
|
+
block_ran = false
|
174
|
+
module CascadingModuleProof2
|
175
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock04::CascadingModuleProof
|
176
|
+
end
|
177
|
+
block_ran.should == true
|
178
|
+
block_ran = false
|
179
|
+
module CascadingModuleProofExtended
|
180
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock04
|
181
|
+
end
|
182
|
+
block_ran.should == false
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
#####################################
|
187
|
+
# cascading_prepend_module_extend #
|
188
|
+
#####################################
|
189
|
+
|
190
|
+
it 'can run a block before module extend' do
|
191
|
+
module ::ModuleCluster::Define::Block::CascadingModule::Mock05
|
192
|
+
extend ::ModuleCluster::Define::Block::CascadingModule
|
193
|
+
block_ran = false
|
194
|
+
cascading_prepend_module_extend do
|
195
|
+
block_ran = true
|
196
|
+
end
|
197
|
+
respond_to?( :extended ).should == true
|
198
|
+
class ClassProof
|
199
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock05
|
200
|
+
end
|
201
|
+
block_ran.should == false
|
202
|
+
class ClassProof2 < ClassProof
|
203
|
+
end
|
204
|
+
block_ran.should == false
|
205
|
+
class ClassProofExtended
|
206
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock05
|
207
|
+
end
|
208
|
+
block_ran.should == false
|
209
|
+
Object.new.instance_eval do
|
210
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock05
|
211
|
+
end
|
212
|
+
block_ran.should == false
|
213
|
+
module CascadingModuleProof
|
214
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock05
|
215
|
+
end
|
216
|
+
block_ran.should == false
|
217
|
+
module CascadingModuleProofExtended
|
218
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock05
|
219
|
+
end
|
220
|
+
block_ran.should == true
|
221
|
+
block_ran = false
|
222
|
+
module CascadingModuleProofExtended2
|
223
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock05::CascadingModuleProofExtended
|
224
|
+
end
|
225
|
+
block_ran.should == true
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
################################################
|
230
|
+
# cascading_prepend_module_include_or_extend #
|
231
|
+
################################################
|
232
|
+
|
233
|
+
it 'can run a block before module include or extend' do
|
234
|
+
module ::ModuleCluster::Define::Block::CascadingModule::Mock06
|
235
|
+
extend ::ModuleCluster::Define::Block::CascadingModule
|
236
|
+
block_ran = false
|
237
|
+
cascading_prepend_module_include_or_extend do
|
238
|
+
block_ran = true
|
239
|
+
end
|
240
|
+
respond_to?( :extended ).should == true
|
241
|
+
class ClassProof
|
242
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock06
|
243
|
+
end
|
244
|
+
block_ran.should == false
|
245
|
+
class ClassProof2 < ClassProof
|
246
|
+
end
|
247
|
+
block_ran.should == false
|
248
|
+
class ClassProofExtended
|
249
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock06
|
250
|
+
end
|
251
|
+
block_ran.should == false
|
252
|
+
Object.new.instance_eval do
|
253
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock06
|
254
|
+
end
|
255
|
+
block_ran.should == false
|
256
|
+
module CascadingModuleProof
|
257
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock06
|
258
|
+
end
|
259
|
+
block_ran.should == true
|
260
|
+
block_ran = false
|
261
|
+
module CascadingModuleProof2
|
262
|
+
include ::ModuleCluster::Define::Block::CascadingModule::Mock06::CascadingModuleProof
|
263
|
+
end
|
264
|
+
block_ran.should == true
|
265
|
+
block_ran = false
|
266
|
+
module CascadingModuleProofExtended
|
267
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock06
|
268
|
+
end
|
269
|
+
block_ran.should == true
|
270
|
+
block_ran = false
|
271
|
+
module CascadingModuleProofExtended2
|
272
|
+
extend ::ModuleCluster::Define::Block::CascadingModule::Mock06::CascadingModuleProofExtended
|
273
|
+
end
|
274
|
+
block_ran.should == true
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
end
|
@@ -1,19 +1,19 @@
|
|
1
1
|
|
2
2
|
require_relative '../../../../lib/module-cluster.rb'
|
3
3
|
|
4
|
-
describe ModuleCluster::Define::Block::ClassOrInstance do
|
4
|
+
describe ::ModuleCluster::Define::Block::ClassOrInstance do
|
5
5
|
|
6
6
|
##############################
|
7
7
|
# class_or_instance_extend #
|
8
8
|
##############################
|
9
9
|
|
10
10
|
it 'can run a block on class or instance extend' do
|
11
|
-
module ModuleCluster::Define::Block::ClassOrInstance::Mock01
|
11
|
+
module ::ModuleCluster::Define::Block::ClassOrInstance::Mock01
|
12
12
|
extend ::ModuleCluster::Define::Block::ClassOrInstance
|
13
13
|
block_ran = false
|
14
14
|
class_or_instance_extend do
|
15
15
|
block_ran = true
|
16
|
-
self.should == ModuleCluster::Define::Block::ClassOrInstance::Mock01
|
16
|
+
self.should == ::ModuleCluster::Define::Block::ClassOrInstance::Mock01
|
17
17
|
end
|
18
18
|
respond_to?( :extended ).should == true
|
19
19
|
module ModuleProof
|
@@ -45,12 +45,12 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
|
|
45
45
|
######################################
|
46
46
|
|
47
47
|
it 'can run a block on class include or instance extend' do
|
48
|
-
module ModuleCluster::Define::Block::ClassOrInstance::Mock02
|
48
|
+
module ::ModuleCluster::Define::Block::ClassOrInstance::Mock02
|
49
49
|
extend ::ModuleCluster::Define::Block::ClassOrInstance
|
50
50
|
block_ran = false
|
51
51
|
class_include_or_instance_extend do
|
52
52
|
block_ran = true
|
53
|
-
self.should == ModuleCluster::Define::Block::ClassOrInstance::Mock02
|
53
|
+
self.should == ::ModuleCluster::Define::Block::ClassOrInstance::Mock02
|
54
54
|
end
|
55
55
|
respond_to?( :extended ).should == true
|
56
56
|
module ModuleProof
|
@@ -82,12 +82,12 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
|
|
82
82
|
################################################
|
83
83
|
|
84
84
|
it 'can run a block on class include or extend or instance extend' do
|
85
|
-
module ModuleCluster::Define::Block::ClassOrInstance::Mock03
|
85
|
+
module ::ModuleCluster::Define::Block::ClassOrInstance::Mock03
|
86
86
|
extend ::ModuleCluster::Define::Block::ClassOrInstance
|
87
87
|
block_ran = false
|
88
88
|
class_include_or_extend_or_instance_extend do
|
89
89
|
block_ran = true
|
90
|
-
self.should == ModuleCluster::Define::Block::ClassOrInstance::Mock03
|
90
|
+
self.should == ::ModuleCluster::Define::Block::ClassOrInstance::Mock03
|
91
91
|
end
|
92
92
|
respond_to?( :extended ).should == true
|
93
93
|
module ModuleProof
|
@@ -120,12 +120,12 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
|
|
120
120
|
######################################
|
121
121
|
|
122
122
|
it 'can run a block before class or instance extend' do
|
123
|
-
module ModuleCluster::Define::Block::ClassOrInstance::Mock04
|
123
|
+
module ::ModuleCluster::Define::Block::ClassOrInstance::Mock04
|
124
124
|
extend ::ModuleCluster::Define::Block::ClassOrInstance
|
125
125
|
block_ran = false
|
126
126
|
class_or_instance_extend do
|
127
127
|
block_ran = true
|
128
|
-
self.should == ModuleCluster::Define::Block::ClassOrInstance::Mock04
|
128
|
+
self.should == ::ModuleCluster::Define::Block::ClassOrInstance::Mock04
|
129
129
|
end
|
130
130
|
respond_to?( :extended ).should == true
|
131
131
|
module ModuleProof
|
@@ -157,12 +157,12 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
|
|
157
157
|
##############################################
|
158
158
|
|
159
159
|
it 'can run a block before class include or instance extend' do
|
160
|
-
module ModuleCluster::Define::Block::ClassOrInstance::Mock05
|
160
|
+
module ::ModuleCluster::Define::Block::ClassOrInstance::Mock05
|
161
161
|
extend ::ModuleCluster::Define::Block::ClassOrInstance
|
162
162
|
block_ran = false
|
163
163
|
class_include_or_instance_extend do
|
164
164
|
block_ran = true
|
165
|
-
self.should == ModuleCluster::Define::Block::ClassOrInstance::Mock05
|
165
|
+
self.should == ::ModuleCluster::Define::Block::ClassOrInstance::Mock05
|
166
166
|
end
|
167
167
|
respond_to?( :extended ).should == true
|
168
168
|
module ModuleProof
|
@@ -194,12 +194,12 @@ describe ModuleCluster::Define::Block::ClassOrInstance do
|
|
194
194
|
########################################################
|
195
195
|
|
196
196
|
it 'can run a block before class include or extend or instance extend' do
|
197
|
-
module ModuleCluster::Define::Block::ClassOrInstance::Mock06
|
197
|
+
module ::ModuleCluster::Define::Block::ClassOrInstance::Mock06
|
198
198
|
extend ::ModuleCluster::Define::Block::ClassOrInstance
|
199
199
|
block_ran = false
|
200
200
|
class_include_or_extend_or_instance_extend do
|
201
201
|
block_ran = true
|
202
|
-
self.should == ModuleCluster::Define::Block::ClassOrInstance::Mock06
|
202
|
+
self.should == ::ModuleCluster::Define::Block::ClassOrInstance::Mock06
|
203
203
|
end
|
204
204
|
respond_to?( :extended ).should == true
|
205
205
|
module ModuleProof
|