cascading-configuration-array 1.4.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cascading-configuration-array/CascadingConfiguration/Array/Interface.rb +58 -21
- data/lib/cascading-configuration-array/CascadingConfiguration/Array.rb +6 -21
- data/lib/cascading-configuration-array/{CascadingConfiguration → _private_/CascadingConfiguration/Array/CompositingArray}/LocalConfigurationArray.rb +27 -1
- data/lib/cascading-configuration-array/_private_/CascadingConfiguration/Array/CompositingArray.rb +295 -0
- data/lib/cascading-configuration-array/_private_/CascadingConfiguration/Array/Interface/GettersSetters.rb +246 -0
- data/lib/cascading-configuration-array/_private_/CascadingConfiguration/Array/ModuleSupportMethods.rb +48 -0
- data/lib/cascading-configuration-array.rb +16 -23
- data/spec/CascadingConfiguration/Array_spec.rb +2 -3
- data/spec/{CascadingConfiguration → _private_/CascadingConfiguration/Array/CompositingArray}/LocalConfigurationArray_spec.rb +13 -13
- data/spec/_private_/CascadingConfiguration/Array/CompositingArray_spec.rb +569 -0
- metadata +10 -28
- data/lib/cascading-configuration-array/CascadingConfiguration/Array/AccessorDefinitionMethods.rb +0 -175
- data/lib/cascading-configuration-array/CascadingConfiguration/Array/Interface/Instance.rb +0 -22
- data/lib/cascading-configuration-array/CascadingConfiguration/CompositingArray/Instance.rb +0 -31
- data/lib/cascading-configuration-array/CascadingConfiguration/CompositingArray.rb +0 -215
- data/lib/cascading-configuration-array/CascadingConfiguration/_private_/CompositingArray.rb +0 -57
- data/lib/cascading-configuration-array/CascadingConfiguration/_private_/LocalConfigurationArray.rb +0 -26
- data/spec/CascadingConfiguration/Array/AccessorDefinitionMethods_spec.rb +0 -30
- data/spec/CascadingConfiguration/CompositingArray_spec.rb +0 -541
@@ -0,0 +1,569 @@
|
|
1
|
+
|
2
|
+
require_relative '../../../../lib/cascading-configuration-array.rb'
|
3
|
+
|
4
|
+
describe CascadingConfiguration::Array::CompositingArray do
|
5
|
+
|
6
|
+
#########
|
7
|
+
# []= #
|
8
|
+
#########
|
9
|
+
|
10
|
+
it 'can add elements' do
|
11
|
+
|
12
|
+
module CascadingConfiguration::Array::CompositingArray::CCAMock01
|
13
|
+
include CascadingConfiguration::Variable
|
14
|
+
end
|
15
|
+
|
16
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock01A
|
17
|
+
include CascadingConfiguration::Array::CompositingArray::CCAMock01
|
18
|
+
end
|
19
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock01B
|
20
|
+
include CascadingConfiguration::Array::CompositingArray::CIMock01A
|
21
|
+
end
|
22
|
+
|
23
|
+
ccv = CascadingConfiguration::Variable
|
24
|
+
ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock01
|
25
|
+
configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock01A
|
26
|
+
sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock01B
|
27
|
+
configuration_name = :some_configuration
|
28
|
+
|
29
|
+
# Without super or sub composites
|
30
|
+
cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
|
31
|
+
cascading_composite_array[ 0 ].should == nil
|
32
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
33
|
+
cascading_composite_array[ 0 ] = :some_setting
|
34
|
+
cascading_composite_array.local_cascading_array.should == [ :some_setting ]
|
35
|
+
cascading_composite_array.should == [ :some_setting ]
|
36
|
+
cascading_composite_array[ 1 ] = :other_setting
|
37
|
+
cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
|
38
|
+
cascading_composite_array.should == [ :other_setting, :some_setting ]
|
39
|
+
|
40
|
+
# Super with a sub composite
|
41
|
+
sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
|
42
|
+
sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
|
43
|
+
sub_cascading_composite_array[ 0 ].should == :other_setting
|
44
|
+
sub_cascading_composite_array[ 1 ].should == :some_setting
|
45
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting ]
|
46
|
+
sub_cascading_composite_array.local_cascading_array.should == [ ]
|
47
|
+
sub_cascading_composite_array[ 0 ] = :yet_another_setting
|
48
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
49
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
|
50
|
+
sub_cascading_composite_array[ 0 ] = :other_setting
|
51
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :other_setting, :yet_another_setting ]
|
52
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
########
|
57
|
+
# << #
|
58
|
+
########
|
59
|
+
|
60
|
+
it 'can add elements' do
|
61
|
+
|
62
|
+
module CascadingConfiguration::Array::CompositingArray::CCAMock02
|
63
|
+
include CascadingConfiguration::Variable
|
64
|
+
end
|
65
|
+
|
66
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock02A
|
67
|
+
include CascadingConfiguration::Array::CompositingArray::CCAMock02
|
68
|
+
end
|
69
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock02B
|
70
|
+
include CascadingConfiguration::Array::CompositingArray::CIMock02A
|
71
|
+
end
|
72
|
+
|
73
|
+
ccv = CascadingConfiguration::Variable
|
74
|
+
ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock02
|
75
|
+
configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock02A
|
76
|
+
sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock02B
|
77
|
+
configuration_name = :some_configuration
|
78
|
+
|
79
|
+
# Without super or sub composites
|
80
|
+
cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
|
81
|
+
cascading_composite_array[ 0 ].should == nil
|
82
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
83
|
+
cascading_composite_array << :some_setting
|
84
|
+
cascading_composite_array.local_cascading_array.should == [ :some_setting ]
|
85
|
+
cascading_composite_array.should == [ :some_setting ]
|
86
|
+
cascading_composite_array << :other_setting
|
87
|
+
cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
|
88
|
+
cascading_composite_array.should == [ :other_setting, :some_setting ]
|
89
|
+
|
90
|
+
# Super with a sub composite
|
91
|
+
sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
|
92
|
+
sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
|
93
|
+
sub_cascading_composite_array[ 0 ].should == :other_setting
|
94
|
+
sub_cascading_composite_array[ 1 ].should == :some_setting
|
95
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting ]
|
96
|
+
sub_cascading_composite_array.local_cascading_array.should == [ ]
|
97
|
+
sub_cascading_composite_array << :yet_another_setting
|
98
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
99
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
|
100
|
+
sub_cascading_composite_array << :other_setting
|
101
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :other_setting, :yet_another_setting ]
|
102
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
#######
|
107
|
+
# + #
|
108
|
+
#######
|
109
|
+
|
110
|
+
it 'can add elements' do
|
111
|
+
|
112
|
+
module CascadingConfiguration::Array::CompositingArray::CCAMock03
|
113
|
+
include CascadingConfiguration::Variable
|
114
|
+
end
|
115
|
+
|
116
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock03A
|
117
|
+
include CascadingConfiguration::Array::CompositingArray::CCAMock03
|
118
|
+
end
|
119
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock03B
|
120
|
+
include CascadingConfiguration::Array::CompositingArray::CIMock03A
|
121
|
+
end
|
122
|
+
|
123
|
+
ccv = CascadingConfiguration::Variable
|
124
|
+
ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock03
|
125
|
+
configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock03A
|
126
|
+
sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock03B
|
127
|
+
configuration_name = :some_configuration
|
128
|
+
|
129
|
+
# Without super or sub composites
|
130
|
+
cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
|
131
|
+
cascading_composite_array[ 0 ].should == nil
|
132
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
133
|
+
cascading_composite_array += :some_setting
|
134
|
+
cascading_composite_array.local_cascading_array.should == [ :some_setting ]
|
135
|
+
cascading_composite_array.should == [ :some_setting ]
|
136
|
+
cascading_composite_array += :other_setting
|
137
|
+
cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
|
138
|
+
cascading_composite_array.should == [ :other_setting, :some_setting ]
|
139
|
+
|
140
|
+
# Super with a sub composite
|
141
|
+
sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
|
142
|
+
sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
|
143
|
+
sub_cascading_composite_array[ 0 ].should == :other_setting
|
144
|
+
sub_cascading_composite_array[ 1 ].should == :some_setting
|
145
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting ]
|
146
|
+
sub_cascading_composite_array.local_cascading_array.should == [ ]
|
147
|
+
sub_cascading_composite_array += :yet_another_setting
|
148
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
149
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
|
150
|
+
sub_cascading_composite_array += :other_setting
|
151
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :other_setting, :yet_another_setting ]
|
152
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
|
153
|
+
|
154
|
+
end
|
155
|
+
|
156
|
+
############
|
157
|
+
# concat #
|
158
|
+
############
|
159
|
+
|
160
|
+
it 'can add elements' do
|
161
|
+
|
162
|
+
module CascadingConfiguration::Array::CompositingArray::CCAMock04
|
163
|
+
include CascadingConfiguration::Variable
|
164
|
+
end
|
165
|
+
|
166
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock04A
|
167
|
+
include CascadingConfiguration::Array::CompositingArray::CCAMock04
|
168
|
+
end
|
169
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock04B
|
170
|
+
include CascadingConfiguration::Array::CompositingArray::CIMock04A
|
171
|
+
end
|
172
|
+
|
173
|
+
ccv = CascadingConfiguration::Variable
|
174
|
+
ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock04
|
175
|
+
configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock04A
|
176
|
+
sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock04B
|
177
|
+
configuration_name = :some_configuration
|
178
|
+
|
179
|
+
# Without super or sub composites
|
180
|
+
cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
|
181
|
+
cascading_composite_array[ 0 ].should == nil
|
182
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
183
|
+
cascading_composite_array.concat( [ :some_setting ] )
|
184
|
+
cascading_composite_array.local_cascading_array.should == [ :some_setting ]
|
185
|
+
cascading_composite_array.should == [ :some_setting ]
|
186
|
+
cascading_composite_array.concat( :other_setting )
|
187
|
+
cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
|
188
|
+
cascading_composite_array.should == [ :other_setting, :some_setting ]
|
189
|
+
|
190
|
+
# Super with a sub composite
|
191
|
+
sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
|
192
|
+
sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
|
193
|
+
sub_cascading_composite_array[ 0 ].should == :other_setting
|
194
|
+
sub_cascading_composite_array[ 1 ].should == :some_setting
|
195
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting ]
|
196
|
+
sub_cascading_composite_array.local_cascading_array.should == [ ]
|
197
|
+
sub_cascading_composite_array.concat( :yet_another_setting )
|
198
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
199
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
|
200
|
+
sub_cascading_composite_array.concat( :other_setting )
|
201
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :other_setting, :yet_another_setting ]
|
202
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
|
203
|
+
|
204
|
+
end
|
205
|
+
|
206
|
+
##########
|
207
|
+
# push #
|
208
|
+
##########
|
209
|
+
|
210
|
+
it 'can add elements' do
|
211
|
+
|
212
|
+
module CascadingConfiguration::Array::CompositingArray::CCAMock05
|
213
|
+
include CascadingConfiguration::Variable
|
214
|
+
end
|
215
|
+
|
216
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock05A
|
217
|
+
include CascadingConfiguration::Array::CompositingArray::CCAMock05
|
218
|
+
end
|
219
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock05B
|
220
|
+
include CascadingConfiguration::Array::CompositingArray::CIMock05A
|
221
|
+
end
|
222
|
+
|
223
|
+
ccv = CascadingConfiguration::Variable
|
224
|
+
ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock05
|
225
|
+
configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock05A
|
226
|
+
sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock05B
|
227
|
+
configuration_name = :some_configuration
|
228
|
+
|
229
|
+
# Without super or sub composites
|
230
|
+
cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
|
231
|
+
cascading_composite_array[ 0 ].should == nil
|
232
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
233
|
+
cascading_composite_array.push( :some_setting )
|
234
|
+
cascading_composite_array.local_cascading_array.should == [ :some_setting ]
|
235
|
+
cascading_composite_array.should == [ :some_setting ]
|
236
|
+
cascading_composite_array.push( :other_setting )
|
237
|
+
cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
|
238
|
+
cascading_composite_array.should == [ :other_setting, :some_setting ]
|
239
|
+
|
240
|
+
# Super with a sub composite
|
241
|
+
sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
|
242
|
+
sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
|
243
|
+
sub_cascading_composite_array[ 0 ].should == :other_setting
|
244
|
+
sub_cascading_composite_array[ 1 ].should == :some_setting
|
245
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting ]
|
246
|
+
sub_cascading_composite_array.local_cascading_array.should == [ ]
|
247
|
+
sub_cascading_composite_array.push( :yet_another_setting )
|
248
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
249
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
|
250
|
+
sub_cascading_composite_array.push( :other_setting )
|
251
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :other_setting, :yet_another_setting ]
|
252
|
+
sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
|
253
|
+
|
254
|
+
end
|
255
|
+
|
256
|
+
#######
|
257
|
+
# - #
|
258
|
+
#######
|
259
|
+
|
260
|
+
it 'can exclude elements' do
|
261
|
+
|
262
|
+
module CascadingConfiguration::Array::CompositingArray::CCAMock06
|
263
|
+
include CascadingConfiguration::Variable
|
264
|
+
end
|
265
|
+
|
266
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock06A
|
267
|
+
include CascadingConfiguration::Array::CompositingArray::CCAMock06
|
268
|
+
end
|
269
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock06B
|
270
|
+
include CascadingConfiguration::Array::CompositingArray::CIMock06A
|
271
|
+
end
|
272
|
+
|
273
|
+
ccv = CascadingConfiguration::Variable
|
274
|
+
ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock06
|
275
|
+
configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock06A
|
276
|
+
sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock06B
|
277
|
+
configuration_name = :some_configuration
|
278
|
+
|
279
|
+
# Without super or sub composites
|
280
|
+
cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
|
281
|
+
cascading_composite_array[ 0 ].should == nil
|
282
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
283
|
+
cascading_composite_array += :some_setting
|
284
|
+
cascading_composite_array.local_cascading_array.should == [ :some_setting ]
|
285
|
+
cascading_composite_array.should == [ :some_setting ]
|
286
|
+
cascading_composite_array -= :some_setting
|
287
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
288
|
+
cascading_composite_array.should == [ ]
|
289
|
+
cascading_composite_array += :other_setting
|
290
|
+
cascading_composite_array.local_cascading_array.should == [ :other_setting ]
|
291
|
+
cascading_composite_array.should == [ :other_setting ]
|
292
|
+
|
293
|
+
# Super with a sub composite
|
294
|
+
sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
|
295
|
+
sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
|
296
|
+
sub_cascading_composite_array.should == [ :other_setting ]
|
297
|
+
sub_cascading_composite_array.local_cascading_array.should == [ ]
|
298
|
+
sub_cascading_composite_array += :yet_another_setting
|
299
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
300
|
+
sub_cascading_composite_array.should == [ :other_setting, :yet_another_setting ]
|
301
|
+
sub_cascading_composite_array -= :other_setting
|
302
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
303
|
+
sub_cascading_composite_array.should == [ :yet_another_setting ]
|
304
|
+
cascading_composite_array.should == [ :other_setting ]
|
305
|
+
|
306
|
+
end
|
307
|
+
|
308
|
+
############
|
309
|
+
# delete #
|
310
|
+
############
|
311
|
+
|
312
|
+
it 'can exclude elements' do
|
313
|
+
|
314
|
+
module CascadingConfiguration::Array::CompositingArray::CCAMock07
|
315
|
+
include CascadingConfiguration::Variable
|
316
|
+
end
|
317
|
+
|
318
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock07A
|
319
|
+
include CascadingConfiguration::Array::CompositingArray::CCAMock07
|
320
|
+
end
|
321
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock07B
|
322
|
+
include CascadingConfiguration::Array::CompositingArray::CIMock07A
|
323
|
+
end
|
324
|
+
|
325
|
+
ccv = CascadingConfiguration::Variable
|
326
|
+
ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock07
|
327
|
+
configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock07A
|
328
|
+
sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock07B
|
329
|
+
configuration_name = :some_configuration
|
330
|
+
|
331
|
+
# Without super or sub composites
|
332
|
+
cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
|
333
|
+
cascading_composite_array[ 0 ].should == nil
|
334
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
335
|
+
cascading_composite_array += :some_setting
|
336
|
+
cascading_composite_array.local_cascading_array.should == [ :some_setting ]
|
337
|
+
cascading_composite_array.should == [ :some_setting ]
|
338
|
+
cascading_composite_array.delete( :some_setting )
|
339
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
340
|
+
cascading_composite_array.should == [ ]
|
341
|
+
cascading_composite_array += :other_setting
|
342
|
+
cascading_composite_array.local_cascading_array.should == [ :other_setting ]
|
343
|
+
cascading_composite_array.should == [ :other_setting ]
|
344
|
+
|
345
|
+
# Super with a sub composite
|
346
|
+
sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
|
347
|
+
sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
|
348
|
+
sub_cascading_composite_array.should == [ :other_setting ]
|
349
|
+
sub_cascading_composite_array.local_cascading_array.should == [ ]
|
350
|
+
sub_cascading_composite_array += :yet_another_setting
|
351
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
352
|
+
sub_cascading_composite_array.should == [ :other_setting, :yet_another_setting ]
|
353
|
+
sub_cascading_composite_array.delete( :other_setting )
|
354
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
355
|
+
sub_cascading_composite_array.should == [ :yet_another_setting ]
|
356
|
+
cascading_composite_array.should == [ :other_setting ]
|
357
|
+
|
358
|
+
end
|
359
|
+
|
360
|
+
#########
|
361
|
+
# pop #
|
362
|
+
#########
|
363
|
+
|
364
|
+
it 'can pop the final element' do
|
365
|
+
|
366
|
+
module CascadingConfiguration::Array::CompositingArray::CCAMock08
|
367
|
+
include CascadingConfiguration::Variable
|
368
|
+
end
|
369
|
+
|
370
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock08A
|
371
|
+
include CascadingConfiguration::Array::CompositingArray::CCAMock08
|
372
|
+
end
|
373
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock08B
|
374
|
+
include CascadingConfiguration::Array::CompositingArray::CIMock08A
|
375
|
+
end
|
376
|
+
|
377
|
+
ccv = CascadingConfiguration::Variable
|
378
|
+
ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock08
|
379
|
+
configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock08A
|
380
|
+
sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock08B
|
381
|
+
configuration_name = :some_configuration
|
382
|
+
|
383
|
+
# Without super or sub composites
|
384
|
+
cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
|
385
|
+
cascading_composite_array[ 0 ].should == nil
|
386
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
387
|
+
cascading_composite_array += :some_setting
|
388
|
+
cascading_composite_array.local_cascading_array.should == [ :some_setting ]
|
389
|
+
cascading_composite_array.should == [ :some_setting ]
|
390
|
+
cascading_composite_array.pop.should == :some_setting
|
391
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
392
|
+
cascading_composite_array.should == [ ]
|
393
|
+
cascading_composite_array += :other_setting
|
394
|
+
cascading_composite_array.local_cascading_array.should == [ :other_setting ]
|
395
|
+
cascading_composite_array.should == [ :other_setting ]
|
396
|
+
|
397
|
+
# Super with a sub composite
|
398
|
+
sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
|
399
|
+
sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
|
400
|
+
sub_cascading_composite_array.should == [ :other_setting ]
|
401
|
+
sub_cascading_composite_array.local_cascading_array.should == [ ]
|
402
|
+
sub_cascading_composite_array += :yet_another_setting
|
403
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
404
|
+
sub_cascading_composite_array.should == [ :other_setting, :yet_another_setting ]
|
405
|
+
sub_cascading_composite_array.pop.should == :yet_another_setting
|
406
|
+
sub_cascading_composite_array.local_cascading_array.should == []
|
407
|
+
sub_cascading_composite_array.should == [ :other_setting ]
|
408
|
+
cascading_composite_array.should == [ :other_setting ]
|
409
|
+
|
410
|
+
end
|
411
|
+
|
412
|
+
###########
|
413
|
+
# shift #
|
414
|
+
###########
|
415
|
+
|
416
|
+
it 'can shift the first element' do
|
417
|
+
|
418
|
+
module CascadingConfiguration::Array::CompositingArray::CCAMock09
|
419
|
+
include CascadingConfiguration::Variable
|
420
|
+
end
|
421
|
+
|
422
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock09A
|
423
|
+
include CascadingConfiguration::Array::CompositingArray::CCAMock09
|
424
|
+
end
|
425
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock09B
|
426
|
+
include CascadingConfiguration::Array::CompositingArray::CIMock09A
|
427
|
+
end
|
428
|
+
|
429
|
+
ccv = CascadingConfiguration::Variable
|
430
|
+
ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock09
|
431
|
+
configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock09A
|
432
|
+
sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock09B
|
433
|
+
configuration_name = :some_configuration
|
434
|
+
|
435
|
+
# Without super or sub composites
|
436
|
+
cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
|
437
|
+
cascading_composite_array[ 0 ].should == nil
|
438
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
439
|
+
cascading_composite_array += :some_setting
|
440
|
+
cascading_composite_array.local_cascading_array.should == [ :some_setting ]
|
441
|
+
cascading_composite_array.should == [ :some_setting ]
|
442
|
+
cascading_composite_array.shift.should == :some_setting
|
443
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
444
|
+
cascading_composite_array.should == [ ]
|
445
|
+
cascading_composite_array += :other_setting
|
446
|
+
cascading_composite_array.local_cascading_array.should == [ :other_setting ]
|
447
|
+
cascading_composite_array.should == [ :other_setting ]
|
448
|
+
|
449
|
+
# Super with a sub composite
|
450
|
+
sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
|
451
|
+
sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
|
452
|
+
sub_cascading_composite_array.should == [ :other_setting ]
|
453
|
+
sub_cascading_composite_array.local_cascading_array.should == [ ]
|
454
|
+
sub_cascading_composite_array += :yet_another_setting
|
455
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
456
|
+
sub_cascading_composite_array.should == [ :other_setting, :yet_another_setting ]
|
457
|
+
sub_cascading_composite_array.shift.should == :other_setting
|
458
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
459
|
+
sub_cascading_composite_array.should == [ :yet_another_setting ]
|
460
|
+
cascading_composite_array.should == [ :other_setting ]
|
461
|
+
|
462
|
+
end
|
463
|
+
|
464
|
+
############
|
465
|
+
# slice! #
|
466
|
+
############
|
467
|
+
|
468
|
+
it 'can slice elements' do
|
469
|
+
|
470
|
+
module CascadingConfiguration::Array::CompositingArray::CCAMock10
|
471
|
+
include CascadingConfiguration::Variable
|
472
|
+
end
|
473
|
+
|
474
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock10A
|
475
|
+
include CascadingConfiguration::Array::CompositingArray::CCAMock10
|
476
|
+
end
|
477
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock10B
|
478
|
+
include CascadingConfiguration::Array::CompositingArray::CIMock10A
|
479
|
+
end
|
480
|
+
|
481
|
+
ccv = CascadingConfiguration::Variable
|
482
|
+
ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock10
|
483
|
+
configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock10A
|
484
|
+
sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock10B
|
485
|
+
configuration_name = :some_configuration
|
486
|
+
|
487
|
+
# Without super or sub composites
|
488
|
+
cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
|
489
|
+
cascading_composite_array[ 0 ].should == nil
|
490
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
491
|
+
cascading_composite_array += :some_setting
|
492
|
+
cascading_composite_array.local_cascading_array.should == [ :some_setting ]
|
493
|
+
cascading_composite_array.should == [ :some_setting ]
|
494
|
+
cascading_composite_array.slice!( 0, 1 ).should == [ :some_setting ]
|
495
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
496
|
+
cascading_composite_array.should == [ ]
|
497
|
+
cascading_composite_array += :other_setting
|
498
|
+
cascading_composite_array.local_cascading_array.should == [ :other_setting ]
|
499
|
+
cascading_composite_array.should == [ :other_setting ]
|
500
|
+
|
501
|
+
# Super with a sub composite
|
502
|
+
sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
|
503
|
+
sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
|
504
|
+
sub_cascading_composite_array.should == [ :other_setting ]
|
505
|
+
sub_cascading_composite_array.local_cascading_array.should == [ ]
|
506
|
+
sub_cascading_composite_array += :yet_another_setting
|
507
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
508
|
+
sub_cascading_composite_array.should == [ :other_setting, :yet_another_setting ]
|
509
|
+
sub_cascading_composite_array.slice!( 0, 1 ).should == [ :other_setting ]
|
510
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
511
|
+
sub_cascading_composite_array.should == [ :yet_another_setting ]
|
512
|
+
cascading_composite_array.should == [ :other_setting ]
|
513
|
+
|
514
|
+
end
|
515
|
+
|
516
|
+
###########
|
517
|
+
# clear #
|
518
|
+
###########
|
519
|
+
|
520
|
+
it 'can clear, causing present elements to be excluded' do
|
521
|
+
|
522
|
+
|
523
|
+
module CascadingConfiguration::Array::CompositingArray::CCAMock09
|
524
|
+
include CascadingConfiguration::Variable
|
525
|
+
end
|
526
|
+
|
527
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock09A
|
528
|
+
include CascadingConfiguration::Array::CompositingArray::CCAMock09
|
529
|
+
end
|
530
|
+
module CascadingConfiguration::Array::CompositingArray::CIMock09B
|
531
|
+
include CascadingConfiguration::Array::CompositingArray::CIMock09A
|
532
|
+
end
|
533
|
+
|
534
|
+
ccv = CascadingConfiguration::Variable
|
535
|
+
ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock09
|
536
|
+
configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock09A
|
537
|
+
sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock09B
|
538
|
+
configuration_name = :some_configuration
|
539
|
+
|
540
|
+
# Without super or sub composites
|
541
|
+
cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
|
542
|
+
cascading_composite_array[ 0 ].should == nil
|
543
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
544
|
+
cascading_composite_array += :some_setting
|
545
|
+
cascading_composite_array.local_cascading_array.should == [ :some_setting ]
|
546
|
+
cascading_composite_array.should == [ :some_setting ]
|
547
|
+
cascading_composite_array.clear
|
548
|
+
cascading_composite_array.local_cascading_array.should == [ ]
|
549
|
+
cascading_composite_array.should == [ ]
|
550
|
+
cascading_composite_array += :other_setting
|
551
|
+
cascading_composite_array.local_cascading_array.should == [ :other_setting ]
|
552
|
+
cascading_composite_array.should == [ :other_setting ]
|
553
|
+
|
554
|
+
# Super with a sub composite
|
555
|
+
sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
|
556
|
+
sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
|
557
|
+
sub_cascading_composite_array.should == [ :other_setting ]
|
558
|
+
sub_cascading_composite_array.local_cascading_array.should == [ ]
|
559
|
+
sub_cascading_composite_array += :yet_another_setting
|
560
|
+
sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
|
561
|
+
sub_cascading_composite_array.should == [ :other_setting, :yet_another_setting ]
|
562
|
+
sub_cascading_composite_array.clear
|
563
|
+
sub_cascading_composite_array.local_cascading_array.should == [ ]
|
564
|
+
sub_cascading_composite_array.should == [ ]
|
565
|
+
cascading_composite_array.should == [ :other_setting ]
|
566
|
+
|
567
|
+
end
|
568
|
+
|
569
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cascading-configuration-array
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 4
|
8
|
-
- 1
|
9
|
-
version: 1.4.1
|
4
|
+
prerelease:
|
5
|
+
version: 1.5.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Asher
|
@@ -14,8 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
13
|
+
date: 2012-01-16 00:00:00 Z
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
16
|
name: module-cluster
|
@@ -25,8 +20,6 @@ dependencies:
|
|
25
20
|
requirements:
|
26
21
|
- - ">="
|
27
22
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
23
|
version: "0"
|
31
24
|
type: :runtime
|
32
25
|
version_requirements: *id001
|
@@ -38,8 +31,6 @@ dependencies:
|
|
38
31
|
requirements:
|
39
32
|
- - ">="
|
40
33
|
- !ruby/object:Gem::Version
|
41
|
-
segments:
|
42
|
-
- 0
|
43
34
|
version: "0"
|
44
35
|
type: :runtime
|
45
36
|
version_requirements: *id002
|
@@ -52,23 +43,18 @@ extensions: []
|
|
52
43
|
extra_rdoc_files: []
|
53
44
|
|
54
45
|
files:
|
55
|
-
- lib/cascading-configuration-array/CascadingConfiguration/
|
56
|
-
- lib/cascading-configuration-array/CascadingConfiguration/
|
57
|
-
- lib/cascading-configuration-array/CascadingConfiguration/Array/
|
58
|
-
- lib/cascading-configuration-array/CascadingConfiguration/Array/
|
46
|
+
- lib/cascading-configuration-array/_private_/CascadingConfiguration/Array/CompositingArray/LocalConfigurationArray.rb
|
47
|
+
- lib/cascading-configuration-array/_private_/CascadingConfiguration/Array/CompositingArray.rb
|
48
|
+
- lib/cascading-configuration-array/_private_/CascadingConfiguration/Array/Interface/GettersSetters.rb
|
49
|
+
- lib/cascading-configuration-array/_private_/CascadingConfiguration/Array/ModuleSupportMethods.rb
|
59
50
|
- lib/cascading-configuration-array/CascadingConfiguration/Array/Interface.rb
|
60
51
|
- lib/cascading-configuration-array/CascadingConfiguration/Array.rb
|
61
|
-
- lib/cascading-configuration-array/CascadingConfiguration/CompositingArray/Instance.rb
|
62
|
-
- lib/cascading-configuration-array/CascadingConfiguration/CompositingArray.rb
|
63
|
-
- lib/cascading-configuration-array/CascadingConfiguration/LocalConfigurationArray.rb
|
64
52
|
- lib/cascading-configuration-array.rb
|
65
|
-
- spec/CascadingConfiguration/Array/
|
53
|
+
- spec/_private_/CascadingConfiguration/Array/CompositingArray/LocalConfigurationArray_spec.rb
|
54
|
+
- spec/_private_/CascadingConfiguration/Array/CompositingArray_spec.rb
|
66
55
|
- spec/CascadingConfiguration/Array_spec.rb
|
67
|
-
- spec/CascadingConfiguration/CompositingArray_spec.rb
|
68
|
-
- spec/CascadingConfiguration/LocalConfigurationArray_spec.rb
|
69
56
|
- README.md
|
70
57
|
- README.rdoc
|
71
|
-
has_rdoc: true
|
72
58
|
homepage: http://rubygems.org/gems/cascading-configuration-array
|
73
59
|
licenses: []
|
74
60
|
|
@@ -82,21 +68,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
68
|
requirements:
|
83
69
|
- - ">="
|
84
70
|
- !ruby/object:Gem::Version
|
85
|
-
segments:
|
86
|
-
- 0
|
87
71
|
version: "0"
|
88
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
73
|
none: false
|
90
74
|
requirements:
|
91
75
|
- - ">="
|
92
76
|
- !ruby/object:Gem::Version
|
93
|
-
segments:
|
94
|
-
- 0
|
95
77
|
version: "0"
|
96
78
|
requirements: []
|
97
79
|
|
98
80
|
rubyforge_project: cascading-configuration-array
|
99
|
-
rubygems_version: 1.
|
81
|
+
rubygems_version: 1.8.10
|
100
82
|
signing_key:
|
101
83
|
specification_version: 3
|
102
84
|
summary: Support package for cascading-configuration.
|