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,230 +0,0 @@
1
-
2
- require_relative '../../../../lib/module-cluster.rb'
3
-
4
- describe ::ModuleCluster::Define::Block::ClassOrInstance do
5
-
6
- ##############################
7
- # class_or_instance_extend #
8
- ##############################
9
-
10
- it 'can run a block on class or instance extend' do
11
- module ::ModuleCluster::Define::Block::ClassOrInstance::Mock01
12
- extend ::ModuleCluster::Define::Block::ClassOrInstance
13
- block_ran = false
14
- class_or_instance_extend do
15
- block_ran = true
16
- self.should == ::ModuleCluster::Define::Block::ClassOrInstance::Mock01
17
- end
18
- respond_to?( :extended ).should == true
19
- module ModuleProof
20
- include ::ModuleCluster::Define::Block::ClassOrInstance::Mock01
21
- end
22
- block_ran.should == false
23
- module ModuleProof2
24
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock01
25
- end
26
- block_ran.should == false
27
- class ClassProof
28
- include ::ModuleCluster::Define::Block::ClassOrInstance::Mock01
29
- end
30
- block_ran.should == false
31
- class ClassProof2
32
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock01
33
- end
34
- block_ran.should == true
35
- block_ran = false
36
- Object.new.instance_eval do
37
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock01
38
- end
39
- block_ran.should == true
40
- end
41
- end
42
-
43
- ######################################
44
- # class_include_or_instance_extend #
45
- ######################################
46
-
47
- it 'can run a block on class include or instance extend' do
48
- module ::ModuleCluster::Define::Block::ClassOrInstance::Mock02
49
- extend ::ModuleCluster::Define::Block::ClassOrInstance
50
- block_ran = false
51
- class_include_or_instance_extend do
52
- block_ran = true
53
- self.should == ::ModuleCluster::Define::Block::ClassOrInstance::Mock02
54
- end
55
- respond_to?( :extended ).should == true
56
- module ModuleProof
57
- include ::ModuleCluster::Define::Block::ClassOrInstance::Mock02
58
- end
59
- block_ran.should == false
60
- module ModuleProof2
61
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock02
62
- end
63
- block_ran.should == false
64
- class ClassProof
65
- include ::ModuleCluster::Define::Block::ClassOrInstance::Mock02
66
- end
67
- block_ran.should == true
68
- block_ran = false
69
- class ClassProof2
70
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock02
71
- end
72
- block_ran.should == false
73
- Object.new.instance_eval do
74
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock02
75
- end
76
- block_ran.should == true
77
- end
78
- end
79
-
80
- ################################################
81
- # class_include_or_extend_or_instance_extend #
82
- ################################################
83
-
84
- it 'can run a block on class include or extend or instance extend' do
85
- module ::ModuleCluster::Define::Block::ClassOrInstance::Mock03
86
- extend ::ModuleCluster::Define::Block::ClassOrInstance
87
- block_ran = false
88
- class_include_or_extend_or_instance_extend do
89
- block_ran = true
90
- self.should == ::ModuleCluster::Define::Block::ClassOrInstance::Mock03
91
- end
92
- respond_to?( :extended ).should == true
93
- module ModuleProof
94
- include ::ModuleCluster::Define::Block::ClassOrInstance::Mock03
95
- end
96
- block_ran.should == false
97
- module ModuleProof2
98
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock03
99
- end
100
- block_ran.should == false
101
- class ClassProof
102
- include ::ModuleCluster::Define::Block::ClassOrInstance::Mock03
103
- end
104
- block_ran.should == true
105
- block_ran = false
106
- class ClassProof2
107
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock03
108
- end
109
- block_ran.should == true
110
- block_ran = false
111
- Object.new.instance_eval do
112
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock03
113
- end
114
- block_ran.should == true
115
- end
116
- end
117
-
118
- ######################################
119
- # prepend_class_or_instance_extend #
120
- ######################################
121
-
122
- it 'can run a block before class or instance extend' do
123
- module ::ModuleCluster::Define::Block::ClassOrInstance::Mock04
124
- extend ::ModuleCluster::Define::Block::ClassOrInstance
125
- block_ran = false
126
- class_or_instance_extend do
127
- block_ran = true
128
- self.should == ::ModuleCluster::Define::Block::ClassOrInstance::Mock04
129
- end
130
- respond_to?( :extended ).should == true
131
- module ModuleProof
132
- include ::ModuleCluster::Define::Block::ClassOrInstance::Mock04
133
- end
134
- block_ran.should == false
135
- module ModuleProof2
136
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock04
137
- end
138
- block_ran.should == false
139
- class ClassProof
140
- include ::ModuleCluster::Define::Block::ClassOrInstance::Mock04
141
- end
142
- block_ran.should == false
143
- class ClassProof2
144
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock04
145
- end
146
- block_ran.should == true
147
- block_ran = false
148
- Object.new.instance_eval do
149
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock04
150
- end
151
- block_ran.should == true
152
- end
153
- end
154
-
155
- ##############################################
156
- # prepend_class_include_or_instance_extend #
157
- ##############################################
158
-
159
- it 'can run a block before class include or instance extend' do
160
- module ::ModuleCluster::Define::Block::ClassOrInstance::Mock05
161
- extend ::ModuleCluster::Define::Block::ClassOrInstance
162
- block_ran = false
163
- class_include_or_instance_extend do
164
- block_ran = true
165
- self.should == ::ModuleCluster::Define::Block::ClassOrInstance::Mock05
166
- end
167
- respond_to?( :extended ).should == true
168
- module ModuleProof
169
- include ::ModuleCluster::Define::Block::ClassOrInstance::Mock05
170
- end
171
- block_ran.should == false
172
- module ModuleProof2
173
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock05
174
- end
175
- block_ran.should == false
176
- class ClassProof
177
- include ::ModuleCluster::Define::Block::ClassOrInstance::Mock05
178
- end
179
- block_ran.should == true
180
- block_ran = false
181
- class ClassProof2
182
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock05
183
- end
184
- block_ran.should == false
185
- Object.new.instance_eval do
186
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock05
187
- end
188
- block_ran.should == true
189
- end
190
- end
191
-
192
- ########################################################
193
- # prepend_class_include_or_extend_or_instance_extend #
194
- ########################################################
195
-
196
- it 'can run a block before class include or extend or instance extend' do
197
- module ::ModuleCluster::Define::Block::ClassOrInstance::Mock06
198
- extend ::ModuleCluster::Define::Block::ClassOrInstance
199
- block_ran = false
200
- class_include_or_extend_or_instance_extend do
201
- block_ran = true
202
- self.should == ::ModuleCluster::Define::Block::ClassOrInstance::Mock06
203
- end
204
- respond_to?( :extended ).should == true
205
- module ModuleProof
206
- include ::ModuleCluster::Define::Block::ClassOrInstance::Mock06
207
- end
208
- block_ran.should == false
209
- module ModuleProof2
210
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock06
211
- end
212
- block_ran.should == false
213
- class ClassProof
214
- include ::ModuleCluster::Define::Block::ClassOrInstance::Mock06
215
- end
216
- block_ran.should == true
217
- block_ran = false
218
- class ClassProof2
219
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock06
220
- end
221
- block_ran.should == true
222
- block_ran = false
223
- Object.new.instance_eval do
224
- extend ::ModuleCluster::Define::Block::ClassOrInstance::Mock06
225
- end
226
- block_ran.should == true
227
- end
228
- end
229
-
230
- end
@@ -1,238 +0,0 @@
1
-
2
- require_relative '../../../../lib/module-cluster.rb'
3
-
4
- describe ::ModuleCluster::Define::Block::ClassOrModuleOrInstance 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::ClassOrModuleOrInstance::Mock01
12
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance
13
- block_ran = false
14
- class_or_module_or_instance_extend do
15
- block_ran = true
16
- self.should == ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
17
- end
18
- respond_to?( :extended ).should == true
19
- module ModuleProof
20
- include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
21
- end
22
- block_ran.should == false
23
- module ModuleProof2
24
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
25
- end
26
- block_ran.should == true
27
- block_ran = false
28
- class ClassProof
29
- include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
30
- end
31
- block_ran.should == false
32
- class ClassProof2
33
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
34
- end
35
- block_ran.should == true
36
- block_ran = false
37
- Object.new.instance_eval do
38
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock01
39
- end
40
- block_ran.should == true
41
- end
42
- end
43
-
44
- ################################################
45
- # class_or_module_include_or_instance_extend #
46
- ################################################
47
-
48
- it 'can run a block on class or module include or instance extend' do
49
- module ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
50
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance
51
- block_ran = false
52
- class_or_module_include_or_instance_extend do
53
- block_ran = true
54
- self.should == ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
55
- end
56
- respond_to?( :extended ).should == true
57
- module ModuleProof
58
- include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
59
- end
60
- block_ran.should == true
61
- block_ran = false
62
- module ModuleProof2
63
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
64
- end
65
- block_ran.should == false
66
- class ClassProof
67
- include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
68
- end
69
- block_ran.should == true
70
- block_ran = false
71
- class ClassProof2
72
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
73
- end
74
- block_ran.should == false
75
- Object.new.instance_eval do
76
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock02
77
- end
78
- block_ran.should == true
79
- end
80
- end
81
-
82
- ##########################################################
83
- # class_or_module_include_or_extend_or_instance_extend #
84
- ##########################################################
85
-
86
- it 'can run a block on class or module include or extend or instance extend' do
87
- module ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
88
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance
89
- block_ran = false
90
- class_or_module_include_or_extend_or_instance_extend do
91
- block_ran = true
92
- self.should == ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
93
- end
94
- respond_to?( :extended ).should == true
95
- module ModuleProof
96
- include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
97
- end
98
- block_ran.should == true
99
- block_ran = false
100
- module ModuleProof2
101
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
102
- end
103
- block_ran.should == true
104
- block_ran = false
105
- class ClassProof
106
- include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
107
- end
108
- block_ran.should == true
109
- block_ran = false
110
- class ClassProof2
111
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
112
- end
113
- block_ran.should == true
114
- block_ran = false
115
- Object.new.instance_eval do
116
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock03
117
- end
118
- block_ran.should == true
119
- end
120
- end
121
-
122
- ################################################
123
- # prepend_class_or_module_or_instance_extend #
124
- ################################################
125
-
126
- it 'can run a block before class or module extend' do
127
- module ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
128
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance
129
- block_ran = false
130
- prepend_class_or_module_or_instance_extend do
131
- block_ran = true
132
- self.should == ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
133
- end
134
- respond_to?( :extended ).should == true
135
- module ModuleProof
136
- include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
137
- end
138
- block_ran.should == false
139
- module ModuleProof2
140
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
141
- end
142
- block_ran.should == true
143
- block_ran = false
144
- class ClassProof
145
- include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
146
- end
147
- block_ran.should == false
148
- class ClassProof2
149
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
150
- end
151
- block_ran.should == true
152
- block_ran = false
153
- Object.new.instance_eval do
154
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock04
155
- end
156
- block_ran.should == true
157
- end
158
- end
159
-
160
- ########################################################
161
- # prepend_class_or_module_include_or_instance_extend #
162
- ########################################################
163
-
164
- it 'can run a block before class or module include or instance extend' do
165
- module ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
166
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance
167
- block_ran = false
168
- prepend_class_or_module_include_or_instance_extend do
169
- block_ran = true
170
- self.should == ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
171
- end
172
- respond_to?( :extended ).should == true
173
- module ModuleProof
174
- include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
175
- end
176
- block_ran.should == true
177
- block_ran = false
178
- module ModuleProof2
179
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
180
- end
181
- block_ran.should == false
182
- class ClassProof
183
- include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
184
- end
185
- block_ran.should == true
186
- block_ran = false
187
- class ClassProof2
188
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
189
- end
190
- block_ran.should == false
191
- Object.new.instance_eval do
192
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock05
193
- end
194
- block_ran.should == true
195
- end
196
- end
197
-
198
- ##################################################################
199
- # prepend_class_or_module_include_or_extend_or_instance_extend #
200
- ##################################################################
201
-
202
- it 'can run a block before class or module include or extend or instance extend' do
203
- module ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
204
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance
205
- block_ran = false
206
- prepend_class_or_module_include_or_extend_or_instance_extend do
207
- block_ran = true
208
- self.should == ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
209
- end
210
- respond_to?( :extended ).should == true
211
- module ModuleProof
212
- include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
213
- end
214
- block_ran.should == true
215
- block_ran = false
216
- module ModuleProof2
217
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
218
- end
219
- block_ran.should == true
220
- block_ran = false
221
- class ClassProof
222
- include ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
223
- end
224
- block_ran.should == true
225
- block_ran = false
226
- class ClassProof2
227
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
228
- end
229
- block_ran.should == true
230
- block_ran = false
231
- Object.new.instance_eval do
232
- extend ::ModuleCluster::Define::Block::ClassOrModuleOrInstance::Mock06
233
- end
234
- block_ran.should == true
235
- end
236
- end
237
-
238
- end