module-cluster 1.4.8 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +127 -337
- data/lib/module-cluster.rb +1 -153
- data/lib/module/cluster.rb +341 -0
- data/lib/module/cluster/class_support.rb +22 -0
- data/lib/module/cluster/cluster.rb +10 -0
- data/lib/module/cluster/cluster/cluster_interface.rb +550 -0
- data/lib/module/cluster/exception/module_not_in_stack.rb +26 -0
- data/lib/module/cluster/instance_controller.rb +14 -0
- data/lib/module/cluster/instance_controller/hook_controller.rb +33 -0
- data/lib/module/cluster/instance_controller/hook_controller/chain_proxy.rb +511 -0
- data/lib/module/cluster/instance_controller/hook_controller/hook_controller_interface.rb +830 -0
- data/lib/module/cluster/instance_controller/instance_controller_interface.rb +269 -0
- data/lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb +359 -0
- data/lib/module/cluster/instance_controller/multiple_hook_controller_proxy/chain_proxy.rb +442 -0
- data/lib/module/cluster/module_support.rb +67 -0
- data/lib/module/namespaces.rb +13 -0
- data/lib/module/requires.rb +32 -0
- data/spec/module/cluster/cluster_spec.rb +473 -0
- data/spec/module/cluster/instance_controller/hook_controller_spec.rb +922 -0
- data/spec/module/cluster/instance_controller/multiple_hook_controller_proxy_spec.rb +1240 -0
- data/spec/module/cluster_spec.rb +1794 -0
- metadata +27 -98
- data/README.rdoc +0 -395
- data/lib/module-cluster/ModuleCluster.rb +0 -9
- data/lib/module-cluster/ModuleCluster/Define.rb +0 -12
- data/lib/module-cluster/ModuleCluster/Define/Block.rb +0 -9
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClass.rb +0 -83
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClassOrModule.rb +0 -70
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModule.rb +0 -79
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModuleOrSubclass.rb +0 -21
- data/lib/module-cluster/ModuleCluster/Define/Block/Class.rb +0 -77
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrInstance.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrInstance.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrSubclass.rb +0 -36
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrSubclass.rb +0 -29
- data/lib/module-cluster/ModuleCluster/Define/Block/Instance.rb +0 -45
- data/lib/module-cluster/ModuleCluster/Define/Block/Module.rb +0 -77
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrInstance.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrSubclass.rb +0 -29
- data/lib/module-cluster/ModuleCluster/Define/Block/Subclass.rb +0 -56
- data/lib/module-cluster/ModuleCluster/Define/ClassCluster.rb +0 -193
- data/lib/module-cluster/ModuleCluster/Define/ClassOrInstanceCluster.rb +0 -128
- data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +0 -181
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +0 -185
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +0 -181
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +0 -181
- data/lib/module-cluster/ModuleCluster/Define/Deprecated.rb +0 -40
- data/lib/module-cluster/ModuleCluster/Define/InstanceCluster.rb +0 -45
- data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +0 -193
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrClassCluster.rb +0 -209
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrInstanceCluster.rb +0 -128
- data/lib/module-cluster/ModuleCluster/Define/Status.rb +0 -106
- data/lib/module-cluster/ModuleCluster/Suspend.rb +0 -7
- data/lib/module-cluster/ModuleCluster/Suspend/Hooks.rb +0 -315
- data/lib/module-cluster/ModuleCluster/Suspend/WithoutHooks.rb +0 -153
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures.rb +0 -77
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/ClusterStack.rb +0 -44
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/PerformCascades.rb +0 -292
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/Subclass.rb +0 -24
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack.rb +0 -12
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block.rb +0 -9
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Class.rb +0 -36
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Inherited.rb +0 -20
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Instance.rb +0 -20
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Module.rb +0 -36
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Set.rb +0 -6
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Extends.rb +0 -140
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Includes.rb +0 -110
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsExtends.rb +0 -140
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsIncludes.rb +0 -110
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set.rb +0 -35
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy.rb +0 -359
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Status.rb +0 -55
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Suspend.rb +0 -199
- data/lib/module-cluster/_private_/ModuleCluster/ExtendForCascade.rb +0 -34
- data/spec/ModuleCluster/Define/Block/CascadingClassOrModule_spec.rb +0 -285
- data/spec/ModuleCluster/Define/Block/CascadingClass_spec.rb +0 -254
- data/spec/ModuleCluster/Define/Block/CascadingModuleOrSubclass_spec.rb +0 -56
- data/spec/ModuleCluster/Define/Block/CascadingModule_spec.rb +0 -278
- data/spec/ModuleCluster/Define/Block/ClassOrInstance_spec.rb +0 -230
- data/spec/ModuleCluster/Define/Block/ClassOrModuleOrInstance_spec.rb +0 -238
- data/spec/ModuleCluster/Define/Block/ClassOrModuleOrSubclass_spec.rb +0 -54
- data/spec/ModuleCluster/Define/Block/ClassOrModule_spec.rb +0 -231
- data/spec/ModuleCluster/Define/Block/ClassOrSubclass_spec.rb +0 -54
- data/spec/ModuleCluster/Define/Block/Class_spec.rb +0 -224
- data/spec/ModuleCluster/Define/Block/Instance_spec.rb +0 -78
- data/spec/ModuleCluster/Define/Block/ModuleOrInstance_spec.rb +0 -54
- data/spec/ModuleCluster/Define/Block/ModuleOrSubclass_spec.rb +0 -51
- data/spec/ModuleCluster/Define/Block/Module_spec.rb +0 -230
- data/spec/ModuleCluster/Define/Block/Subclass_spec.rb +0 -73
- data/spec/ModuleCluster/Define/Block_spec.rb +0 -18
- data/spec/ModuleCluster/Define/ClassCluster_spec.rb +0 -728
- data/spec/ModuleCluster/Define/ClassOrInstanceCluster_spec.rb +0 -576
- data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +0 -659
- data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +0 -678
- data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +0 -644
- data/spec/ModuleCluster/Define/Cluster_spec.rb +0 -708
- data/spec/ModuleCluster/Define/InstanceCluster_spec.rb +0 -102
- data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +0 -728
- data/spec/ModuleCluster/Define/ModuleOrClassCluster_spec.rb +0 -728
- data/spec/ModuleCluster/Define/ModuleOrInstanceCluster_spec.rb +0 -576
- data/spec/ModuleCluster/Suspend/Hooks_spec.rb +0 -573
- data/spec/ModuleCluster/Suspend/WithoutHooks_spec.rb +0 -559
- data/spec/ModuleCluster_spec.rb +0 -15
- data/spec/_private_/ModuleCluster/CascadeFeatures/PerformCascades_spec.rb +0 -386
- data/spec/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy_spec.rb +0 -419
- data/spec/_private_/ModuleCluster/ClusterStack/Suspend_spec.rb +0 -242
@@ -1,54 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative '../../../../lib/module-cluster.rb'
|
3
|
-
|
4
|
-
describe ::ModuleCluster::Define::Block::ClassOrModuleOrSubclass do
|
5
|
-
|
6
|
-
########################################
|
7
|
-
# class_or_module_or_instance_extend #
|
8
|
-
########################################
|
9
|
-
|
10
|
-
it 'can run a block on class or module extend' do
|
11
|
-
module ::ModuleCluster::Define::Block::ClassOrModuleOrSubclass::Mock01
|
12
|
-
extend ::ModuleCluster::Define::Block::ClassOrModuleOrSubclass
|
13
|
-
block_ran = false
|
14
|
-
class_or_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::ClassOrModuleOrSubclass::Mock01
|
20
|
-
end
|
21
|
-
block_ran.should == true
|
22
|
-
block_ran = false
|
23
|
-
module ModuleProof2
|
24
|
-
extend ::ModuleCluster::Define::Block::ClassOrModuleOrSubclass::Mock01
|
25
|
-
end
|
26
|
-
block_ran.should == false
|
27
|
-
block_ran = false
|
28
|
-
class ClassProof
|
29
|
-
include ::ModuleCluster::Define::Block::ClassOrModuleOrSubclass::Mock01
|
30
|
-
end
|
31
|
-
block_ran.should == true
|
32
|
-
block_ran = false
|
33
|
-
class ClassProof2
|
34
|
-
extend ::ModuleCluster::Define::Block::ClassOrModuleOrSubclass::Mock01
|
35
|
-
end
|
36
|
-
block_ran.should == false
|
37
|
-
block_ran = false
|
38
|
-
Object.new.instance_eval do
|
39
|
-
extend ::ModuleCluster::Define::Block::ClassOrModuleOrSubclass::Mock01
|
40
|
-
end
|
41
|
-
block_ran.should == false
|
42
|
-
class SubClassProof < ClassProof
|
43
|
-
include ::ModuleCluster::Define::Block::ClassOrModuleOrSubclass::Mock01
|
44
|
-
end
|
45
|
-
block_ran.should == true
|
46
|
-
block_ran = false
|
47
|
-
class SubSubClassProof < SubClassProof
|
48
|
-
include ::ModuleCluster::Define::Block::ClassOrModuleOrSubclass::Mock01
|
49
|
-
end
|
50
|
-
block_ran.should == true
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
@@ -1,231 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative '../../../../lib/module-cluster.rb'
|
3
|
-
|
4
|
-
describe ::ModuleCluster::Define::Block::ClassOrModule do
|
5
|
-
|
6
|
-
#############################
|
7
|
-
# class_or_module_include #
|
8
|
-
#############################
|
9
|
-
|
10
|
-
it 'can run a block on class or module include' do
|
11
|
-
module ::ModuleCluster::Define::Block::ClassOrModule::Mock01
|
12
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule
|
13
|
-
block_ran = false
|
14
|
-
class_or_module_include do
|
15
|
-
block_ran = true
|
16
|
-
self.should == ::ModuleCluster::Define::Block::ClassOrModule::Mock01
|
17
|
-
end
|
18
|
-
respond_to?( :included ).should == true
|
19
|
-
class ClassProof
|
20
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock01
|
21
|
-
end
|
22
|
-
block_ran.should == false
|
23
|
-
class ClassProof2
|
24
|
-
include ::ModuleCluster::Define::Block::ClassOrModule::Mock01
|
25
|
-
end
|
26
|
-
block_ran.should == true
|
27
|
-
block_ran = false
|
28
|
-
Object.new.instance_eval do
|
29
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock01
|
30
|
-
end
|
31
|
-
block_ran.should == false
|
32
|
-
module ModuleProof
|
33
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock01
|
34
|
-
end
|
35
|
-
block_ran.should == false
|
36
|
-
module ModuleProof2
|
37
|
-
include ::ModuleCluster::Define::Block::ClassOrModule::Mock01
|
38
|
-
end
|
39
|
-
block_ran.should == true
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
############################
|
44
|
-
# class_or_module_extend #
|
45
|
-
############################
|
46
|
-
|
47
|
-
it 'can run a block on class or module extend' do
|
48
|
-
module ::ModuleCluster::Define::Block::ClassOrModule::Mock02
|
49
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule
|
50
|
-
block_ran = false
|
51
|
-
class_or_module_extend do
|
52
|
-
block_ran = true
|
53
|
-
self.should == ::ModuleCluster::Define::Block::ClassOrModule::Mock02
|
54
|
-
end
|
55
|
-
respond_to?( :extended ).should == true
|
56
|
-
class ClassProof
|
57
|
-
include ::ModuleCluster::Define::Block::ClassOrModule::Mock02
|
58
|
-
end
|
59
|
-
block_ran.should == false
|
60
|
-
class ClassProof2
|
61
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock02
|
62
|
-
end
|
63
|
-
block_ran.should == true
|
64
|
-
block_ran = false
|
65
|
-
Object.new.instance_eval do
|
66
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock02
|
67
|
-
end
|
68
|
-
block_ran.should == false
|
69
|
-
module ModuleProof
|
70
|
-
include ::ModuleCluster::Define::Block::ClassOrModule::Mock02
|
71
|
-
end
|
72
|
-
block_ran.should == false
|
73
|
-
module ModuleProof2
|
74
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock02
|
75
|
-
end
|
76
|
-
block_ran.should == true
|
77
|
-
end end
|
78
|
-
|
79
|
-
#######################################
|
80
|
-
# class_or_module_include_or_extend #
|
81
|
-
#######################################
|
82
|
-
|
83
|
-
it 'can run a block on class or module include or extend' do
|
84
|
-
module ::ModuleCluster::Define::Block::ClassOrModule::Mock03
|
85
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule
|
86
|
-
block_ran = false
|
87
|
-
class_or_module_include_or_extend do
|
88
|
-
block_ran = true
|
89
|
-
self.should == ::ModuleCluster::Define::Block::ClassOrModule::Mock03
|
90
|
-
end
|
91
|
-
respond_to?( :extended ).should == true
|
92
|
-
class ClassProof
|
93
|
-
include ::ModuleCluster::Define::Block::ClassOrModule::Mock03
|
94
|
-
end
|
95
|
-
block_ran.should == true
|
96
|
-
block_ran = false
|
97
|
-
class ClassProof2
|
98
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock03
|
99
|
-
end
|
100
|
-
block_ran.should == true
|
101
|
-
block_ran = false
|
102
|
-
Object.new.instance_eval do
|
103
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock03
|
104
|
-
end
|
105
|
-
block_ran.should == false
|
106
|
-
module ModuleProof
|
107
|
-
include ::ModuleCluster::Define::Block::ClassOrModule::Mock03
|
108
|
-
end
|
109
|
-
block_ran.should == true
|
110
|
-
block_ran = false
|
111
|
-
module ModuleProof2
|
112
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock03
|
113
|
-
end
|
114
|
-
block_ran.should == true
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
#####################################
|
119
|
-
# prepend_class_or_module_include #
|
120
|
-
#####################################
|
121
|
-
|
122
|
-
it 'can run a block before class or module include' do
|
123
|
-
module ::ModuleCluster::Define::Block::ClassOrModule::Mock04
|
124
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule
|
125
|
-
block_ran = false
|
126
|
-
prepend_class_or_module_include do
|
127
|
-
block_ran = true
|
128
|
-
self.should == ::ModuleCluster::Define::Block::ClassOrModule::Mock04
|
129
|
-
end
|
130
|
-
respond_to?( :included ).should == true
|
131
|
-
class ClassProof
|
132
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock04
|
133
|
-
end
|
134
|
-
block_ran.should == false
|
135
|
-
class ClassProof2
|
136
|
-
include ::ModuleCluster::Define::Block::ClassOrModule::Mock04
|
137
|
-
end
|
138
|
-
block_ran.should == true
|
139
|
-
block_ran = false
|
140
|
-
Object.new.instance_eval do
|
141
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock04
|
142
|
-
end
|
143
|
-
block_ran.should == false
|
144
|
-
module ModuleProof
|
145
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock04
|
146
|
-
end
|
147
|
-
block_ran.should == false
|
148
|
-
module ModuleProof2
|
149
|
-
include ::ModuleCluster::Define::Block::ClassOrModule::Mock04
|
150
|
-
end
|
151
|
-
block_ran.should == true
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
####################################
|
156
|
-
# prepend_class_or_module_extend #
|
157
|
-
####################################
|
158
|
-
|
159
|
-
it 'can run a block before class or module extend' do
|
160
|
-
module ::ModuleCluster::Define::Block::ClassOrModule::Mock05
|
161
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule
|
162
|
-
block_ran = false
|
163
|
-
prepend_class_or_module_extend do
|
164
|
-
block_ran = true
|
165
|
-
self.should == ::ModuleCluster::Define::Block::ClassOrModule::Mock05
|
166
|
-
end
|
167
|
-
respond_to?( :extended ).should == true
|
168
|
-
class ClassProof
|
169
|
-
include ::ModuleCluster::Define::Block::ClassOrModule::Mock05
|
170
|
-
end
|
171
|
-
block_ran.should == false
|
172
|
-
class ClassProof2
|
173
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock05
|
174
|
-
end
|
175
|
-
block_ran.should == true
|
176
|
-
block_ran = false
|
177
|
-
Object.new.instance_eval do
|
178
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock05
|
179
|
-
end
|
180
|
-
block_ran.should == false
|
181
|
-
module ModuleProof
|
182
|
-
include ::ModuleCluster::Define::Block::ClassOrModule::Mock05
|
183
|
-
end
|
184
|
-
block_ran.should == false
|
185
|
-
module ModuleProof2
|
186
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock05
|
187
|
-
end
|
188
|
-
block_ran.should == true
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
###############################################
|
193
|
-
# prepend_class_or_module_include_or_extend #
|
194
|
-
###############################################
|
195
|
-
|
196
|
-
it 'can run a block before class or module include or extend' do
|
197
|
-
module ::ModuleCluster::Define::Block::ClassOrModule::Mock06
|
198
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule
|
199
|
-
block_ran = false
|
200
|
-
prepend_class_or_module_include_or_extend do
|
201
|
-
block_ran = true
|
202
|
-
self.should == ::ModuleCluster::Define::Block::ClassOrModule::Mock06
|
203
|
-
end
|
204
|
-
respond_to?( :extended ).should == true
|
205
|
-
class ClassProof
|
206
|
-
include ::ModuleCluster::Define::Block::ClassOrModule::Mock06
|
207
|
-
end
|
208
|
-
block_ran.should == true
|
209
|
-
block_ran = false
|
210
|
-
class ClassProof2
|
211
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock06
|
212
|
-
end
|
213
|
-
block_ran.should == true
|
214
|
-
block_ran = false
|
215
|
-
Object.new.instance_eval do
|
216
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock06
|
217
|
-
end
|
218
|
-
block_ran.should == false
|
219
|
-
module ModuleProof
|
220
|
-
include ::ModuleCluster::Define::Block::ClassOrModule::Mock06
|
221
|
-
end
|
222
|
-
block_ran.should == true
|
223
|
-
block_ran = false
|
224
|
-
module ModuleProof2
|
225
|
-
extend ::ModuleCluster::Define::Block::ClassOrModule::Mock06
|
226
|
-
end
|
227
|
-
block_ran.should == true
|
228
|
-
end
|
229
|
-
end
|
230
|
-
|
231
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative '../../../../lib/module-cluster.rb'
|
3
|
-
|
4
|
-
describe ::ModuleCluster::Define::Block::ClassOrSubclass do
|
5
|
-
|
6
|
-
###############################
|
7
|
-
# class_include_or_subclass #
|
8
|
-
###############################
|
9
|
-
|
10
|
-
it 'can run a block on class or module extend' do
|
11
|
-
module ::ModuleCluster::Define::Block::ClassOrSubclass::Mock01
|
12
|
-
extend ::ModuleCluster::Define::Block::ClassOrSubclass
|
13
|
-
block_ran = false
|
14
|
-
class_include_or_subclass do |class_instance|
|
15
|
-
block_ran = true
|
16
|
-
end
|
17
|
-
respond_to?( :extended ).should == true
|
18
|
-
module ModuleProof
|
19
|
-
include ::ModuleCluster::Define::Block::ClassOrSubclass::Mock01
|
20
|
-
end
|
21
|
-
block_ran.should == false
|
22
|
-
block_ran = false
|
23
|
-
module ModuleProof2
|
24
|
-
extend ::ModuleCluster::Define::Block::ClassOrSubclass::Mock01
|
25
|
-
end
|
26
|
-
block_ran.should == false
|
27
|
-
block_ran = false
|
28
|
-
class ClassProof
|
29
|
-
include ::ModuleCluster::Define::Block::ClassOrSubclass::Mock01
|
30
|
-
end
|
31
|
-
block_ran.should == true
|
32
|
-
block_ran = false
|
33
|
-
class ClassProof2
|
34
|
-
extend ::ModuleCluster::Define::Block::ClassOrSubclass::Mock01
|
35
|
-
end
|
36
|
-
block_ran.should == false
|
37
|
-
block_ran = false
|
38
|
-
Object.new.instance_eval do
|
39
|
-
extend ::ModuleCluster::Define::Block::ClassOrSubclass::Mock01
|
40
|
-
end
|
41
|
-
block_ran.should == false
|
42
|
-
class SubClassProof < ClassProof
|
43
|
-
include ::ModuleCluster::Define::Block::ClassOrSubclass::Mock01
|
44
|
-
end
|
45
|
-
block_ran.should == true
|
46
|
-
block_ran = false
|
47
|
-
class SubSubClassProof < SubClassProof
|
48
|
-
include ::ModuleCluster::Define::Block::ClassOrSubclass::Mock01
|
49
|
-
end
|
50
|
-
block_ran.should == true
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
@@ -1,224 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative '../../../../lib/module-cluster.rb'
|
3
|
-
|
4
|
-
describe ::ModuleCluster::Define::Block::Class do
|
5
|
-
|
6
|
-
###################
|
7
|
-
# class_include #
|
8
|
-
###################
|
9
|
-
|
10
|
-
it 'can run a block on class include' do
|
11
|
-
module ::ModuleCluster::Define::Block::Class::Mock01
|
12
|
-
extend ::ModuleCluster::Define::Block::Class
|
13
|
-
block_ran = false
|
14
|
-
class_include do
|
15
|
-
block_ran = true
|
16
|
-
self.should == ::ModuleCluster::Define::Block::Class::Mock01
|
17
|
-
end
|
18
|
-
respond_to?( :included ).should == true
|
19
|
-
module ModuleProof
|
20
|
-
include ::ModuleCluster::Define::Block::Class::Mock01
|
21
|
-
end
|
22
|
-
block_ran.should == false
|
23
|
-
module ModuleProof2
|
24
|
-
extend ::ModuleCluster::Define::Block::Class::Mock01
|
25
|
-
end
|
26
|
-
block_ran.should == false
|
27
|
-
Object.new.instance_eval do
|
28
|
-
extend ::ModuleCluster::Define::Block::Class::Mock01
|
29
|
-
end
|
30
|
-
block_ran.should == false
|
31
|
-
class ClassProof
|
32
|
-
extend ::ModuleCluster::Define::Block::Class::Mock01
|
33
|
-
end
|
34
|
-
block_ran.should == false
|
35
|
-
class ClassProof2
|
36
|
-
include ::ModuleCluster::Define::Block::Class::Mock01
|
37
|
-
end
|
38
|
-
block_ran.should == true
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
##################
|
43
|
-
# class_extend #
|
44
|
-
##################
|
45
|
-
|
46
|
-
it 'can run a block on class extend' do
|
47
|
-
module ::ModuleCluster::Define::Block::Class::Mock02
|
48
|
-
extend ::ModuleCluster::Define::Block::Class
|
49
|
-
block_ran = false
|
50
|
-
class_extend do
|
51
|
-
block_ran = true
|
52
|
-
self.should == ::ModuleCluster::Define::Block::Class::Mock02
|
53
|
-
end
|
54
|
-
respond_to?( :extended ).should == true
|
55
|
-
module ModuleProof
|
56
|
-
include ::ModuleCluster::Define::Block::Class::Mock02
|
57
|
-
end
|
58
|
-
block_ran.should == false
|
59
|
-
module ModuleProof2
|
60
|
-
extend ::ModuleCluster::Define::Block::Class::Mock02
|
61
|
-
end
|
62
|
-
block_ran.should == false
|
63
|
-
Object.new.instance_eval do
|
64
|
-
extend ::ModuleCluster::Define::Block::Class::Mock02
|
65
|
-
end
|
66
|
-
block_ran.should == false
|
67
|
-
class ClassProof
|
68
|
-
include ::ModuleCluster::Define::Block::Class::Mock02
|
69
|
-
end
|
70
|
-
block_ran.should == false
|
71
|
-
class ClassProof2
|
72
|
-
extend ::ModuleCluster::Define::Block::Class::Mock02
|
73
|
-
end
|
74
|
-
block_ran.should == true
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
#############################
|
79
|
-
# class_include_or_extend #
|
80
|
-
#############################
|
81
|
-
|
82
|
-
it 'can run a block on class include or extend' do
|
83
|
-
module ::ModuleCluster::Define::Block::Class::Mock03
|
84
|
-
extend ::ModuleCluster::Define::Block::Class
|
85
|
-
block_ran = false
|
86
|
-
class_include_or_extend do
|
87
|
-
block_ran = true
|
88
|
-
self.should == ::ModuleCluster::Define::Block::Class::Mock03
|
89
|
-
end
|
90
|
-
respond_to?( :extended ).should == true
|
91
|
-
module ModuleProof
|
92
|
-
include ::ModuleCluster::Define::Block::Class::Mock03
|
93
|
-
end
|
94
|
-
block_ran.should == false
|
95
|
-
module ModuleProof2
|
96
|
-
extend ::ModuleCluster::Define::Block::Class::Mock03
|
97
|
-
end
|
98
|
-
block_ran.should == false
|
99
|
-
Object.new.instance_eval do
|
100
|
-
extend ::ModuleCluster::Define::Block::Class::Mock03
|
101
|
-
end
|
102
|
-
block_ran.should == false
|
103
|
-
class ClassProof
|
104
|
-
include ::ModuleCluster::Define::Block::Class::Mock03
|
105
|
-
end
|
106
|
-
block_ran.should == true
|
107
|
-
block_ran = false
|
108
|
-
class ClassProof2
|
109
|
-
extend ::ModuleCluster::Define::Block::Class::Mock03
|
110
|
-
end
|
111
|
-
block_ran.should == true
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
###########################
|
116
|
-
# prepend_class_include #
|
117
|
-
###########################
|
118
|
-
|
119
|
-
it 'can run a block before class include' do
|
120
|
-
module ::ModuleCluster::Define::Block::Class::Mock04
|
121
|
-
extend ::ModuleCluster::Define::Block::Class
|
122
|
-
block_ran = false
|
123
|
-
prepend_class_include do
|
124
|
-
block_ran = true
|
125
|
-
self.should == ::ModuleCluster::Define::Block::Class::Mock04
|
126
|
-
end
|
127
|
-
respond_to?( :included ).should == true
|
128
|
-
module ModuleProof
|
129
|
-
include ::ModuleCluster::Define::Block::Class::Mock04
|
130
|
-
end
|
131
|
-
block_ran.should == false
|
132
|
-
module ModuleProof2
|
133
|
-
extend ::ModuleCluster::Define::Block::Class::Mock04
|
134
|
-
end
|
135
|
-
block_ran.should == false
|
136
|
-
Object.new.instance_eval do
|
137
|
-
extend ::ModuleCluster::Define::Block::Class::Mock04
|
138
|
-
end
|
139
|
-
block_ran.should == false
|
140
|
-
class ClassProof
|
141
|
-
extend ::ModuleCluster::Define::Block::Class::Mock04
|
142
|
-
end
|
143
|
-
block_ran.should == false
|
144
|
-
class ClassProof2
|
145
|
-
include ::ModuleCluster::Define::Block::Class::Mock04
|
146
|
-
end
|
147
|
-
block_ran.should == true
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
##########################
|
152
|
-
# prepend_class_extend #
|
153
|
-
##########################
|
154
|
-
|
155
|
-
it 'can run a block before class extend' do
|
156
|
-
module ::ModuleCluster::Define::Block::Class::Mock05
|
157
|
-
extend ::ModuleCluster::Define::Block::Class
|
158
|
-
block_ran = false
|
159
|
-
prepend_class_extend do
|
160
|
-
block_ran = true
|
161
|
-
self.should == ::ModuleCluster::Define::Block::Class::Mock05
|
162
|
-
end
|
163
|
-
respond_to?( :extended ).should == true
|
164
|
-
module ModuleProof
|
165
|
-
include ::ModuleCluster::Define::Block::Class::Mock05
|
166
|
-
end
|
167
|
-
block_ran.should == false
|
168
|
-
module ModuleProof2
|
169
|
-
extend ::ModuleCluster::Define::Block::Class::Mock05
|
170
|
-
end
|
171
|
-
block_ran.should == false
|
172
|
-
Object.new.instance_eval do
|
173
|
-
extend ::ModuleCluster::Define::Block::Class::Mock05
|
174
|
-
end
|
175
|
-
block_ran.should == false
|
176
|
-
class ClassProof
|
177
|
-
include ::ModuleCluster::Define::Block::Class::Mock05
|
178
|
-
end
|
179
|
-
block_ran.should == false
|
180
|
-
class ClassProof2
|
181
|
-
extend ::ModuleCluster::Define::Block::Class::Mock05
|
182
|
-
end
|
183
|
-
block_ran.should == true
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
#####################################
|
188
|
-
# prepend_class_include_or_extend #
|
189
|
-
#####################################
|
190
|
-
|
191
|
-
it 'can run a block before class include or extend' do
|
192
|
-
module ::ModuleCluster::Define::Block::Class::Mock06
|
193
|
-
extend ::ModuleCluster::Define::Block::Class
|
194
|
-
block_ran = false
|
195
|
-
prepend_class_include_or_extend do
|
196
|
-
block_ran = true
|
197
|
-
self.should == ::ModuleCluster::Define::Block::Class::Mock06
|
198
|
-
end
|
199
|
-
respond_to?( :extended ).should == true
|
200
|
-
module ModuleProof
|
201
|
-
include ::ModuleCluster::Define::Block::Class::Mock06
|
202
|
-
end
|
203
|
-
block_ran.should == false
|
204
|
-
module ModuleProof2
|
205
|
-
extend ::ModuleCluster::Define::Block::Class::Mock06
|
206
|
-
end
|
207
|
-
block_ran.should == false
|
208
|
-
Object.new.instance_eval do
|
209
|
-
extend ::ModuleCluster::Define::Block::Class::Mock06
|
210
|
-
end
|
211
|
-
block_ran.should == false
|
212
|
-
class ClassProof
|
213
|
-
include ::ModuleCluster::Define::Block::Class::Mock06
|
214
|
-
end
|
215
|
-
block_ran.should == true
|
216
|
-
block_ran = false
|
217
|
-
class ClassProof2
|
218
|
-
extend ::ModuleCluster::Define::Block::Class::Mock06
|
219
|
-
end
|
220
|
-
block_ran.should == true
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
end
|