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