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