module-cluster 1.3.7 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +146 -1
- data/README.rdoc +146 -1
- data/lib/module-cluster.rb +54 -12
- data/lib/module-cluster/ModuleCluster/Define/Block.rb +3 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/Class.rb +16 -4
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrInstance.rb +63 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb +2 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrInstance.rb +63 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/Instance.rb +32 -0
- data/lib/module-cluster/ModuleCluster/Define/Block/Module.rb +16 -4
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrInstance.rb +63 -0
- data/lib/module-cluster/ModuleCluster/Define/ClassCluster.rb +200 -0
- data/lib/module-cluster/ModuleCluster/Define/ClassOrInstanceCluster.rb +127 -0
- data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +7 -19
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +5 -20
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +9 -26
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +9 -26
- data/lib/module-cluster/ModuleCluster/Define/InstanceCluster.rb +46 -0
- data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +200 -0
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrClassCluster.rb +208 -0
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrInstanceCluster.rb +127 -0
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures.rb +54 -0
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/ClusterStack.rb +44 -0
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/PerformCascades.rb +209 -0
- data/lib/module-cluster/{ModuleCluster → _private_/ModuleCluster}/ClusterStack.rb +0 -2
- data/lib/module-cluster/{ModuleCluster → _private_/ModuleCluster}/ClusterStack/Block.rb +1 -2
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Class.rb +36 -0
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Instance.rb +20 -0
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Module.rb +36 -0
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Set.rb +2 -0
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Extends.rb +108 -0
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Includes.rb +84 -0
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsExtends.rb +108 -0
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsIncludes.rb +84 -0
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set.rb +7 -0
- data/lib/module-cluster/{ModuleCluster → _private_/ModuleCluster}/ExtendForCascade.rb +0 -0
- data/spec/ModuleCluster/Define/Block/ClassOrInstance_spec.rb +230 -0
- data/spec/ModuleCluster/Define/Block/ClassOrModuleOrInstance_spec.rb +238 -0
- data/spec/ModuleCluster/Define/Block/ClassOrModule_spec.rb +231 -0
- data/spec/ModuleCluster/Define/Block/Class_spec.rb +224 -0
- data/spec/ModuleCluster/Define/Block/Instance_spec.rb +78 -0
- data/spec/ModuleCluster/Define/Block/ModuleOrInstance_spec.rb +54 -0
- data/spec/ModuleCluster/Define/Block/Module_spec.rb +224 -0
- data/spec/ModuleCluster/Define/Block_spec.rb +18 -0
- data/spec/ModuleCluster/Define/ClassCluster_spec.rb +728 -0
- data/spec/ModuleCluster/Define/ClassOrInstanceCluster_spec.rb +576 -0
- data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +298 -60
- data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +307 -61
- data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +335 -36
- data/spec/ModuleCluster/Define/Cluster_spec.rb +447 -14
- data/spec/ModuleCluster/Define/InstanceCluster_spec.rb +102 -0
- data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +728 -0
- data/spec/ModuleCluster/Define/ModuleOrClassCluster_spec.rb +728 -0
- data/spec/ModuleCluster/Define/ModuleOrInstanceCluster_spec.rb +576 -0
- data/spec/_private_/ModuleCluster/CascadeFeatures/PerformCascades_spec.rb +278 -0
- metadata +42 -13
- data/lib/module-cluster/ModuleCluster/CascadeFeatures.rb +0 -197
- data/lib/module-cluster/ModuleCluster/ClusterStack/Block/Class.rb +0 -36
- data/lib/module-cluster/ModuleCluster/ClusterStack/Block/Module.rb +0 -36
- data/lib/module-cluster/ModuleCluster/ClusterStack/Extends.rb +0 -29
- data/lib/module-cluster/ModuleCluster/ClusterStack/Includes.rb +0 -28
- data/lib/module-cluster/ModuleCluster/ClusterStack/PrependsExtends.rb +0 -28
- data/lib/module-cluster/ModuleCluster/ClusterStack/PrependsIncludes.rb +0 -28
- data/lib/module-cluster/ModuleCluster/Define/ClusterStack.rb +0 -26
@@ -0,0 +1,224 @@
|
|
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
|
@@ -0,0 +1,78 @@
|
|
1
|
+
|
2
|
+
require_relative '../../../../lib/module-cluster.rb'
|
3
|
+
|
4
|
+
describe ModuleCluster::Define::Block::Instance do
|
5
|
+
|
6
|
+
#####################
|
7
|
+
# instance_extend #
|
8
|
+
#####################
|
9
|
+
|
10
|
+
it 'can run a block on instance extend' do
|
11
|
+
module ModuleCluster::Define::Block::Instance::Mock01
|
12
|
+
extend ModuleCluster::Define::Block::Instance
|
13
|
+
block_ran = false
|
14
|
+
instance_extend do
|
15
|
+
block_ran = true
|
16
|
+
self.should == ModuleCluster::Define::Block::Instance::Mock01
|
17
|
+
end
|
18
|
+
respond_to?( :extended ).should == true
|
19
|
+
module ModuleProof
|
20
|
+
include ModuleCluster::Define::Block::Instance::Mock01
|
21
|
+
end
|
22
|
+
block_ran.should == false
|
23
|
+
module ModuleProof2
|
24
|
+
extend ModuleCluster::Define::Block::Instance::Mock01
|
25
|
+
end
|
26
|
+
block_ran.should == false
|
27
|
+
class ClassProof
|
28
|
+
include ModuleCluster::Define::Block::Instance::Mock01
|
29
|
+
end
|
30
|
+
block_ran.should == false
|
31
|
+
class ClassProof2
|
32
|
+
extend ModuleCluster::Define::Block::Instance::Mock01
|
33
|
+
end
|
34
|
+
block_ran.should == false
|
35
|
+
Object.new.instance_eval do
|
36
|
+
extend ModuleCluster::Define::Block::Instance::Mock01
|
37
|
+
end
|
38
|
+
block_ran.should == true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
#############################
|
43
|
+
# prepend_instance_extend #
|
44
|
+
#############################
|
45
|
+
|
46
|
+
it 'can run a block before instance extend' do
|
47
|
+
module ModuleCluster::Define::Block::Instance::Mock02
|
48
|
+
extend ModuleCluster::Define::Block::Instance
|
49
|
+
block_ran = false
|
50
|
+
prepend_instance_extend do
|
51
|
+
block_ran = true
|
52
|
+
self.should == ModuleCluster::Define::Block::Instance::Mock02
|
53
|
+
end
|
54
|
+
respond_to?( :extended ).should == true
|
55
|
+
module ModuleProof
|
56
|
+
include ModuleCluster::Define::Block::Instance::Mock02
|
57
|
+
end
|
58
|
+
block_ran.should == false
|
59
|
+
module ModuleProof2
|
60
|
+
extend ModuleCluster::Define::Block::Instance::Mock02
|
61
|
+
end
|
62
|
+
block_ran.should == false
|
63
|
+
class ClassProof
|
64
|
+
include ModuleCluster::Define::Block::Instance::Mock02
|
65
|
+
end
|
66
|
+
block_ran.should == false
|
67
|
+
class ClassProof2
|
68
|
+
extend ModuleCluster::Define::Block::Instance::Mock02
|
69
|
+
end
|
70
|
+
block_ran.should == false
|
71
|
+
Object.new.instance_eval do
|
72
|
+
extend ModuleCluster::Define::Block::Instance::Mock02
|
73
|
+
end
|
74
|
+
block_ran.should == true
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
require_relative '../../../../lib/module-cluster.rb'
|
3
|
+
|
4
|
+
describe ModuleCluster::Define::Block::ModuleOrInstance do
|
5
|
+
|
6
|
+
###############################
|
7
|
+
# module_or_instance_extend #
|
8
|
+
###############################
|
9
|
+
|
10
|
+
it '' do
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
#######################################
|
15
|
+
# module_include_or_instance_extend #
|
16
|
+
#######################################
|
17
|
+
|
18
|
+
it '' do
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
#################################################
|
23
|
+
# module_include_or_extend_or_instance_extend #
|
24
|
+
#################################################
|
25
|
+
|
26
|
+
it '' do
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
#######################################
|
31
|
+
# prepend_module_or_instance_extend #
|
32
|
+
#######################################
|
33
|
+
|
34
|
+
it '' do
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
###############################################
|
39
|
+
# prepend_module_include_or_instance_extend #
|
40
|
+
###############################################
|
41
|
+
|
42
|
+
it '' do
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
#########################################################
|
47
|
+
# prepend_module_include_or_extend_or_instance_extend #
|
48
|
+
#########################################################
|
49
|
+
|
50
|
+
it '' do
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,224 @@
|
|
1
|
+
|
2
|
+
require_relative '../../../../lib/module-cluster.rb'
|
3
|
+
|
4
|
+
describe ModuleCluster::Define::Block::Module do
|
5
|
+
|
6
|
+
####################
|
7
|
+
# module_include #
|
8
|
+
####################
|
9
|
+
|
10
|
+
it 'can run a block on module include' do
|
11
|
+
module ModuleCluster::Define::Block::Module::Mock01
|
12
|
+
extend ModuleCluster::Define::Block::Module
|
13
|
+
block_ran = false
|
14
|
+
module_include do
|
15
|
+
block_ran = true
|
16
|
+
self.should == ModuleCluster::Define::Block::Module::Mock01
|
17
|
+
end
|
18
|
+
respond_to?( :included ).should == true
|
19
|
+
class ClassProof
|
20
|
+
extend ModuleCluster::Define::Block::Module::Mock01
|
21
|
+
end
|
22
|
+
block_ran.should == false
|
23
|
+
class ClassProof2
|
24
|
+
include ModuleCluster::Define::Block::Module::Mock01
|
25
|
+
end
|
26
|
+
block_ran.should == false
|
27
|
+
Object.new.instance_eval do
|
28
|
+
extend ModuleCluster::Define::Block::Module::Mock01
|
29
|
+
end
|
30
|
+
block_ran.should == false
|
31
|
+
module ModuleProof
|
32
|
+
extend ModuleCluster::Define::Block::Module::Mock01
|
33
|
+
end
|
34
|
+
block_ran.should == false
|
35
|
+
module ModuleProof2
|
36
|
+
include ModuleCluster::Define::Block::Module::Mock01
|
37
|
+
end
|
38
|
+
block_ran.should == true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
###################
|
43
|
+
# module_extend #
|
44
|
+
###################
|
45
|
+
|
46
|
+
it 'can run a block on module extend' do
|
47
|
+
module ModuleCluster::Define::Block::Module::Mock02
|
48
|
+
extend ModuleCluster::Define::Block::Module
|
49
|
+
block_ran = false
|
50
|
+
module_extend do
|
51
|
+
block_ran = true
|
52
|
+
self.should == ModuleCluster::Define::Block::Module::Mock02
|
53
|
+
end
|
54
|
+
respond_to?( :extended ).should == true
|
55
|
+
class ClassProof
|
56
|
+
include ModuleCluster::Define::Block::Module::Mock02
|
57
|
+
end
|
58
|
+
block_ran.should == false
|
59
|
+
class ClassProof2
|
60
|
+
extend ModuleCluster::Define::Block::Module::Mock02
|
61
|
+
end
|
62
|
+
block_ran.should == false
|
63
|
+
Object.new.instance_eval do
|
64
|
+
extend ModuleCluster::Define::Block::Module::Mock02
|
65
|
+
end
|
66
|
+
block_ran.should == false
|
67
|
+
module ModuleProof
|
68
|
+
include ModuleCluster::Define::Block::Module::Mock02
|
69
|
+
end
|
70
|
+
block_ran.should == false
|
71
|
+
module ModuleProof2
|
72
|
+
extend ModuleCluster::Define::Block::Module::Mock02
|
73
|
+
end
|
74
|
+
block_ran.should == true
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
##############################
|
79
|
+
# module_include_or_extend #
|
80
|
+
##############################
|
81
|
+
|
82
|
+
it 'can run a block on module include or extend' do
|
83
|
+
module ModuleCluster::Define::Block::Module::Mock03
|
84
|
+
extend ModuleCluster::Define::Block::Module
|
85
|
+
block_ran = false
|
86
|
+
module_include_or_extend do
|
87
|
+
block_ran = true
|
88
|
+
self.should == ModuleCluster::Define::Block::Module::Mock03
|
89
|
+
end
|
90
|
+
respond_to?( :extended ).should == true
|
91
|
+
class ClassProof
|
92
|
+
include ModuleCluster::Define::Block::Module::Mock03
|
93
|
+
end
|
94
|
+
block_ran.should == false
|
95
|
+
class ClassProof2
|
96
|
+
extend ModuleCluster::Define::Block::Module::Mock03
|
97
|
+
end
|
98
|
+
block_ran.should == false
|
99
|
+
Object.new.instance_eval do
|
100
|
+
extend ModuleCluster::Define::Block::Module::Mock03
|
101
|
+
end
|
102
|
+
block_ran.should == false
|
103
|
+
module ModuleProof
|
104
|
+
include ModuleCluster::Define::Block::Module::Mock03
|
105
|
+
end
|
106
|
+
block_ran.should == true
|
107
|
+
block_ran = false
|
108
|
+
module ModuleProof2
|
109
|
+
extend ModuleCluster::Define::Block::Module::Mock03
|
110
|
+
end
|
111
|
+
block_ran.should == true
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
############################
|
116
|
+
# prepend_module_include #
|
117
|
+
############################
|
118
|
+
|
119
|
+
it 'can run a block before module include' do
|
120
|
+
module ModuleCluster::Define::Block::Module::Mock04
|
121
|
+
extend ModuleCluster::Define::Block::Module
|
122
|
+
block_ran = false
|
123
|
+
prepend_module_include do
|
124
|
+
block_ran = true
|
125
|
+
self.should == ModuleCluster::Define::Block::Module::Mock04
|
126
|
+
end
|
127
|
+
respond_to?( :included ).should == true
|
128
|
+
class ClassProof
|
129
|
+
extend ModuleCluster::Define::Block::Module::Mock04
|
130
|
+
end
|
131
|
+
block_ran.should == false
|
132
|
+
class ClassProof2
|
133
|
+
include ModuleCluster::Define::Block::Module::Mock04
|
134
|
+
end
|
135
|
+
block_ran.should == false
|
136
|
+
Object.new.instance_eval do
|
137
|
+
extend ModuleCluster::Define::Block::Module::Mock04
|
138
|
+
end
|
139
|
+
block_ran.should == false
|
140
|
+
module ModuleProof
|
141
|
+
extend ModuleCluster::Define::Block::Module::Mock04
|
142
|
+
end
|
143
|
+
block_ran.should == false
|
144
|
+
module ModuleProof2
|
145
|
+
include ModuleCluster::Define::Block::Module::Mock04
|
146
|
+
end
|
147
|
+
block_ran.should == true
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
###########################
|
152
|
+
# prepend_module_extend #
|
153
|
+
###########################
|
154
|
+
|
155
|
+
it 'can run a block before module extend' do
|
156
|
+
module ModuleCluster::Define::Block::Module::Mock05
|
157
|
+
extend ModuleCluster::Define::Block::Module
|
158
|
+
block_ran = false
|
159
|
+
prepend_module_extend do
|
160
|
+
block_ran = true
|
161
|
+
self.should == ModuleCluster::Define::Block::Module::Mock05
|
162
|
+
end
|
163
|
+
respond_to?( :extended ).should == true
|
164
|
+
class ClassProof
|
165
|
+
include ModuleCluster::Define::Block::Module::Mock05
|
166
|
+
end
|
167
|
+
block_ran.should == false
|
168
|
+
class ClassProof2
|
169
|
+
extend ModuleCluster::Define::Block::Module::Mock05
|
170
|
+
end
|
171
|
+
block_ran.should == false
|
172
|
+
Object.new.instance_eval do
|
173
|
+
extend ModuleCluster::Define::Block::Module::Mock05
|
174
|
+
end
|
175
|
+
block_ran.should == false
|
176
|
+
module ModuleProof
|
177
|
+
include ModuleCluster::Define::Block::Module::Mock05
|
178
|
+
end
|
179
|
+
block_ran.should == false
|
180
|
+
module ModuleProof2
|
181
|
+
extend ModuleCluster::Define::Block::Module::Mock05
|
182
|
+
end
|
183
|
+
block_ran.should == true
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
######################################
|
188
|
+
# prepend_module_include_or_extend #
|
189
|
+
######################################
|
190
|
+
|
191
|
+
it 'can run a block before module include or extend' do
|
192
|
+
module ModuleCluster::Define::Block::Module::Mock06
|
193
|
+
extend ModuleCluster::Define::Block::Module
|
194
|
+
block_ran = false
|
195
|
+
prepend_module_include_or_extend do
|
196
|
+
block_ran = true
|
197
|
+
self.should == ModuleCluster::Define::Block::Module::Mock06
|
198
|
+
end
|
199
|
+
respond_to?( :extended ).should == true
|
200
|
+
class ClassProof
|
201
|
+
include ModuleCluster::Define::Block::Module::Mock06
|
202
|
+
end
|
203
|
+
block_ran.should == false
|
204
|
+
class ClassProof2
|
205
|
+
extend ModuleCluster::Define::Block::Module::Mock06
|
206
|
+
end
|
207
|
+
block_ran.should == false
|
208
|
+
Object.new.instance_eval do
|
209
|
+
extend ModuleCluster::Define::Block::Module::Mock06
|
210
|
+
end
|
211
|
+
block_ran.should == false
|
212
|
+
module ModuleProof
|
213
|
+
include ModuleCluster::Define::Block::Module::Mock06
|
214
|
+
end
|
215
|
+
block_ran.should == true
|
216
|
+
block_ran = false
|
217
|
+
module ModuleProof2
|
218
|
+
extend ModuleCluster::Define::Block::Module::Mock06
|
219
|
+
end
|
220
|
+
block_ran.should == true
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
end
|