module-cluster 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,223 +0,0 @@
1
-
2
- require_relative '../../../../lib/module-cluster.rb'
3
-
4
- describe ModuleCluster::Define::ModuleClusterCascades do
5
-
6
- ##############################################
7
- # anonymous_module_cascade_append_features #
8
- ##############################################
9
-
10
- it 'it can construct an anonymous module each time requested to append features with modules' do
11
- class ModuleCluster::Define::ModuleClusterCascades::PrivateMock01
12
- extend ModuleCluster::Define::ModuleClusterCascades
13
- module Module1
14
- end
15
- module Module2
16
- end
17
- anonymous_module_cascade_append_features_instance = anonymous_module_cascade_append_features( :include, Module1, Module2 )
18
- anonymous_module_cascade_append_features_instance.is_a?( Module ).should == true
19
- anonymous_module_cascade_append_features_instance.instance_methods.include?( :append_features ).should == true
20
- module SomeModule
21
- end
22
- SomeModule.extend( anonymous_module_cascade_append_features_instance )
23
- SomeModule.respond_to?( :append_features ).should == true
24
- module SomeOtherModule
25
- include ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::SomeModule
26
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module1 ).should == true
27
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module2 ).should == true
28
- ( ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module2 ) ).should == true
29
- ( ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module2 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::SomeModule ) ).should == true
30
- end
31
- module Cascade1
32
- include ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::SomeOtherModule
33
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module1 ).should == true
34
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module2 ).should == true
35
- ( ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module2 ) ).should == true
36
- ( ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module2 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::SomeModule ) ).should == true
37
- ( ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::SomeModule ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::SomeOtherModule ) ).should == true
38
- end
39
- anonymous_module_cascade_append_features_instance2 = anonymous_module_cascade_append_features( :extend, Module1, Module2 )
40
- anonymous_module_cascade_append_features_instance2.should_not == anonymous_module_cascade_append_features_instance
41
- module AnotherModule
42
- end
43
- AnotherModule.extend( anonymous_module_cascade_append_features_instance2 )
44
- AnotherModule.respond_to?( :append_features ).should == true
45
- module YetAnotherModule
46
- include ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::AnotherModule
47
- eigenclass = class << self ; self ; end
48
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module1 ).should == true
49
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module2 ).should == true
50
- ( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module2 ) ).should == true
51
- end
52
- module Cascade2
53
- include ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::YetAnotherModule
54
- eigenclass = class << self ; self ; end
55
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module1 ).should == true
56
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module2 ).should == true
57
- ( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock01::Module2 ) ).should == true
58
- end
59
- end
60
- end
61
-
62
- #######################################
63
- # anonymous_module_cascade_included #
64
- #######################################
65
-
66
- it 'it can construct an anonymous module each time requested to include with modules' do
67
- class ModuleCluster::Define::ModuleClusterCascades::PrivateMock02
68
- extend ModuleCluster::Define::ModuleClusterCascades
69
- module Module1
70
- end
71
- module Module2
72
- end
73
- anonymous_module_cascade_included_instance = anonymous_module_cascade_included( :include, Module1, Module2 )
74
- anonymous_module_cascade_included_instance.is_a?( Module ).should == true
75
- anonymous_module_cascade_included_instance.instance_methods.include?( :included ).should == true
76
- module SomeModule
77
- end
78
- SomeModule.extend( anonymous_module_cascade_included_instance )
79
- SomeModule.respond_to?( :included ).should == true
80
- module SomeOtherModule
81
- include ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::SomeModule
82
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module1 ).should == true
83
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module2 ).should == true
84
- ( ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module2 ) ).should == true
85
- ( ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module2 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::SomeModule ) ).should == false
86
- end
87
- module Cascade1
88
- include ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::SomeOtherModule
89
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module1 ).should == true
90
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module2 ).should == true
91
- ( ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module2 ) ).should == true
92
- ( ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module2 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::SomeModule ) ).should == false
93
- end
94
- anonymous_module_cascade_included_instance2 = anonymous_module_cascade_included( :extend, Module1, Module2 )
95
- anonymous_module_cascade_included_instance2.should_not == anonymous_module_cascade_included_instance
96
- module AnotherModule
97
- end
98
- AnotherModule.extend( anonymous_module_cascade_included_instance2 )
99
- AnotherModule.respond_to?( :included ).should == true
100
- module YetAnotherModule
101
- include ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::AnotherModule
102
- eigenclass = class << self ; self ; end
103
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module1 ).should == true
104
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module2 ).should == true
105
- ( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module2 ) ).should == true
106
- end
107
- module Cascade2
108
- include ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::YetAnotherModule
109
- eigenclass = class << self ; self ; end
110
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module1 ).should == true
111
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module2 ).should == true
112
- ( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock02::Module2 ) ).should == true
113
- end
114
- end
115
- end
116
-
117
- ############################################
118
- # anonymous_module_cascade_extend_object #
119
- ############################################
120
-
121
- it 'it can construct an anonymous module each time requested to extend object with modules' do
122
- class ModuleCluster::Define::ModuleClusterCascades::PrivateMock03
123
- extend ModuleCluster::Define::ModuleClusterCascades
124
- module Module1
125
- end
126
- module Module2
127
- end
128
- anonymous_module_cascade_extend_object_instance = anonymous_module_cascade_extend_object( :include, Module1, Module2 )
129
- anonymous_module_cascade_extend_object_instance.is_a?( Module ).should == true
130
- anonymous_module_cascade_extend_object_instance.instance_methods.include?( :extend_object ).should == true
131
- module SomeModule
132
- end
133
- SomeModule.extend( anonymous_module_cascade_extend_object_instance )
134
- SomeModule.respond_to?( :extend_object ).should == true
135
- module SomeOtherModule
136
- extend ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::SomeModule
137
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module1 ).should == true
138
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module2 ).should == true
139
- ( ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module2 ) ).should == true
140
- end
141
- module Cascade1
142
- extend ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::SomeOtherModule
143
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module1 ).should == true
144
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module2 ).should == true
145
- ( ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module2 ) ).should == true
146
- end
147
- anonymous_module_cascade_extend_object_instance2 = anonymous_module_cascade_extend_object( :extend, Module1, Module2 )
148
- anonymous_module_cascade_extend_object_instance2.should_not == anonymous_module_cascade_extend_object_instance
149
- module AnotherModule
150
- end
151
- AnotherModule.extend( anonymous_module_cascade_extend_object_instance2 )
152
- AnotherModule.respond_to?( :extend_object ).should == true
153
- module YetAnotherModule
154
- extend ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::AnotherModule
155
- eigenclass = class << self ; self ; end
156
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module1 ).should == true
157
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module2 ).should == true
158
- ( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module2 ) ).should == true
159
- end
160
- module Cascade2
161
- extend ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::YetAnotherModule
162
- eigenclass = class << self ; self ; end
163
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module1 ).should == true
164
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module2 ).should == true
165
- ( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock03::Module2 ) ).should == true
166
- end
167
- end
168
- end
169
-
170
- #######################################
171
- # anonymous_module_cascade_extended #
172
- #######################################
173
-
174
- it 'it can construct an anonymous module each time requested to extend with modules' do
175
- class ModuleCluster::Define::ModuleClusterCascades::PrivateMock04
176
- extend ModuleCluster::Define::ModuleClusterCascades
177
- module Module1
178
- end
179
- module Module2
180
- end
181
- anonymous_module_cascade_extended_instance = anonymous_module_cascade_extended( :include, Module1, Module2 )
182
- anonymous_module_cascade_extended_instance.is_a?( Module ).should == true
183
- anonymous_module_cascade_extended_instance.instance_methods.include?( :extended ).should == true
184
- module SomeModule
185
- end
186
- SomeModule.extend( anonymous_module_cascade_extended_instance )
187
- SomeModule.respond_to?( :extended ).should == true
188
- module SomeOtherModule
189
- extend ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::SomeModule
190
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module1 ).should == true
191
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module2 ).should == true
192
- ( ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module2 ) ).should == true
193
- end
194
- module Cascade1
195
- extend ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::SomeOtherModule
196
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module1 ).should == true
197
- ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module2 ).should == true
198
- ( ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module2 ) ).should == true
199
- end
200
- anonymous_module_cascade_extended_instance2 = anonymous_module_cascade_extended( :extend, Module1, Module2 )
201
- anonymous_module_cascade_extended_instance2.should_not == anonymous_module_cascade_extended_instance
202
- module AnotherModule
203
- end
204
- AnotherModule.extend( anonymous_module_cascade_extended_instance2 )
205
- AnotherModule.respond_to?( :extended ).should == true
206
- module YetAnotherModule
207
- extend ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::AnotherModule
208
- eigenclass = class << self ; self ; end
209
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module1 ).should == true
210
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module2 ).should == true
211
- ( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module2 ) ).should == true
212
- end
213
- module Cascade2
214
- extend ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::YetAnotherModule
215
- eigenclass = class << self ; self ; end
216
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module1 ).should == true
217
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module2 ).should == true
218
- ( eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleClusterCascades::PrivateMock04::Module2 ) ).should == true
219
- end
220
- end
221
- end
222
-
223
- end
@@ -1,168 +0,0 @@
1
-
2
- require_relative '../../../../lib/module-cluster.rb'
3
-
4
- describe ModuleCluster::Define::ModuleCluster do
5
-
6
- ######################################
7
- # anonymous_module_append_features #
8
- ######################################
9
-
10
- it 'it can construct an anonymous module each time requested to append features with modules' do
11
- class ModuleCluster::Define::ModuleCluster::PrivateMock01
12
- extend ModuleCluster::Define::ModuleCluster
13
- module Module1
14
- end
15
- module Module2
16
- end
17
- anonymous_module_append_features_instance = anonymous_module_append_features( :include, Module1, Module2 )
18
- anonymous_module_append_features_instance.is_a?( Module ).should == true
19
- anonymous_module_append_features_instance.instance_methods.include?( :append_features ).should == true
20
- module SomeModule
21
- end
22
- SomeModule.extend( anonymous_module_append_features_instance )
23
- SomeModule.respond_to?( :append_features ).should == true
24
- module SomeOtherModule
25
- include ModuleCluster::Define::ModuleCluster::PrivateMock01::SomeModule
26
- ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock01::Module1 ).should == true
27
- ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock01::Module2 ).should == true
28
- ( ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock01::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock01::Module2 ) ).should == true
29
- ( ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock01::Module2 ) > ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock01::SomeModule ) ).should == true
30
- end
31
- anonymous_module_append_features_instance2 = anonymous_module_append_features( :extend, Module1, Module2 )
32
- anonymous_module_append_features_instance2.should_not == anonymous_module_append_features_instance
33
- module AnotherModule
34
- end
35
- AnotherModule.extend( anonymous_module_append_features_instance2 )
36
- AnotherModule.respond_to?( :append_features ).should == true
37
- module YetAnotherModule
38
- include ModuleCluster::Define::ModuleCluster::PrivateMock01::AnotherModule
39
- eigenclass = class << self ; self ; end
40
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock01::Module1 ).should == true
41
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock01::Module2 ).should == true
42
- ( eigenclass.ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock01::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock01::Module2 ) ).should == true
43
- end
44
- end
45
- end
46
-
47
- ###############################
48
- # anonymous_module_included #
49
- ###############################
50
-
51
- it 'it can construct an anonymous module each time requested to include with modules' do
52
- class ModuleCluster::Define::ModuleCluster::PrivateMock02
53
- extend ModuleCluster::Define::ModuleCluster
54
- module Module1
55
- end
56
- module Module2
57
- end
58
- anonymous_module_included_instance = anonymous_module_included( :include, Module1, Module2 )
59
- anonymous_module_included_instance.is_a?( Module ).should == true
60
- anonymous_module_included_instance.instance_methods.include?( :included ).should == true
61
- module SomeModule
62
- end
63
- SomeModule.extend( anonymous_module_included_instance )
64
- SomeModule.respond_to?( :included ).should == true
65
- module SomeOtherModule
66
- include ModuleCluster::Define::ModuleCluster::PrivateMock02::SomeModule
67
- ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock02::Module1 ).should == true
68
- ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock02::Module2 ).should == true
69
- ( ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock02::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock02::Module2 ) ).should == true
70
- ( ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock02::Module2 ) > ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock02::SomeModule ) ).should == false
71
- end
72
- anonymous_module_included_instance2 = anonymous_module_included( :extend, Module1, Module2 )
73
- anonymous_module_included_instance2.should_not == anonymous_module_included_instance
74
- module AnotherModule
75
- end
76
- AnotherModule.extend( anonymous_module_included_instance2 )
77
- AnotherModule.respond_to?( :included ).should == true
78
- module YetAnotherModule
79
- include ModuleCluster::Define::ModuleCluster::PrivateMock02::AnotherModule
80
- eigenclass = class << self ; self ; end
81
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock02::Module1 ).should == true
82
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock02::Module2 ).should == true
83
- ( eigenclass.ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock02::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock02::Module2 ) ).should == true
84
- end
85
- end
86
- end
87
-
88
- ####################################
89
- # anonymous_module_extend_object #
90
- ####################################
91
-
92
- it 'it can construct an anonymous module each time requested to extend object with modules' do
93
- class ModuleCluster::Define::ModuleCluster::PrivateMock03
94
- extend ModuleCluster::Define::ModuleCluster
95
- module Module1
96
- end
97
- module Module2
98
- end
99
- anonymous_module_extend_object_instance = anonymous_module_extend_object( :include, Module1, Module2 )
100
- anonymous_module_extend_object_instance.is_a?( Module ).should == true
101
- anonymous_module_extend_object_instance.instance_methods.include?( :extend_object ).should == true
102
- module SomeModule
103
- end
104
- SomeModule.extend( anonymous_module_extend_object_instance )
105
- SomeModule.respond_to?( :extend_object ).should == true
106
- module SomeOtherModule
107
- extend ModuleCluster::Define::ModuleCluster::PrivateMock03::SomeModule
108
- ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock03::Module1 ).should == true
109
- ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock03::Module2 ).should == true
110
- ( ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock03::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock03::Module2 ) ).should == true
111
- end
112
- anonymous_module_extend_object_instance2 = anonymous_module_extend_object( :extend, Module1, Module2 )
113
- anonymous_module_extend_object_instance2.should_not == anonymous_module_extend_object_instance
114
- module AnotherModule
115
- end
116
- AnotherModule.extend( anonymous_module_extend_object_instance2 )
117
- AnotherModule.respond_to?( :extend_object ).should == true
118
- module YetAnotherModule
119
- extend ModuleCluster::Define::ModuleCluster::PrivateMock03::AnotherModule
120
- eigenclass = class << self ; self ; end
121
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock03::Module1 ).should == true
122
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock03::Module2 ).should == true
123
- ( eigenclass.ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock03::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock03::Module2 ) ).should == true
124
- end
125
- end
126
- end
127
-
128
- ###############################
129
- # anonymous_module_extended #
130
- ###############################
131
-
132
- it 'it can construct an anonymous module each time requested to extend with modules' do
133
- class ModuleCluster::Define::ModuleCluster::PrivateMock04
134
- extend ModuleCluster::Define::ModuleCluster
135
- module Module1
136
- end
137
- module Module2
138
- end
139
- anonymous_module_extended_instance = anonymous_module_extended( :include, Module1, Module2 )
140
- anonymous_module_extended_instance.is_a?( Module ).should == true
141
- anonymous_module_extended_instance.instance_methods.include?( :extended ).should == true
142
- module SomeModule
143
- end
144
- SomeModule.extend( anonymous_module_extended_instance )
145
- SomeModule.respond_to?( :extended ).should == true
146
- module SomeOtherModule
147
- extend ModuleCluster::Define::ModuleCluster::PrivateMock04::SomeModule
148
- ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock04::Module1 ).should == true
149
- ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock04::Module2 ).should == true
150
- ( ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock04::Module1 ) > ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock04::Module2 ) ).should == true
151
- end
152
- anonymous_module_extended_instance2 = anonymous_module_extended( :extend, Module1, Module2 )
153
- anonymous_module_extended_instance2.should_not == anonymous_module_extended_instance
154
- module AnotherModule
155
- end
156
- AnotherModule.extend( anonymous_module_extended_instance2 )
157
- AnotherModule.respond_to?( :extended ).should == true
158
- module YetAnotherModule
159
- extend ModuleCluster::Define::ModuleCluster::PrivateMock04::AnotherModule
160
- eigenclass = class << self ; self ; end
161
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock04::Module1 ).should == true
162
- eigenclass.ancestors.include?( ModuleCluster::Define::ModuleCluster::PrivateMock04::Module2 ).should == true
163
- ( eigenclass.ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock04::Module1 ) > eigenclass.ancestors.index( ModuleCluster::Define::ModuleCluster::PrivateMock04::Module2 ) ).should == true
164
- end
165
- end
166
- end
167
-
168
- end