cascading-configuration-array 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,28 +0,0 @@
1
-
2
- require_relative '../../../lib/cascading-configuration-array.rb'
3
-
4
- describe CascadingConfiguration::Array::Accessors do
5
-
6
- ###################################
7
- # define_cascading_array_setter #
8
- # define_cascading_array_getter #
9
- ###################################
10
-
11
- it 'can define a method to get and modify the configuration array' do
12
- class CascadingConfiguration::Array::Mock
13
- include CascadingConfiguration::Variable
14
- extend CascadingConfiguration::Array::Accessors
15
- include CascadingConfiguration::Array::ObjectInstance
16
- extend CascadingConfiguration::Array::ClassInstance
17
- end
18
- # setter
19
- CascadingConfiguration::Array::Mock.define_cascading_array_setter( :some_configuration )
20
- CascadingConfiguration::Array::Mock.methods.include?( :some_configuration= ).should == true
21
- CascadingConfiguration::Array::Mock.instance_methods.include?( :some_configuration= ).should == true
22
- # getter
23
- CascadingConfiguration::Array::Mock.define_cascading_array_getter( :some_configuration )
24
- CascadingConfiguration::Array::Mock.methods.include?( :some_configuration ).should == true
25
- CascadingConfiguration::Array::Mock.instance_methods.include?( :some_configuration ).should == true
26
- end
27
-
28
- end
@@ -1,90 +0,0 @@
1
-
2
- require_relative '../../lib/cascading-configuration-array.rb'
3
-
4
- describe CascadingConfiguration::Array do
5
-
6
- ##############################
7
- # attr_configuration_array #
8
- ##############################
9
-
10
- it 'can define a configuration array, which is the primary interface' do
11
-
12
- module CascadingConfiguration::Array::MockModule
13
- include CascadingConfiguration::Array
14
- attr_configuration_array :configuration_setting
15
- configuration_setting.should == []
16
- configuration_setting.push( :a_configuration )
17
- configuration_setting.should == [ :a_configuration ]
18
- end
19
-
20
- module CascadingConfiguration::Array::MockModule2
21
- include CascadingConfiguration::Array::MockModule
22
- configuration_setting.should == [ :a_configuration ]
23
- configuration_setting.push( :another_configuration )
24
- configuration_setting.should == [ :a_configuration, :another_configuration ]
25
- end
26
-
27
- module CascadingConfiguration::Array::MockModule3
28
- include CascadingConfiguration::Array::MockModule2
29
- configuration_setting.should == [ :a_configuration, :another_configuration ]
30
- end
31
-
32
- class CascadingConfiguration::Array::MockClass
33
- include CascadingConfiguration::Array::MockModule3
34
- configuration_setting.should == [ :a_configuration, :another_configuration ]
35
- configuration_setting.delete( :another_configuration )
36
- configuration_setting.should == [ :a_configuration ]
37
- end
38
-
39
- object_instance_one = CascadingConfiguration::Array::MockClass.new
40
- object_instance_one.configuration_setting.should == [ :a_configuration ]
41
- object_instance_one.configuration_setting.push( :some_other_configuration )
42
- object_instance_one.configuration_setting.should == [ :a_configuration, :some_other_configuration ]
43
-
44
- class CascadingConfiguration::Array::MockClassSub1 < CascadingConfiguration::Array::MockClass
45
- configuration_setting.should == [ :a_configuration ]
46
- configuration_setting.push( :another_configuration)
47
- configuration_setting.should == [ :a_configuration, :another_configuration ]
48
- end
49
-
50
- object_instance_two = CascadingConfiguration::Array::MockClassSub1.new
51
- object_instance_two.configuration_setting.should == [ :a_configuration, :another_configuration ]
52
- object_instance_two.configuration_setting.push( :some_other_configuration )
53
- object_instance_two.configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
54
-
55
- # change ancestor setting
56
- CascadingConfiguration::Array::MockClass.configuration_setting.push( :a_yet_unused_configuration )
57
- CascadingConfiguration::Array::MockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration ]
58
- object_instance_one.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :some_other_configuration ]
59
- CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
60
- object_instance_two.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
61
-
62
- # freeze ancestor setting
63
- object_instance_one.configuration_setting.freeze!
64
- object_instance_one.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :some_other_configuration ]
65
- CascadingConfiguration::Array::MockClassSub1.configuration_setting.freeze!
66
- CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
67
- CascadingConfiguration::Array::MockClass.configuration_setting.push( :non_cascading_configuration )
68
- CascadingConfiguration::Array::MockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :non_cascading_configuration ]
69
- object_instance_one.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :some_other_configuration ]
70
- CascadingConfiguration::Array::MockClassSub1.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration ]
71
- object_instance_two.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
72
-
73
- # test two
74
-
75
- module CascadingConfiguration::Array::MockModuleExtended
76
- include CascadingConfiguration::Array
77
- attr_configuration_array :configuration_setting
78
- configuration_setting.should == []
79
- configuration_setting.push( :a_configuration )
80
- configuration_setting.should == [ :a_configuration ]
81
- end
82
-
83
- class CascadingConfiguration::Array::MockClassExtended
84
- extend CascadingConfiguration::Array::MockModuleExtended
85
- configuration_setting.should == [ :a_configuration ]
86
- end
87
-
88
- end
89
-
90
- end
@@ -1,519 +0,0 @@
1
-
2
- require_relative '../../lib/cascading-configuration-array.rb'
3
-
4
- describe CascadingConfiguration::CompositingArray do
5
-
6
- #########
7
- # []= #
8
- #########
9
-
10
- it 'can add elements' do
11
- # primary class
12
- class CascadingConfiguration::CompositingArray::Mock01
13
- include CascadingConfiguration::Variable
14
- include CascadingConfiguration::CompositingArray::Instance
15
- end
16
- working_instance = CascadingConfiguration::CompositingArray::Mock01
17
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
18
- cascading_composite_array[0] = :some_setting
19
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
20
- cascading_composite_array.should == [ :some_setting ]
21
- cascading_composite_array[1] = :other_setting
22
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
23
- cascading_composite_array.should == [ :other_setting, :some_setting ]
24
- # instance
25
- working_instance = CascadingConfiguration::CompositingArray::Mock01.new
26
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
27
- cascading_composite_array.local_cascading_array.should == []
28
- cascading_composite_array[0] = :another_setting
29
- cascading_composite_array.local_cascading_array.should == [ :another_setting ]
30
- cascading_composite_array.should == [ :another_setting, :other_setting, :some_setting ]
31
- # inheriting class
32
- class CascadingConfiguration::CompositingArray::Mock01sub1 < CascadingConfiguration::CompositingArray::Mock01
33
- end
34
- working_instance = CascadingConfiguration::CompositingArray::Mock01sub1
35
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
36
- cascading_composite_array.local_cascading_array.should == []
37
- cascading_composite_array[0] = :yet_another_setting
38
- cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
39
- cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
40
- # instance
41
- working_instance = CascadingConfiguration::CompositingArray::Mock01sub1.new
42
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
43
- cascading_composite_array.local_cascading_array.should == []
44
- cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
45
- cascading_composite_array[0] = :and_still_another_setting
46
- cascading_composite_array.local_cascading_array.should == [ :and_still_another_setting ]
47
- cascading_composite_array.should == [ :and_still_another_setting, :other_setting, :some_setting, :yet_another_setting ]
48
- end
49
-
50
- ########
51
- # << #
52
- ########
53
-
54
- it 'can add elements' do
55
- # primary class
56
- class CascadingConfiguration::CompositingArray::Mock02
57
- include CascadingConfiguration::Variable
58
- include CascadingConfiguration::CompositingArray::Instance
59
- end
60
- working_instance = CascadingConfiguration::CompositingArray::Mock02
61
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
62
- cascading_composite_array << :some_setting
63
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
64
- cascading_composite_array.should == [ :some_setting ]
65
- cascading_composite_array << :other_setting
66
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
67
- cascading_composite_array.should == [ :other_setting, :some_setting ]
68
- # instance
69
- working_instance = CascadingConfiguration::CompositingArray::Mock02.new
70
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
71
- cascading_composite_array.local_cascading_array.should == []
72
- cascading_composite_array << :another_setting
73
- cascading_composite_array.local_cascading_array.should == [ :another_setting ]
74
- cascading_composite_array.should == [ :another_setting, :other_setting, :some_setting ]
75
- # inheriting class
76
- class CascadingConfiguration::CompositingArray::Mock02sub1 < CascadingConfiguration::CompositingArray::Mock02
77
- end
78
- working_instance = CascadingConfiguration::CompositingArray::Mock02sub1
79
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
80
- cascading_composite_array.local_cascading_array.should == []
81
- cascading_composite_array << :yet_another_setting
82
- cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
83
- cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
84
- # instance
85
- working_instance = CascadingConfiguration::CompositingArray::Mock02sub1.new
86
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
87
- cascading_composite_array.local_cascading_array.should == []
88
- cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
89
- cascading_composite_array << :and_still_another_setting
90
- cascading_composite_array.local_cascading_array.should == [ :and_still_another_setting ]
91
- cascading_composite_array.should == [ :and_still_another_setting, :other_setting, :some_setting, :yet_another_setting ]
92
- end
93
-
94
- #######
95
- # + #
96
- #######
97
-
98
- it 'can add elements' do
99
- # primary class
100
- class CascadingConfiguration::CompositingArray::Mock03
101
- include CascadingConfiguration::Variable
102
- include CascadingConfiguration::CompositingArray::Instance
103
- end
104
- working_instance = CascadingConfiguration::CompositingArray::Mock03
105
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
106
- cascading_composite_array += :some_setting
107
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
108
- cascading_composite_array.should == [ :some_setting ]
109
- cascading_composite_array += :other_setting
110
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
111
- cascading_composite_array.should == [ :other_setting, :some_setting ]
112
- # instance
113
- working_instance = CascadingConfiguration::CompositingArray::Mock03.new
114
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
115
- cascading_composite_array.local_cascading_array.should == []
116
- cascading_composite_array += :another_setting
117
- cascading_composite_array.local_cascading_array.should == [ :another_setting ]
118
- cascading_composite_array.should == [ :another_setting, :other_setting, :some_setting ]
119
- # inheriting class
120
- class CascadingConfiguration::CompositingArray::Mock03sub1 < CascadingConfiguration::CompositingArray::Mock03
121
- end
122
- working_instance = CascadingConfiguration::CompositingArray::Mock03sub1
123
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
124
- cascading_composite_array.local_cascading_array.should == []
125
- cascading_composite_array += :yet_another_setting
126
- cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
127
- cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
128
- # instance
129
- working_instance = CascadingConfiguration::CompositingArray::Mock03sub1.new
130
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
131
- cascading_composite_array.local_cascading_array.should == []
132
- cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
133
- cascading_composite_array += :and_still_another_setting
134
- cascading_composite_array.local_cascading_array.should == [ :and_still_another_setting ]
135
- cascading_composite_array.should == [ :and_still_another_setting, :other_setting, :some_setting, :yet_another_setting ]
136
- end
137
-
138
- ############
139
- # concat #
140
- ############
141
-
142
- it 'can add elements' do
143
- # primary class
144
- class CascadingConfiguration::CompositingArray::Mock04
145
- include CascadingConfiguration::Variable
146
- include CascadingConfiguration::CompositingArray::Instance
147
- end
148
- working_instance = CascadingConfiguration::CompositingArray::Mock04
149
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
150
- cascading_composite_array.concat [ :some_setting ]
151
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
152
- cascading_composite_array.should == [ :some_setting ]
153
- cascading_composite_array.concat [ :other_setting ]
154
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
155
- cascading_composite_array.should == [ :other_setting, :some_setting ]
156
- # instance
157
- working_instance = CascadingConfiguration::CompositingArray::Mock04.new
158
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
159
- cascading_composite_array.local_cascading_array.should == []
160
- cascading_composite_array.concat [ :another_setting ]
161
- cascading_composite_array.local_cascading_array.should == [ :another_setting ]
162
- cascading_composite_array.should == [ :another_setting, :other_setting, :some_setting ]
163
- # inheriting class
164
- class CascadingConfiguration::CompositingArray::Mock04sub1 < CascadingConfiguration::CompositingArray::Mock04
165
- end
166
- working_instance = CascadingConfiguration::CompositingArray::Mock04sub1
167
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
168
- cascading_composite_array.local_cascading_array.should == []
169
- cascading_composite_array.concat [ :yet_another_setting ]
170
- cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
171
- cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
172
- # instance
173
- working_instance = CascadingConfiguration::CompositingArray::Mock04sub1.new
174
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
175
- cascading_composite_array.local_cascading_array.should == []
176
- cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
177
- cascading_composite_array.concat [ :and_still_another_setting ]
178
- cascading_composite_array.local_cascading_array.should == [ :and_still_another_setting ]
179
- cascading_composite_array.should == [ :and_still_another_setting, :other_setting, :some_setting, :yet_another_setting ]
180
- end
181
-
182
- ##########
183
- # push #
184
- ##########
185
-
186
- it 'can add elements' do
187
- # primary class
188
- class CascadingConfiguration::CompositingArray::Mock05
189
- include CascadingConfiguration::Variable
190
- include CascadingConfiguration::CompositingArray::Instance
191
- end
192
- working_instance = CascadingConfiguration::CompositingArray::Mock05
193
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
194
- cascading_composite_array.push :some_setting
195
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
196
- cascading_composite_array.should == [ :some_setting ]
197
- cascading_composite_array.push :other_setting
198
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
199
- cascading_composite_array.should == [ :other_setting, :some_setting ]
200
- # instance
201
- working_instance = CascadingConfiguration::CompositingArray::Mock05.new
202
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
203
- cascading_composite_array.local_cascading_array.should == []
204
- cascading_composite_array.push :another_setting
205
- cascading_composite_array.local_cascading_array.should == [ :another_setting ]
206
- cascading_composite_array.should == [ :another_setting, :other_setting, :some_setting ]
207
- # inheriting class
208
- class CascadingConfiguration::CompositingArray::Mock05sub1 < CascadingConfiguration::CompositingArray::Mock05
209
- end
210
- working_instance = CascadingConfiguration::CompositingArray::Mock05sub1
211
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
212
- cascading_composite_array.local_cascading_array.should == []
213
- cascading_composite_array.push :yet_another_setting
214
- cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
215
- cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
216
- # instance
217
- working_instance = CascadingConfiguration::CompositingArray::Mock05sub1.new
218
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
219
- cascading_composite_array.local_cascading_array.should == []
220
- cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
221
- cascading_composite_array.push :and_still_another_setting
222
- cascading_composite_array.local_cascading_array.should == [ :and_still_another_setting ]
223
- cascading_composite_array.should == [ :and_still_another_setting, :other_setting, :some_setting, :yet_another_setting ]
224
- end
225
-
226
- #######
227
- # - #
228
- #######
229
-
230
- it 'can exclude elements' do
231
- # primary class
232
- class CascadingConfiguration::CompositingArray::Mock06
233
- include CascadingConfiguration::Variable
234
- include CascadingConfiguration::CompositingArray::Instance
235
- end
236
- working_instance = CascadingConfiguration::CompositingArray::Mock06
237
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
238
- cascading_composite_array.push( :other_setting, :some_setting )
239
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
240
- cascading_composite_array.should == [ :other_setting, :some_setting ]
241
- cascading_composite_array -= [ :other_setting ]
242
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
243
- cascading_composite_array.should == [ :some_setting ]
244
- # instance
245
- working_instance = CascadingConfiguration::CompositingArray::Mock06.new
246
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
247
- cascading_composite_array.local_cascading_array.should == []
248
- cascading_composite_array += [ :another_setting ]
249
- cascading_composite_array.local_cascading_array.should == [ :another_setting ]
250
- cascading_composite_array -= [ :some_setting ]
251
- cascading_composite_array.should == [ :another_setting ]
252
- # inheriting class
253
- class CascadingConfiguration::CompositingArray::Mock06sub1 < CascadingConfiguration::CompositingArray::Mock06
254
- end
255
- working_instance = CascadingConfiguration::CompositingArray::Mock06sub1
256
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
257
- cascading_composite_array.local_cascading_array.should == []
258
- cascading_composite_array += [ :yet_another_setting ]
259
- cascading_composite_array -= [ :some_setting ]
260
- cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
261
- cascading_composite_array.should == [ :yet_another_setting ]
262
- # instance
263
- working_instance = CascadingConfiguration::CompositingArray::Mock06sub1.new
264
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
265
- cascading_composite_array.local_cascading_array.should == []
266
- cascading_composite_array.should == [ :yet_another_setting ]
267
- cascading_composite_array += [ :and_still_another_setting ]
268
- cascading_composite_array -= [ :yet_another_setting ]
269
- cascading_composite_array.local_cascading_array.should == [ :and_still_another_setting ]
270
- cascading_composite_array.should == [ :and_still_another_setting ]
271
- end
272
-
273
- ############
274
- # delete #
275
- ############
276
-
277
- it 'can exclude elements' do
278
- # primary class
279
- class CascadingConfiguration::CompositingArray::Mock07
280
- include CascadingConfiguration::Variable
281
- include CascadingConfiguration::CompositingArray::Instance
282
- end
283
- working_instance = CascadingConfiguration::CompositingArray::Mock07
284
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
285
- cascading_composite_array.push( :other_setting, :some_setting )
286
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
287
- cascading_composite_array.should == [ :other_setting, :some_setting ]
288
- cascading_composite_array.delete( :other_setting )
289
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
290
- cascading_composite_array.should == [ :some_setting ]
291
- # instance
292
- working_instance = CascadingConfiguration::CompositingArray::Mock07.new
293
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
294
- cascading_composite_array.local_cascading_array.should == []
295
- cascading_composite_array += [ :another_setting ]
296
- cascading_composite_array.local_cascading_array.should == [ :another_setting ]
297
- cascading_composite_array.delete( :some_setting )
298
- cascading_composite_array.should == [ :another_setting ]
299
- # inheriting class
300
- class CascadingConfiguration::CompositingArray::Mock07sub1 < CascadingConfiguration::CompositingArray::Mock07
301
- end
302
- working_instance = CascadingConfiguration::CompositingArray::Mock07sub1
303
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
304
- cascading_composite_array.local_cascading_array.should == []
305
- cascading_composite_array += [ :yet_another_setting ]
306
- cascading_composite_array.delete( :some_setting )
307
- cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
308
- cascading_composite_array.should == [ :yet_another_setting ]
309
- # instance
310
- working_instance = CascadingConfiguration::CompositingArray::Mock07sub1.new
311
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
312
- cascading_composite_array.local_cascading_array.should == []
313
- cascading_composite_array.should == [ :yet_another_setting ]
314
- cascading_composite_array += [ :and_still_another_setting ]
315
- cascading_composite_array.delete( :yet_another_setting )
316
- cascading_composite_array.local_cascading_array.should == [ :and_still_another_setting ]
317
- cascading_composite_array.should == [ :and_still_another_setting ]
318
- end
319
-
320
- #########
321
- # pop #
322
- #########
323
-
324
- it 'can pop the final element' do
325
- # primary class
326
- class CascadingConfiguration::CompositingArray::Mock08
327
- include CascadingConfiguration::Variable
328
- include CascadingConfiguration::CompositingArray::Instance
329
- end
330
- working_instance = CascadingConfiguration::CompositingArray::Mock08
331
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
332
- cascading_composite_array.push( :other_setting, :some_setting )
333
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
334
- cascading_composite_array.should == [ :other_setting, :some_setting ]
335
- cascading_composite_array.pop.should == :some_setting
336
- cascading_composite_array.local_cascading_array.should == [ :other_setting ]
337
- cascading_composite_array.should == [ :other_setting ]
338
- # instance
339
- working_instance = CascadingConfiguration::CompositingArray::Mock08.new
340
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
341
- cascading_composite_array.local_cascading_array.should == []
342
- cascading_composite_array += :another_setting
343
- cascading_composite_array.local_cascading_array.should == [ :another_setting ]
344
- cascading_composite_array.pop.should == :other_setting
345
- cascading_composite_array.should == [ :another_setting ]
346
- # inheriting class
347
- class CascadingConfiguration::CompositingArray::Mock08sub1 < CascadingConfiguration::CompositingArray::Mock08
348
- end
349
- working_instance = CascadingConfiguration::CompositingArray::Mock08sub1
350
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
351
- cascading_composite_array.local_cascading_array.should == []
352
- cascading_composite_array.pop.should == :other_setting
353
- cascading_composite_array.should == []
354
- cascading_composite_array += :yet_another_setting
355
- cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
356
- cascading_composite_array.should == [ :yet_another_setting ]
357
- # instance
358
- working_instance = CascadingConfiguration::CompositingArray::Mock08sub1.new
359
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
360
- cascading_composite_array.local_cascading_array.should == []
361
- cascading_composite_array.should == [ :yet_another_setting ]
362
- cascading_composite_array.pop.should == :yet_another_setting
363
- cascading_composite_array.should == []
364
- cascading_composite_array += :and_still_another_setting
365
- cascading_composite_array.local_cascading_array.should == [ :and_still_another_setting ]
366
- cascading_composite_array.should == [ :and_still_another_setting ]
367
- end
368
-
369
- ###########
370
- # shift #
371
- ###########
372
-
373
- it 'can shift the first element' do
374
- # primary class
375
- class CascadingConfiguration::CompositingArray::Mock09
376
- include CascadingConfiguration::Variable
377
- include CascadingConfiguration::CompositingArray::Instance
378
- end
379
- working_instance = CascadingConfiguration::CompositingArray::Mock09
380
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
381
- cascading_composite_array.push( :other_setting, :some_setting )
382
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
383
- cascading_composite_array.should == [ :other_setting, :some_setting ]
384
- cascading_composite_array.shift
385
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
386
- cascading_composite_array.should == [ :some_setting ]
387
- # instance
388
- working_instance = CascadingConfiguration::CompositingArray::Mock09.new
389
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
390
- cascading_composite_array.local_cascading_array.should == []
391
- cascading_composite_array.shift
392
- cascading_composite_array.should == []
393
- cascading_composite_array += :another_setting
394
- cascading_composite_array.local_cascading_array.should == [ :another_setting ]
395
- cascading_composite_array.should == [ :another_setting ]
396
- # inheriting class
397
- class CascadingConfiguration::CompositingArray::Mock09sub1 < CascadingConfiguration::CompositingArray::Mock09
398
- end
399
- working_instance = CascadingConfiguration::CompositingArray::Mock09sub1
400
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
401
- cascading_composite_array.local_cascading_array.should == []
402
- cascading_composite_array.shift
403
- cascading_composite_array.should == []
404
- cascading_composite_array += :yet_another_setting
405
- cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
406
- cascading_composite_array.should == [ :yet_another_setting ]
407
- # instance
408
- working_instance = CascadingConfiguration::CompositingArray::Mock09sub1.new
409
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
410
- cascading_composite_array.local_cascading_array.should == []
411
- cascading_composite_array.should == [ :yet_another_setting ]
412
- cascading_composite_array.shift
413
- cascading_composite_array.should == []
414
- cascading_composite_array += :and_still_another_setting
415
- cascading_composite_array.local_cascading_array.should == [ :and_still_another_setting ]
416
- cascading_composite_array.should == [ :and_still_another_setting ]
417
- end
418
-
419
- ############
420
- # slice! #
421
- ############
422
-
423
- it 'can slice elements' do
424
- # primary class
425
- class CascadingConfiguration::CompositingArray::Mock10
426
- include CascadingConfiguration::Variable
427
- include CascadingConfiguration::CompositingArray::Instance
428
- end
429
- working_instance = CascadingConfiguration::CompositingArray::Mock10
430
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
431
- cascading_composite_array.push( :other_setting, :some_setting )
432
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
433
- cascading_composite_array.should == [ :other_setting, :some_setting ]
434
- cascading_composite_array.slice!( 0, 1 ).should == [ :other_setting ]
435
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
436
- cascading_composite_array.should == [ :some_setting ]
437
- # instance
438
- working_instance = CascadingConfiguration::CompositingArray::Mock10.new
439
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
440
- cascading_composite_array.local_cascading_array.should == []
441
- cascading_composite_array.slice!( 0, 1 ).should == [ :some_setting ]
442
- cascading_composite_array.should == []
443
- cascading_composite_array += :another_setting
444
- cascading_composite_array.local_cascading_array.should == [ :another_setting ]
445
- cascading_composite_array.should == [ :another_setting ]
446
- # inheriting class
447
- class CascadingConfiguration::CompositingArray::Mock10sub1 < CascadingConfiguration::CompositingArray::Mock10
448
- end
449
- working_instance = CascadingConfiguration::CompositingArray::Mock10sub1
450
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
451
- cascading_composite_array.local_cascading_array.should == []
452
- cascading_composite_array.slice!( 0, 1 ).should == [ :some_setting ]
453
- cascading_composite_array.should == []
454
- cascading_composite_array += :yet_another_setting
455
- cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
456
- cascading_composite_array.should == [ :yet_another_setting ]
457
- # instance
458
- working_instance = CascadingConfiguration::CompositingArray::Mock10sub1.new
459
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
460
- cascading_composite_array.local_cascading_array.should == []
461
- cascading_composite_array.should == [ :yet_another_setting ]
462
- cascading_composite_array.slice!( 0, 1 ).should == [ :yet_another_setting ]
463
- cascading_composite_array.should == []
464
- cascading_composite_array += :and_still_another_setting
465
- cascading_composite_array.local_cascading_array.should == [ :and_still_another_setting ]
466
- cascading_composite_array.should == [ :and_still_another_setting ]
467
- end
468
-
469
- ###########
470
- # clear #
471
- ###########
472
-
473
- it 'can clear, causing present elements to be excluded' do
474
- # primary class
475
- class CascadingConfiguration::CompositingArray::Mock11
476
- include CascadingConfiguration::Variable
477
- include CascadingConfiguration::CompositingArray::Instance
478
- end
479
- working_instance = CascadingConfiguration::CompositingArray::Mock11
480
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
481
- cascading_composite_array.push( :other_setting, :some_setting )
482
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
483
- cascading_composite_array.should == [ :other_setting, :some_setting ]
484
- cascading_composite_array.clear
485
- cascading_composite_array.local_cascading_array.should == []
486
- cascading_composite_array.should == []
487
- # instance
488
- working_instance = CascadingConfiguration::CompositingArray::Mock11.new
489
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
490
- cascading_composite_array.local_cascading_array.should == []
491
- cascading_composite_array.clear
492
- cascading_composite_array.should == []
493
- cascading_composite_array += :another_setting
494
- cascading_composite_array.local_cascading_array.should == [ :another_setting ]
495
- cascading_composite_array.should == [ :another_setting ]
496
- # inheriting class
497
- class CascadingConfiguration::CompositingArray::Mock11sub1 < CascadingConfiguration::CompositingArray::Mock11
498
- end
499
- working_instance = CascadingConfiguration::CompositingArray::Mock11sub1
500
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
501
- cascading_composite_array.local_cascading_array.should == []
502
- cascading_composite_array.clear
503
- cascading_composite_array.should == []
504
- cascading_composite_array += :yet_another_setting
505
- cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
506
- cascading_composite_array.should == [ :yet_another_setting ]
507
- # instance
508
- working_instance = CascadingConfiguration::CompositingArray::Mock11sub1.new
509
- cascading_composite_array = working_instance.composite_array_for_cascading_configuration( :some_configuration )
510
- cascading_composite_array.local_cascading_array.should == []
511
- cascading_composite_array.should == [ :yet_another_setting ]
512
- cascading_composite_array.clear
513
- cascading_composite_array.should == []
514
- cascading_composite_array += :and_still_another_setting
515
- cascading_composite_array.local_cascading_array.should == [ :and_still_another_setting ]
516
- cascading_composite_array.should == [ :and_still_another_setting ]
517
- end
518
-
519
- end