cascading-configuration-array 1.6.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,319 +1,363 @@
1
1
 
2
- require_relative '../../../../lib/cascading-configuration-array.rb'
2
+ if $__cascading_configuration__spec__development
3
+ require_relative '../../../../lib/cascading-configuration-array.rb'
4
+ else
5
+ require 'cascading-configuration-array'
6
+ end
3
7
 
4
8
  describe CascadingConfiguration::Array::CompositingArray do
5
9
 
6
- #########
7
- # []= #
8
- #########
9
-
10
- it 'can add elements' do
10
+ before :all do
11
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
12
+ module CascadingConfiguration::Array::CompositingArray::MockA
13
+ # needed for ccv ancestor determination
18
14
  def self.some_configuration
19
15
  end
20
16
  end
21
- module CascadingConfiguration::Array::CompositingArray::CIMock01B
22
- include CascadingConfiguration::Array::CompositingArray::CIMock01A
17
+ module CascadingConfiguration::Array::CompositingArray::MockB
23
18
  end
19
+
20
+ @configuration_instance = CascadingConfiguration::Array::CompositingArray::MockA
21
+ @sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::MockB
24
22
 
25
- ccv = CascadingConfiguration::Variable
26
- ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock01
27
- configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock01A
28
- sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock01B
29
- configuration_name = :some_configuration
30
-
31
- # Without super or sub composites
32
- cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
33
- cascading_composite_array[ 0 ].should == nil
34
- cascading_composite_array.local_cascading_array.should == [ ]
35
- cascading_composite_array[ 0 ] = :some_setting
36
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
37
- cascading_composite_array.should == [ :some_setting ]
38
- cascading_composite_array[ 1 ] = :other_setting
39
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
40
- cascading_composite_array.should == [ :other_setting, :some_setting ]
41
-
42
- # Super with a sub composite
43
- sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
44
- sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
45
- sub_cascading_composite_array[ 0 ].should == :other_setting
46
- sub_cascading_composite_array[ 1 ].should == :some_setting
47
- sub_cascading_composite_array.should == [ :other_setting, :some_setting ]
48
- sub_cascading_composite_array.local_cascading_array.should == [ ]
49
- sub_cascading_composite_array[ 0 ] = :yet_another_setting
50
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
51
- sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
52
- sub_cascading_composite_array[ 0 ] = :other_setting
53
- sub_cascading_composite_array.local_cascading_array.should == [ :other_setting, :yet_another_setting ]
54
- sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
23
+ @configuration_name = :some_configuration
55
24
 
25
+ CascadingConfiguration::Variable.register_child_for_parent( @sub_configuration_instance,
26
+ @configuration_instance )
27
+
56
28
  end
29
+
30
+ ################
31
+ # initialize #
32
+ ################
33
+
34
+ it 'can add initialize with an ancestor, inheriting its values and linking to it as a child' do
57
35
 
58
- ########
59
- # << #
60
- ########
61
-
62
- it 'can add elements' do
36
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
63
37
 
64
- module CascadingConfiguration::Array::CompositingArray::CCAMock02
65
- include CascadingConfiguration::Variable
66
- end
38
+ cascading_composite_array.instance_variable_get( :@super_composite_array ).should == nil
39
+ cascading_composite_array.should == []
40
+ cascading_composite_array.push( :A, :B, :C, :D )
67
41
 
68
- module CascadingConfiguration::Array::CompositingArray::CIMock02A
69
- include CascadingConfiguration::Array::CompositingArray::CCAMock02
70
- def self.some_configuration
71
- end
72
- end
73
- module CascadingConfiguration::Array::CompositingArray::CIMock02B
74
- include CascadingConfiguration::Array::CompositingArray::CIMock02A
75
- end
76
-
77
- ccv = CascadingConfiguration::Variable
78
- ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock02
79
- configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock02A
80
- sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock02B
81
- configuration_name = :some_configuration
82
-
83
- # Without super or sub composites
84
- cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
85
- cascading_composite_array[ 0 ].should == nil
86
- cascading_composite_array.local_cascading_array.should == [ ]
87
- cascading_composite_array << :some_setting
88
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
89
- cascading_composite_array.should == [ :some_setting ]
90
- cascading_composite_array << :other_setting
91
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
92
- cascading_composite_array.should == [ :other_setting, :some_setting ]
93
-
94
- # Super with a sub composite
95
- sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
42
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
96
43
  sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
97
- sub_cascading_composite_array[ 0 ].should == :other_setting
98
- sub_cascading_composite_array[ 1 ].should == :some_setting
99
- sub_cascading_composite_array.should == [ :other_setting, :some_setting ]
100
- sub_cascading_composite_array.local_cascading_array.should == [ ]
101
- sub_cascading_composite_array << :yet_another_setting
102
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
103
- sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
104
- sub_cascading_composite_array << :other_setting
105
- sub_cascading_composite_array.local_cascading_array.should == [ :other_setting, :yet_another_setting ]
106
- sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
44
+ sub_cascading_composite_array.should == [ :A, :B, :C, :D ]
107
45
 
108
46
  end
47
+
48
+ ##################################################################################################
49
+ # private #####################################################################################
50
+ ##################################################################################################
51
+
52
+ ##################################################
53
+ # update_corresponding_index_for_parent_change #
54
+ ##################################################
55
+
56
+ it 'can update tracked parent indices for parent insert/delete' do
57
+
58
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
59
+ cascading_composite_array.push( :A, :B )
60
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
61
+
62
+ sub_cascading_composite_array.instance_eval do
63
+ @local_index_for_parent_index[ 0 ].should == 0
64
+ @local_index_for_parent_index[ 1 ].should == 1
65
+ @local_index_for_parent_index[ 2 ].should == nil
66
+ # insert 1 in parent before parent-1
67
+ update_corresponding_index_for_parent_change( 1, 1 )
68
+ @local_index_for_parent_index[ 0 ].should == 0
69
+ # no longer a parent-1 index (has to be set separately)
70
+ @local_index_for_parent_index[ 1 ].should == nil
71
+ # parent-1 is now parent-2
72
+ @local_index_for_parent_index[ 2 ].should == 2
73
+ @parent_and_interpolated_object_count.should == 3
74
+ end
109
75
 
110
- #######
111
- # + #
112
- #######
76
+ end
113
77
 
114
- it 'can add elements' do
78
+ #################################################
79
+ # update_corresponding_index_for_local_change #
80
+ #################################################
115
81
 
116
- module CascadingConfiguration::Array::CompositingArray::CCAMock03
117
- include CascadingConfiguration::Variable
118
- end
82
+ it 'can update tracked parent indices for local insert/delete' do
83
+
84
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
85
+ cascading_composite_array.push( :A, :B )
86
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
119
87
 
120
- module CascadingConfiguration::Array::CompositingArray::CIMock03A
121
- include CascadingConfiguration::Array::CompositingArray::CCAMock03
122
- def self.some_configuration
123
- end
88
+ sub_cascading_composite_array.instance_eval do
89
+ @local_index_for_parent_index[ 0 ].should == 0
90
+ @local_index_for_parent_index[ 1 ].should == 1
91
+ @local_index_for_parent_index[ 2 ].should == nil
92
+ # insert 1 before parent-1
93
+ update_corresponding_index_for_local_change( 1, 1 )
94
+ @local_index_for_parent_index[ 0 ].should == 0
95
+ # new index for parent-1 is 2
96
+ @local_index_for_parent_index[ 1 ].should == 2
97
+ @local_index_for_parent_index[ 2 ].should == nil
98
+ @parent_and_interpolated_object_count.should == 3
124
99
  end
125
- module CascadingConfiguration::Array::CompositingArray::CIMock03B
126
- include CascadingConfiguration::Array::CompositingArray::CIMock03A
100
+
101
+ end
102
+
103
+ ###########################################
104
+ # update_as_sub_array_for_parent_insert #
105
+ ###########################################
106
+
107
+ it 'can handle updating itself as a sub-array when told an insert has occurred in parent' do
108
+
109
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
110
+ cascading_composite_array.push( :A, :B )
111
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
112
+
113
+ sub_cascading_composite_array.instance_eval do
114
+ @local_index_for_parent_index[ 0 ].should == 0
115
+ @local_index_for_parent_index[ 1 ].should == 1
116
+ @local_index_for_parent_index[ 2 ].should == nil
117
+ # insert 1 before parent-1
118
+ update_as_sub_array_for_parent_insert( 1, :C )
119
+ @local_index_for_parent_index[ 0 ].should == 0
120
+ # new parent index parent-1 inserted for :C
121
+ @local_index_for_parent_index[ 1 ].should == 1
122
+ # new index for parent-1 is parent-2
123
+ @local_index_for_parent_index[ 2 ].should == 2
124
+ @parent_and_interpolated_object_count.should == 3
127
125
  end
128
126
 
129
- ccv = CascadingConfiguration::Variable
130
- ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock03
131
- configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock03A
132
- sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock03B
133
- configuration_name = :some_configuration
127
+ end
128
+
129
+ ########################################
130
+ # update_as_sub_array_for_parent_set #
131
+ ########################################
132
+
133
+ it 'can handle updating itself as a sub-array when told a set has occurred in parent' do
134
134
 
135
- # Without super or sub composites
136
- cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
137
- cascading_composite_array[ 0 ].should == nil
138
- cascading_composite_array.local_cascading_array.should == [ ]
139
- cascading_composite_array += :some_setting
140
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
141
- cascading_composite_array.should == [ :some_setting ]
142
- cascading_composite_array += :other_setting
143
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
144
- cascading_composite_array.should == [ :other_setting, :some_setting ]
145
-
146
- # Super with a sub composite
147
- sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
148
- sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
149
- sub_cascading_composite_array[ 0 ].should == :other_setting
150
- sub_cascading_composite_array[ 1 ].should == :some_setting
151
- sub_cascading_composite_array.should == [ :other_setting, :some_setting ]
152
- sub_cascading_composite_array.local_cascading_array.should == [ ]
153
- sub_cascading_composite_array += :yet_another_setting
154
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
155
- sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
156
- sub_cascading_composite_array += :other_setting
157
- sub_cascading_composite_array.local_cascading_array.should == [ :other_setting, :yet_another_setting ]
158
- sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
135
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
136
+ cascading_composite_array.push( :A, :B )
137
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
138
+
139
+ sub_cascading_composite_array.instance_eval do
140
+ @local_index_for_parent_index[ 0 ].should == 0
141
+ @local_index_for_parent_index[ 1 ].should == 1
142
+ @local_index_for_parent_index[ 2 ].should == nil
143
+ # set for parent-1
144
+ update_as_sub_array_for_parent_set( 1, :C )
145
+ @local_index_for_parent_index[ 0 ].should == 0
146
+ @local_index_for_parent_index[ 1 ].should == 1
147
+ @local_index_for_parent_index[ 2 ].should == nil
148
+ @parent_and_interpolated_object_count.should == 2
149
+ end
150
+
151
+ end
152
+
153
+ ###########################################
154
+ # update_as_sub_array_for_parent_delete #
155
+ ###########################################
159
156
 
157
+ it 'can handle updating itself as a sub-array when told a delete has occurred in parent' do
158
+
159
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
160
+ cascading_composite_array.push( :A, :B )
161
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
162
+
163
+ sub_cascading_composite_array.instance_eval do
164
+ @local_index_for_parent_index[ 0 ].should == 0
165
+ @local_index_for_parent_index[ 1 ].should == 1
166
+ @local_index_for_parent_index[ 2 ].should == nil
167
+ # delete parent-1
168
+ update_as_sub_array_for_parent_delete( 1 )
169
+ @local_index_for_parent_index[ 0 ].should == 0
170
+ @local_index_for_parent_index[ 1 ].should == 1
171
+ @local_index_for_parent_index[ 2 ].should == nil
172
+ @parent_and_interpolated_object_count.should == 1
173
+ end
174
+
160
175
  end
176
+
177
+ ##################################################################################################
178
+ # public ######################################################################################
179
+ ##################################################################################################
180
+
181
+ #########
182
+ # []= #
183
+ #########
161
184
 
185
+ it 'can add elements' do
186
+
187
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
188
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
189
+
190
+ cascading_composite_array[ 0 ] = :A
191
+ cascading_composite_array.should == [ :A ]
192
+ sub_cascading_composite_array.should == [ :A ]
193
+
194
+ cascading_composite_array[ 1 ] = :B
195
+ cascading_composite_array.should == [ :A, :B ]
196
+ sub_cascading_composite_array.should == [ :A, :B ]
197
+
198
+ sub_cascading_composite_array[ 0 ] = :C
199
+ cascading_composite_array.should == [ :A, :B ]
200
+ sub_cascading_composite_array.should == [ :C, :B ]
201
+
202
+ sub_cascading_composite_array[ 0 ] = :B
203
+ cascading_composite_array.should == [ :A, :B ]
204
+ sub_cascading_composite_array.should == [ :B, :B ]
205
+
206
+ sub_cascading_composite_array[ 2 ] = :C
207
+ cascading_composite_array.should == [ :A, :B ]
208
+ sub_cascading_composite_array.should == [ :B, :B, :C ]
209
+
210
+ cascading_composite_array[ 0 ] = :D
211
+ cascading_composite_array.should == [ :D, :B ]
212
+ sub_cascading_composite_array.should == [ :B, :B, :C ]
213
+
214
+ end
215
+
162
216
  ############
163
- # concat #
217
+ # insert #
164
218
  ############
219
+
220
+ it 'can insert elements' do
165
221
 
166
- it 'can add elements' do
222
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
223
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
167
224
 
168
- module CascadingConfiguration::Array::CompositingArray::CCAMock04
169
- include CascadingConfiguration::Variable
170
- end
171
-
172
- module CascadingConfiguration::Array::CompositingArray::CIMock04A
173
- include CascadingConfiguration::Array::CompositingArray::CCAMock04
174
- def self.some_configuration
175
- end
176
- end
177
- module CascadingConfiguration::Array::CompositingArray::CIMock04B
178
- include CascadingConfiguration::Array::CompositingArray::CIMock04A
179
- end
180
-
181
- ccv = CascadingConfiguration::Variable
182
- ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock04
183
- configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock04A
184
- sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock04B
185
- configuration_name = :some_configuration
186
-
187
- # Without super or sub composites
188
- cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
189
- cascading_composite_array[ 0 ].should == nil
190
- cascading_composite_array.local_cascading_array.should == [ ]
191
- cascading_composite_array.concat( [ :some_setting ] )
192
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
193
- cascading_composite_array.should == [ :some_setting ]
194
- cascading_composite_array.concat( :other_setting )
195
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
196
- cascading_composite_array.should == [ :other_setting, :some_setting ]
197
-
198
- # Super with a sub composite
199
- sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
200
- sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
201
- sub_cascading_composite_array[ 0 ].should == :other_setting
202
- sub_cascading_composite_array[ 1 ].should == :some_setting
203
- sub_cascading_composite_array.should == [ :other_setting, :some_setting ]
204
- sub_cascading_composite_array.local_cascading_array.should == [ ]
205
- sub_cascading_composite_array.concat( :yet_another_setting )
206
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
207
- sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
208
- sub_cascading_composite_array.concat( :other_setting )
209
- sub_cascading_composite_array.local_cascading_array.should == [ :other_setting, :yet_another_setting ]
210
- sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
225
+ cascading_composite_array.insert( 3, :D )
226
+ cascading_composite_array.should == [ nil, nil, nil, :D ]
227
+ sub_cascading_composite_array.should == [ nil, nil, nil, :D ]
228
+
229
+ cascading_composite_array.insert( 1, :B )
230
+ cascading_composite_array.should == [ nil, :B, nil, nil, :D ]
231
+ sub_cascading_composite_array.should == [ nil, :B, nil, nil, :D ]
232
+
233
+ cascading_composite_array.insert( 2, :C )
234
+ cascading_composite_array.should == [ nil, :B, :C, nil, nil, :D ]
235
+ sub_cascading_composite_array.should == [ nil, :B, :C, nil, nil, :D ]
236
+
237
+ sub_cascading_composite_array.insert( 0, :E )
238
+ cascading_composite_array.should == [ nil, :B, :C, nil, nil, :D ]
239
+ sub_cascading_composite_array.should == [ :E, nil, :B, :C, nil, nil, :D ]
240
+
241
+ sub_cascading_composite_array.insert( 4, :F )
242
+ cascading_composite_array.should == [ nil, :B, :C, nil, nil, :D ]
243
+ sub_cascading_composite_array.should == [ :E, nil, :B, :C, :F, nil, nil, :D ]
211
244
 
212
245
  end
213
246
 
214
247
  ##########
215
248
  # push #
249
+ # << #
216
250
  ##########
217
251
 
218
252
  it 'can add elements' do
219
253
 
220
- module CascadingConfiguration::Array::CompositingArray::CCAMock05
221
- include CascadingConfiguration::Variable
222
- end
223
-
224
- module CascadingConfiguration::Array::CompositingArray::CIMock05A
225
- include CascadingConfiguration::Array::CompositingArray::CCAMock05
226
- def self.some_configuration
227
- end
228
- end
229
- module CascadingConfiguration::Array::CompositingArray::CIMock05B
230
- include CascadingConfiguration::Array::CompositingArray::CIMock05A
231
- end
232
-
233
- ccv = CascadingConfiguration::Variable
234
- ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock05
235
- configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock05A
236
- sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock05B
237
- configuration_name = :some_configuration
238
-
239
- # Without super or sub composites
240
- cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
241
- cascading_composite_array[ 0 ].should == nil
242
- cascading_composite_array.local_cascading_array.should == [ ]
243
- cascading_composite_array.push( :some_setting )
244
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
245
- cascading_composite_array.should == [ :some_setting ]
246
- cascading_composite_array.push( :other_setting )
247
- cascading_composite_array.local_cascading_array.should == [ :other_setting, :some_setting ]
248
- cascading_composite_array.should == [ :other_setting, :some_setting ]
249
-
250
- # Super with a sub composite
251
- sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
252
- sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
253
- sub_cascading_composite_array[ 0 ].should == :other_setting
254
- sub_cascading_composite_array[ 1 ].should == :some_setting
255
- sub_cascading_composite_array.should == [ :other_setting, :some_setting ]
256
- sub_cascading_composite_array.local_cascading_array.should == [ ]
257
- sub_cascading_composite_array.push( :yet_another_setting )
258
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
259
- sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
260
- sub_cascading_composite_array.push( :other_setting )
261
- sub_cascading_composite_array.local_cascading_array.should == [ :other_setting, :yet_another_setting ]
262
- sub_cascading_composite_array.should == [ :other_setting, :some_setting, :yet_another_setting ]
263
-
254
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
255
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
256
+
257
+ cascading_composite_array << :A
258
+ cascading_composite_array.should == [ :A ]
259
+ sub_cascading_composite_array.should == [ :A ]
260
+
261
+ cascading_composite_array << :B
262
+ cascading_composite_array.should == [ :A, :B ]
263
+ sub_cascading_composite_array.should == [ :A, :B ]
264
+
265
+ sub_cascading_composite_array << :C
266
+ cascading_composite_array.should == [ :A, :B ]
267
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
268
+
269
+ sub_cascading_composite_array << :B
270
+ cascading_composite_array.should == [ :A, :B ]
271
+ sub_cascading_composite_array.should == [ :A, :B, :C, :B ]
272
+
264
273
  end
265
274
 
275
+ ############
276
+ # concat #
277
+ # + #
278
+ ############
279
+
280
+ it 'can add elements' do
281
+
282
+ # NOTE: this breaks + by causing it to modify the array like +=
283
+ # The alternative was worse.
284
+
285
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
286
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
287
+
288
+ cascading_composite_array.concat( [ :A ] )
289
+ cascading_composite_array.should == [ :A ]
290
+ sub_cascading_composite_array.should == [ :A ]
291
+
292
+ cascading_composite_array += [ :B ]
293
+ cascading_composite_array.should == [ :A, :B ]
294
+ sub_cascading_composite_array.should == [ :A, :B ]
295
+
296
+ sub_cascading_composite_array.concat( [ :C ] )
297
+ cascading_composite_array.should == [ :A, :B ]
298
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
299
+
300
+ sub_cascading_composite_array += [ :B ]
301
+ cascading_composite_array.should == [ :A, :B ]
302
+ sub_cascading_composite_array.should == [ :A, :B, :C, :B ]
303
+
304
+ end
305
+
306
+ ####################
307
+ # delete_objects #
308
+ ####################
309
+
310
+ it 'can delete multiple elements' do
311
+
312
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
313
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
314
+
315
+ cascading_composite_array += [ :A, :B ]
316
+ cascading_composite_array.should == [ :A, :B ]
317
+ sub_cascading_composite_array.should == [ :A, :B ]
318
+
319
+ cascading_composite_array.delete_objects( :A, :B )
320
+ cascading_composite_array.should == [ ]
321
+ sub_cascading_composite_array.should == [ ]
322
+
323
+ sub_cascading_composite_array += [ :B, :C, :D ]
324
+ cascading_composite_array.should == [ ]
325
+ sub_cascading_composite_array.should == [ :B, :C, :D ]
326
+
327
+ sub_cascading_composite_array.delete_objects( :C, :B )
328
+ cascading_composite_array.should == [ ]
329
+ sub_cascading_composite_array.should == [ :D ]
330
+
331
+ end
332
+
266
333
  #######
267
334
  # - #
268
335
  #######
269
336
 
270
337
  it 'can exclude elements' do
271
338
 
272
- module CascadingConfiguration::Array::CompositingArray::CCAMock06
273
- include CascadingConfiguration::Variable
274
- end
275
-
276
- module CascadingConfiguration::Array::CompositingArray::CIMock06A
277
- include CascadingConfiguration::Array::CompositingArray::CCAMock06
278
- def self.some_configuration
279
- end
280
- end
281
- module CascadingConfiguration::Array::CompositingArray::CIMock06B
282
- include CascadingConfiguration::Array::CompositingArray::CIMock06A
283
- end
284
-
285
- ccv = CascadingConfiguration::Variable
286
- ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock06
287
- configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock06A
288
- sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock06B
289
- configuration_name = :some_configuration
290
-
291
- # Without super or sub composites
292
- cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
293
- cascading_composite_array[ 0 ].should == nil
294
- cascading_composite_array.local_cascading_array.should == [ ]
295
- cascading_composite_array += :some_setting
296
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
297
- cascading_composite_array.should == [ :some_setting ]
298
- cascading_composite_array -= :some_setting
299
- cascading_composite_array.local_cascading_array.should == [ ]
339
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
340
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
341
+
342
+ cascading_composite_array.push( :A )
343
+ cascading_composite_array.should == [ :A ]
344
+ sub_cascading_composite_array.should == [ :A ]
345
+
346
+ cascading_composite_array -= [ :A ]
300
347
  cascading_composite_array.should == [ ]
301
- cascading_composite_array += :other_setting
302
- cascading_composite_array.local_cascading_array.should == [ :other_setting ]
303
- cascading_composite_array.should == [ :other_setting ]
348
+ sub_cascading_composite_array.should == [ ]
304
349
 
305
- # Super with a sub composite
306
- sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
307
- sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
308
- sub_cascading_composite_array.should == [ :other_setting ]
309
- sub_cascading_composite_array.local_cascading_array.should == [ ]
310
- sub_cascading_composite_array += :yet_another_setting
311
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
312
- sub_cascading_composite_array.should == [ :other_setting, :yet_another_setting ]
313
- sub_cascading_composite_array -= :other_setting
314
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
315
- sub_cascading_composite_array.should == [ :yet_another_setting ]
316
- cascading_composite_array.should == [ :other_setting ]
350
+ cascading_composite_array.push( :B )
351
+ cascading_composite_array.should == [ :B ]
352
+ sub_cascading_composite_array.should == [ :B ]
353
+
354
+ sub_cascading_composite_array.push( :C )
355
+ cascading_composite_array.should == [ :B ]
356
+ sub_cascading_composite_array.should == [ :B, :C ]
357
+
358
+ sub_cascading_composite_array -= [ :B ]
359
+ cascading_composite_array.should == [ :B ]
360
+ sub_cascading_composite_array.should == [ :C ]
317
361
 
318
362
  end
319
363
 
@@ -321,53 +365,533 @@ describe CascadingConfiguration::Array::CompositingArray do
321
365
  # delete #
322
366
  ############
323
367
 
324
- it 'can exclude elements' do
368
+ it 'can delete elements' do
325
369
 
326
- module CascadingConfiguration::Array::CompositingArray::CCAMock07
327
- include CascadingConfiguration::Variable
328
- end
370
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
371
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
372
+
373
+ cascading_composite_array.push( :A )
374
+ cascading_composite_array.should == [ :A ]
375
+ sub_cascading_composite_array.should == [ :A ]
376
+
377
+ cascading_composite_array.delete( :A )
378
+ cascading_composite_array.should == [ ]
379
+ sub_cascading_composite_array.should == [ ]
380
+
381
+ cascading_composite_array.push( :B )
382
+ cascading_composite_array.should == [ :B ]
383
+ sub_cascading_composite_array.should == [ :B ]
384
+
385
+ sub_cascading_composite_array.push( :C )
386
+ cascading_composite_array.should == [ :B ]
387
+ sub_cascading_composite_array.should == [ :B, :C ]
388
+
389
+ sub_cascading_composite_array.delete( :B )
390
+ cascading_composite_array.should == [ :B ]
391
+ sub_cascading_composite_array.should == [ :C ]
392
+
393
+ end
394
+
395
+ ###############
396
+ # delete_at #
397
+ ###############
398
+
399
+ it 'can delete by indexes' do
400
+
401
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
402
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
403
+
404
+ cascading_composite_array.push( :A )
405
+ cascading_composite_array.should == [ :A ]
406
+ sub_cascading_composite_array.should == [ :A ]
329
407
 
330
- module CascadingConfiguration::Array::CompositingArray::CIMock07A
331
- include CascadingConfiguration::Array::CompositingArray::CCAMock07
332
- def self.some_configuration
408
+ cascading_composite_array.delete_at( 0 )
409
+ cascading_composite_array.should == [ ]
410
+ sub_cascading_composite_array.should == [ ]
411
+
412
+ cascading_composite_array.push( :B )
413
+ cascading_composite_array.should == [ :B ]
414
+ sub_cascading_composite_array.should == [ :B ]
415
+
416
+ sub_cascading_composite_array.push( :C )
417
+ cascading_composite_array.should == [ :B ]
418
+ sub_cascading_composite_array.should == [ :B, :C ]
419
+
420
+ sub_cascading_composite_array.delete_at( 0 )
421
+ cascading_composite_array.should == [ :B ]
422
+ sub_cascading_composite_array.should == [ :C ]
423
+
424
+ end
425
+
426
+ #######################
427
+ # delete_at_indexes #
428
+ #######################
429
+
430
+ it 'can delete by indexes' do
431
+
432
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
433
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
434
+
435
+ cascading_composite_array.push( :A, :B, :C )
436
+ cascading_composite_array.should == [ :A, :B, :C ]
437
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
438
+
439
+ cascading_composite_array.delete_at_indexes( 0, 1 )
440
+ cascading_composite_array.should == [ :C ]
441
+ sub_cascading_composite_array.should == [ :C ]
442
+
443
+ sub_cascading_composite_array.push( :C, :B )
444
+ cascading_composite_array.should == [ :C ]
445
+ sub_cascading_composite_array.should == [ :C, :C, :B ]
446
+
447
+ sub_cascading_composite_array.delete_at_indexes( 0, 1, 2 )
448
+ cascading_composite_array.should == [ :C ]
449
+ sub_cascading_composite_array.should == [ ]
450
+
451
+ end
452
+
453
+ ###############
454
+ # delete_if #
455
+ ###############
456
+
457
+ it 'can delete by block' do
458
+
459
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
460
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
461
+
462
+ cascading_composite_array.push( :A, :B, :C )
463
+ cascading_composite_array.should == [ :A, :B, :C ]
464
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
465
+ cascading_composite_array.delete_if do |object|
466
+ object != :C
467
+ end
468
+ cascading_composite_array.should == [ :C ]
469
+ sub_cascading_composite_array.should == [ :C ]
470
+
471
+ sub_cascading_composite_array.push( :C, :B )
472
+ cascading_composite_array.should == [ :C ]
473
+ sub_cascading_composite_array.should == [ :C, :C, :B ]
474
+ sub_cascading_composite_array.delete_if do |object|
475
+ object != nil
476
+ end
477
+ sub_cascading_composite_array.should == [ ]
478
+ cascading_composite_array.should == [ :C ]
479
+
480
+ cascading_composite_array.delete_if.is_a?( Enumerator ).should == true
481
+
482
+ end
483
+
484
+ #############
485
+ # keep_if #
486
+ #############
487
+
488
+ it 'can keep by block' do
489
+
490
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
491
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
492
+
493
+ cascading_composite_array.push( :A, :B, :C )
494
+ cascading_composite_array.should == [ :A, :B, :C ]
495
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
496
+ cascading_composite_array.keep_if do |object|
497
+ object == :C
498
+ end
499
+ cascading_composite_array.should == [ :C ]
500
+ sub_cascading_composite_array.should == [ :C ]
501
+
502
+ sub_cascading_composite_array.push( :C, :B )
503
+ cascading_composite_array.should == [ :C ]
504
+ sub_cascading_composite_array.should == [ :C, :C, :B ]
505
+ sub_cascading_composite_array.keep_if do |object|
506
+ object == nil
507
+ end
508
+ cascading_composite_array.should == [ :C ]
509
+ sub_cascading_composite_array.should == [ ]
510
+
511
+ end
512
+
513
+ ##############
514
+ # compact! #
515
+ ##############
516
+
517
+ it 'can compact' do
518
+
519
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
520
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
521
+
522
+ cascading_composite_array.push( :A, nil, :B, nil, :C, nil )
523
+ cascading_composite_array.should == [ :A, nil, :B, nil, :C, nil ]
524
+ sub_cascading_composite_array.should == [ :A, nil, :B, nil, :C, nil ]
525
+ cascading_composite_array.compact!
526
+ cascading_composite_array.should == [ :A, :B, :C ]
527
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
528
+
529
+ sub_cascading_composite_array.push( nil, nil, :D )
530
+ cascading_composite_array.should == [ :A, :B, :C ]
531
+ sub_cascading_composite_array.should == [ :A, :B, :C, nil, nil, :D ]
532
+ sub_cascading_composite_array.compact!
533
+ cascading_composite_array.should == [ :A, :B, :C ]
534
+ sub_cascading_composite_array.should == [ :A, :B, :C, :D ]
535
+
536
+ end
537
+
538
+ ##############
539
+ # flatten! #
540
+ ##############
541
+
542
+ it 'can flatten' do
543
+
544
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
545
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
546
+
547
+ cascading_composite_array.push( :A, [ :F_A, :F_B ], :B, [ :F_C ], :C, [ :F_D ], [ :F_E ] )
548
+ cascading_composite_array.should == [ :A, [ :F_A, :F_B ], :B, [ :F_C ], :C, [ :F_D ], [ :F_E ] ]
549
+ sub_cascading_composite_array.should == [ :A, [ :F_A, :F_B ], :B, [ :F_C ], :C, [ :F_D ], [ :F_E ] ]
550
+ cascading_composite_array.flatten!
551
+ cascading_composite_array.should == [ :A, :F_A, :F_B, :B, :F_C, :C, :F_D, :F_E ]
552
+ sub_cascading_composite_array.should == [ :A, :F_A, :F_B, :B, :F_C, :C, :F_D, :F_E ]
553
+
554
+ sub_cascading_composite_array.push( [ :F_F, :F_G ], :D, [ :F_H ] )
555
+ cascading_composite_array.should == [ :A, :F_A, :F_B, :B, :F_C, :C, :F_D, :F_E ]
556
+ sub_cascading_composite_array.should == [ :A, :F_A, :F_B, :B, :F_C, :C, :F_D, :F_E, [ :F_F, :F_G ], :D, [ :F_H ] ]
557
+ sub_cascading_composite_array.flatten!
558
+ cascading_composite_array.should == [ :A, :F_A, :F_B, :B, :F_C, :C, :F_D, :F_E ]
559
+ sub_cascading_composite_array.should == [ :A, :F_A, :F_B, :B, :F_C, :C, :F_D, :F_E, :F_F, :F_G, :D, :F_H ]
560
+
561
+ end
562
+
563
+ #############
564
+ # reject! #
565
+ #############
566
+
567
+ it 'can reject' do
568
+
569
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
570
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
571
+
572
+ cascading_composite_array.push( :A, :B, :C )
573
+ cascading_composite_array.should == [ :A, :B, :C ]
574
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
575
+ cascading_composite_array.reject! do |object|
576
+ object != :C
577
+ end
578
+ cascading_composite_array.should == [ :C ]
579
+ sub_cascading_composite_array.should == [ :C ]
580
+
581
+ sub_cascading_composite_array.push( :C, :B )
582
+ cascading_composite_array.should == [ :C ]
583
+ sub_cascading_composite_array.should == [ :C, :C, :B ]
584
+ sub_cascading_composite_array.reject! do |object|
585
+ object != nil
586
+ end
587
+ sub_cascading_composite_array.should == [ ]
588
+ cascading_composite_array.should == [ :C ]
589
+
590
+ cascading_composite_array.reject!.is_a?( Enumerator ).should == true
591
+
592
+ end
593
+
594
+ #############
595
+ # replace #
596
+ #############
597
+
598
+ it 'can replace self' do
599
+
600
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
601
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
602
+
603
+ cascading_composite_array.push( :A, :B, :C )
604
+ cascading_composite_array.should == [ :A, :B, :C ]
605
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
606
+ cascading_composite_array.replace( [ :D, :E, :F ] )
607
+ cascading_composite_array.should == [ :D, :E, :F ]
608
+ sub_cascading_composite_array.should == [ :D, :E, :F ]
609
+
610
+ cascading_composite_array.should == [ :D, :E, :F ]
611
+ sub_cascading_composite_array.should == [ :D, :E, :F ]
612
+ sub_cascading_composite_array.replace( [ :G, :H, :I ] )
613
+ cascading_composite_array.should == [ :D, :E, :F ]
614
+ sub_cascading_composite_array.should == [ :G, :H, :I ]
615
+
616
+ end
617
+
618
+ ##############
619
+ # reverse! #
620
+ ##############
621
+
622
+ it 'can reverse self' do
623
+
624
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
625
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
626
+
627
+ cascading_composite_array.push( :A, :B, :C )
628
+ cascading_composite_array.should == [ :A, :B, :C ]
629
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
630
+ cascading_composite_array.reverse!
631
+ cascading_composite_array.should == [ :C, :B, :A ]
632
+ sub_cascading_composite_array.should == [ :C, :B, :A ]
633
+
634
+ cascading_composite_array.should == [ :C, :B, :A ]
635
+ sub_cascading_composite_array.should == [ :C, :B, :A ]
636
+ sub_cascading_composite_array.reverse!
637
+ cascading_composite_array.should == [ :C, :B, :A ]
638
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
639
+
640
+ end
641
+
642
+ #############
643
+ # rotate! #
644
+ #############
645
+
646
+ it 'can rotate self' do
647
+
648
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
649
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
650
+
651
+ cascading_composite_array.push( :A, :B, :C )
652
+ cascading_composite_array.should == [ :A, :B, :C ]
653
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
654
+
655
+ cascading_composite_array.rotate!
656
+ cascading_composite_array.should == [ :B, :C, :A ]
657
+ sub_cascading_composite_array.should == [ :B, :C, :A ]
658
+
659
+ cascading_composite_array.rotate!( -1 )
660
+ cascading_composite_array.should == [ :A, :B, :C ]
661
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
662
+
663
+ sub_cascading_composite_array.rotate!( 2 )
664
+ cascading_composite_array.should == [ :A, :B, :C ]
665
+ sub_cascading_composite_array.should == [ :C, :A, :B ]
666
+
667
+ end
668
+
669
+ #############
670
+ # select! #
671
+ #############
672
+
673
+ it 'can keep by select' do
674
+
675
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
676
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
677
+
678
+ cascading_composite_array.push( :A, :B, :C )
679
+ cascading_composite_array.should == [ :A, :B, :C ]
680
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
681
+ cascading_composite_array.select! do |object|
682
+ object == :C
683
+ end
684
+ cascading_composite_array.should == [ :C ]
685
+ sub_cascading_composite_array.should == [ :C ]
686
+
687
+ sub_cascading_composite_array.push( :C, :B )
688
+ cascading_composite_array.should == [ :C ]
689
+ sub_cascading_composite_array.should == [ :C, :C, :B ]
690
+ sub_cascading_composite_array.select! do |object|
691
+ object == nil
692
+ end
693
+ cascading_composite_array.should == [ :C ]
694
+ sub_cascading_composite_array.should == [ ]
695
+
696
+ cascading_composite_array.select!.is_a?( Enumerator ).should == true
697
+
698
+ end
699
+
700
+ ##############
701
+ # shuffle! #
702
+ ##############
703
+
704
+ it 'can shuffle self' do
705
+
706
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
707
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
708
+
709
+ cascading_composite_array.push( :A, :B, :C )
710
+ cascading_composite_array.should == [ :A, :B, :C ]
711
+ sub_cascading_composite_array.should == cascading_composite_array
712
+
713
+ prior_version = cascading_composite_array.dup
714
+ attempts = [ ]
715
+ 50.times do
716
+ cascading_composite_array.shuffle!
717
+ attempts.push( cascading_composite_array == prior_version )
718
+ prior_version = cascading_composite_array.dup
719
+ end
720
+ attempts_correct = attempts.select { |member| member == false }.count
721
+ ( attempts_correct >= 10 ).should == true
722
+ sub_cascading_composite_array.should == cascading_composite_array
723
+ first_shuffle_version = cascading_composite_array
724
+
725
+ cascading_composite_array.should == first_shuffle_version
726
+ attempts = [ ]
727
+ 50.times do
728
+ sub_cascading_composite_array.shuffle!
729
+ attempts.push( sub_cascading_composite_array == cascading_composite_array )
730
+ prior_version = cascading_composite_array.dup
731
+ end
732
+ attempts_correct = attempts.select { |member| member == false }.count
733
+ ( attempts_correct >= 10 ).should == true
734
+
735
+ end
736
+
737
+ ##############
738
+ # collect! #
739
+ # map! #
740
+ ##############
741
+
742
+ it 'can replace by collect/map' do
743
+
744
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
745
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
746
+
747
+ cascading_composite_array.push( :A, :B, :C )
748
+ cascading_composite_array.should == [ :A, :B, :C ]
749
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
750
+ cascading_composite_array.collect! do |object|
751
+ :C
752
+ end
753
+ cascading_composite_array.should == [ :C, :C, :C ]
754
+ sub_cascading_composite_array.should == [ :C, :C, :C ]
755
+
756
+ sub_cascading_composite_array.collect! do |object|
757
+ :A
758
+ end
759
+ cascading_composite_array.should == [ :C, :C, :C ]
760
+ sub_cascading_composite_array.should == [ :A, :A, :A ]
761
+
762
+ cascading_composite_array.collect!.is_a?( Enumerator ).should == true
763
+
764
+ end
765
+
766
+ ###########
767
+ # sort! #
768
+ ###########
769
+
770
+ it 'can replace by collect/map' do
771
+
772
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
773
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
774
+
775
+ cascading_composite_array.push( :A, :B, :C )
776
+ cascading_composite_array.should == [ :A, :B, :C ]
777
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
778
+ cascading_composite_array.sort! do |a, b|
779
+ if a < b
780
+ 1
781
+ elsif a > b
782
+ -1
783
+ elsif a == b
784
+ 0
333
785
  end
334
786
  end
335
- module CascadingConfiguration::Array::CompositingArray::CIMock07B
336
- include CascadingConfiguration::Array::CompositingArray::CIMock07A
787
+ cascading_composite_array.should == [ :C, :B, :A ]
788
+ sub_cascading_composite_array.should == [ :C, :B, :A ]
789
+
790
+ sub_cascading_composite_array.sort! do |a, b|
791
+ if a < b
792
+ -1
793
+ elsif a > b
794
+ 1
795
+ elsif a == b
796
+ 0
797
+ end
337
798
  end
338
-
339
- ccv = CascadingConfiguration::Variable
340
- ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock07
341
- configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock07A
342
- sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock07B
343
- configuration_name = :some_configuration
344
-
345
- # Without super or sub composites
346
- cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
347
- cascading_composite_array[ 0 ].should == nil
348
- cascading_composite_array.local_cascading_array.should == [ ]
349
- cascading_composite_array += :some_setting
350
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
351
- cascading_composite_array.should == [ :some_setting ]
352
- cascading_composite_array.delete( :some_setting )
353
- cascading_composite_array.local_cascading_array.should == [ ]
354
- cascading_composite_array.should == [ ]
355
- cascading_composite_array += :other_setting
356
- cascading_composite_array.local_cascading_array.should == [ :other_setting ]
357
- cascading_composite_array.should == [ :other_setting ]
799
+ cascading_composite_array.should == [ :C, :B, :A ]
800
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
358
801
 
359
- # Super with a sub composite
360
- sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
361
- sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
362
- sub_cascading_composite_array.should == [ :other_setting ]
363
- sub_cascading_composite_array.local_cascading_array.should == [ ]
364
- sub_cascading_composite_array += :yet_another_setting
365
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
366
- sub_cascading_composite_array.should == [ :other_setting, :yet_another_setting ]
367
- sub_cascading_composite_array.delete( :other_setting )
368
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
369
- sub_cascading_composite_array.should == [ :yet_another_setting ]
370
- cascading_composite_array.should == [ :other_setting ]
802
+ cascading_composite_array.sort!
803
+ cascading_composite_array.should == [ :A, :B, :C ]
804
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
805
+
806
+ end
807
+
808
+ ##############
809
+ # sort_by! #
810
+ ##############
811
+
812
+ it 'can replace by collect/map' do
813
+
814
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
815
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
816
+
817
+ cascading_composite_array.push( :A, :B, :C )
818
+ cascading_composite_array.should == [ :A, :B, :C ]
819
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
820
+ cascading_composite_array.sort_by! do |object|
821
+ case object
822
+ when :A
823
+ :B
824
+ when :B
825
+ :A
826
+ when :C
827
+ :C
828
+ end
829
+ end
830
+ cascading_composite_array.should == [ :B, :A, :C ]
831
+ sub_cascading_composite_array.should == [ :B, :A, :C ]
832
+
833
+ sub_cascading_composite_array.sort_by! do |object|
834
+ case object
835
+ when :A
836
+ :C
837
+ when :B
838
+ :B
839
+ when :C
840
+ :A
841
+ end
842
+ end
843
+ cascading_composite_array.should == [ :B, :A, :C ]
844
+ sub_cascading_composite_array.should == [ :C, :B, :A ]
845
+
846
+ cascading_composite_array.sort_by!.is_a?( Enumerator ).should == true
847
+
848
+ end
849
+
850
+ ###########
851
+ # uniq! #
852
+ ###########
853
+
854
+ it 'can remove non-unique elements' do
855
+
856
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
857
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
858
+
859
+ cascading_composite_array.push( :A, :B, :C, :C, :C, :B, :A )
860
+ cascading_composite_array.should == [ :A, :B, :C, :C, :C, :B, :A ]
861
+ sub_cascading_composite_array.should == [ :A, :B, :C, :C, :C, :B, :A ]
862
+ cascading_composite_array.uniq!
863
+ cascading_composite_array.should == [ :A, :B, :C ]
864
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
865
+
866
+ sub_cascading_composite_array.push( :C, :B )
867
+ cascading_composite_array.should == [ :A, :B, :C ]
868
+ sub_cascading_composite_array.should == [ :A, :B, :C, :C, :B ]
869
+ sub_cascading_composite_array.uniq!
870
+ cascading_composite_array.should == [ :A, :B, :C ]
871
+ sub_cascading_composite_array.should == [ :A, :B, :C ]
872
+
873
+ end
874
+
875
+ #############
876
+ # unshift #
877
+ #############
878
+
879
+ it 'can unshift onto the first element' do
880
+
881
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
882
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
883
+
884
+ cascading_composite_array += :A
885
+ cascading_composite_array.should == [ :A ]
886
+ sub_cascading_composite_array.should == [ :A ]
887
+
888
+ cascading_composite_array.unshift( :B )
889
+ cascading_composite_array.should == [ :B, :A ]
890
+ sub_cascading_composite_array.should == [ :B, :A ]
891
+
892
+ sub_cascading_composite_array.unshift( :C )
893
+ cascading_composite_array.should == [ :B, :A ]
894
+ sub_cascading_composite_array.should == [ :C, :B, :A ]
371
895
 
372
896
  end
373
897
 
@@ -377,51 +901,27 @@ describe CascadingConfiguration::Array::CompositingArray do
377
901
 
378
902
  it 'can pop the final element' do
379
903
 
380
- module CascadingConfiguration::Array::CompositingArray::CCAMock08
381
- include CascadingConfiguration::Variable
382
- end
383
-
384
- module CascadingConfiguration::Array::CompositingArray::CIMock08A
385
- include CascadingConfiguration::Array::CompositingArray::CCAMock08
386
- def self.some_configuration
387
- end
388
- end
389
- module CascadingConfiguration::Array::CompositingArray::CIMock08B
390
- include CascadingConfiguration::Array::CompositingArray::CIMock08A
391
- end
392
-
393
- ccv = CascadingConfiguration::Variable
394
- ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock08
395
- configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock08A
396
- sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock08B
397
- configuration_name = :some_configuration
398
-
399
- # Without super or sub composites
400
- cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
401
- cascading_composite_array[ 0 ].should == nil
402
- cascading_composite_array.local_cascading_array.should == [ ]
403
- cascading_composite_array += :some_setting
404
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
405
- cascading_composite_array.should == [ :some_setting ]
406
- cascading_composite_array.pop.should == :some_setting
407
- cascading_composite_array.local_cascading_array.should == [ ]
904
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
905
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
906
+
907
+ cascading_composite_array += :A
908
+ cascading_composite_array.should == [ :A ]
909
+ sub_cascading_composite_array.should == [ :A ]
910
+
911
+ cascading_composite_array.pop.should == :A
408
912
  cascading_composite_array.should == [ ]
409
- cascading_composite_array += :other_setting
410
- cascading_composite_array.local_cascading_array.should == [ :other_setting ]
411
- cascading_composite_array.should == [ :other_setting ]
913
+ sub_cascading_composite_array.should == [ ]
412
914
 
413
- # Super with a sub composite
414
- sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
415
- sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
416
- sub_cascading_composite_array.should == [ :other_setting ]
417
- sub_cascading_composite_array.local_cascading_array.should == [ ]
418
- sub_cascading_composite_array += :yet_another_setting
419
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
420
- sub_cascading_composite_array.should == [ :other_setting, :yet_another_setting ]
421
- sub_cascading_composite_array.pop.should == :yet_another_setting
422
- sub_cascading_composite_array.local_cascading_array.should == []
423
- sub_cascading_composite_array.should == [ :other_setting ]
424
- cascading_composite_array.should == [ :other_setting ]
915
+ cascading_composite_array += :B
916
+ cascading_composite_array.should == [ :B ]
917
+ sub_cascading_composite_array.should == [ :B ]
918
+
919
+ sub_cascading_composite_array += :C
920
+ cascading_composite_array.should == [ :B ]
921
+ sub_cascading_composite_array.should == [ :B, :C ]
922
+ sub_cascading_composite_array.pop.should == :C
923
+ cascading_composite_array.should == [ :B ]
924
+ sub_cascading_composite_array.should == [ :B ]
425
925
 
426
926
  end
427
927
 
@@ -431,51 +931,27 @@ describe CascadingConfiguration::Array::CompositingArray do
431
931
 
432
932
  it 'can shift the first element' do
433
933
 
434
- module CascadingConfiguration::Array::CompositingArray::CCAMock09
435
- include CascadingConfiguration::Variable
436
- end
437
-
438
- module CascadingConfiguration::Array::CompositingArray::CIMock09A
439
- include CascadingConfiguration::Array::CompositingArray::CCAMock09
440
- def self.some_configuration
441
- end
442
- end
443
- module CascadingConfiguration::Array::CompositingArray::CIMock09B
444
- include CascadingConfiguration::Array::CompositingArray::CIMock09A
445
- end
446
-
447
- ccv = CascadingConfiguration::Variable
448
- ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock09
449
- configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock09A
450
- sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock09B
451
- configuration_name = :some_configuration
452
-
453
- # Without super or sub composites
454
- cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
455
- cascading_composite_array[ 0 ].should == nil
456
- cascading_composite_array.local_cascading_array.should == [ ]
457
- cascading_composite_array += :some_setting
458
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
459
- cascading_composite_array.should == [ :some_setting ]
460
- cascading_composite_array.shift.should == :some_setting
461
- cascading_composite_array.local_cascading_array.should == [ ]
934
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
935
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
936
+
937
+ cascading_composite_array += :A
938
+ cascading_composite_array.should == [ :A ]
939
+ sub_cascading_composite_array.should == [ :A ]
940
+
941
+ cascading_composite_array.shift.should == :A
462
942
  cascading_composite_array.should == [ ]
463
- cascading_composite_array += :other_setting
464
- cascading_composite_array.local_cascading_array.should == [ :other_setting ]
465
- cascading_composite_array.should == [ :other_setting ]
943
+ sub_cascading_composite_array.should == [ ]
466
944
 
467
- # Super with a sub composite
468
- sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
469
- sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
470
- sub_cascading_composite_array.should == [ :other_setting ]
471
- sub_cascading_composite_array.local_cascading_array.should == [ ]
472
- sub_cascading_composite_array += :yet_another_setting
473
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
474
- sub_cascading_composite_array.should == [ :other_setting, :yet_another_setting ]
475
- sub_cascading_composite_array.shift.should == :other_setting
476
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
477
- sub_cascading_composite_array.should == [ :yet_another_setting ]
478
- cascading_composite_array.should == [ :other_setting ]
945
+ cascading_composite_array += :B
946
+ cascading_composite_array.should == [ :B ]
947
+ sub_cascading_composite_array.should == [ :B ]
948
+
949
+ sub_cascading_composite_array += :C
950
+ cascading_composite_array.should == [ :B ]
951
+ sub_cascading_composite_array.should == [ :B, :C ]
952
+ sub_cascading_composite_array.shift.should == :B
953
+ cascading_composite_array.should == [ :B ]
954
+ sub_cascading_composite_array.should == [ :C ]
479
955
 
480
956
  end
481
957
 
@@ -485,51 +961,28 @@ describe CascadingConfiguration::Array::CompositingArray do
485
961
 
486
962
  it 'can slice elements' do
487
963
 
488
- module CascadingConfiguration::Array::CompositingArray::CCAMock10
489
- include CascadingConfiguration::Variable
490
- end
491
-
492
- module CascadingConfiguration::Array::CompositingArray::CIMock10A
493
- include CascadingConfiguration::Array::CompositingArray::CCAMock10
494
- def self.some_configuration
495
- end
496
- end
497
- module CascadingConfiguration::Array::CompositingArray::CIMock10B
498
- include CascadingConfiguration::Array::CompositingArray::CIMock10A
499
- end
500
-
501
- ccv = CascadingConfiguration::Variable
502
- ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock10
503
- configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock10A
504
- sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock10B
505
- configuration_name = :some_configuration
506
-
507
- # Without super or sub composites
508
- cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
509
- cascading_composite_array[ 0 ].should == nil
510
- cascading_composite_array.local_cascading_array.should == [ ]
511
- cascading_composite_array += :some_setting
512
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
513
- cascading_composite_array.should == [ :some_setting ]
514
- cascading_composite_array.slice!( 0, 1 ).should == [ :some_setting ]
515
- cascading_composite_array.local_cascading_array.should == [ ]
964
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
965
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
966
+
967
+ cascading_composite_array += :A
968
+ cascading_composite_array.should == [ :A ]
969
+ sub_cascading_composite_array.should == [ :A ]
970
+
971
+ cascading_composite_array.slice!( 0, 1 ).should == [ :A ]
516
972
  cascading_composite_array.should == [ ]
517
- cascading_composite_array += :other_setting
518
- cascading_composite_array.local_cascading_array.should == [ :other_setting ]
519
- cascading_composite_array.should == [ :other_setting ]
973
+ sub_cascading_composite_array.should == [ ]
520
974
 
521
- # Super with a sub composite
522
- sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
523
- sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
524
- sub_cascading_composite_array.should == [ :other_setting ]
525
- sub_cascading_composite_array.local_cascading_array.should == [ ]
526
- sub_cascading_composite_array += :yet_another_setting
527
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
528
- sub_cascading_composite_array.should == [ :other_setting, :yet_another_setting ]
529
- sub_cascading_composite_array.slice!( 0, 1 ).should == [ :other_setting ]
530
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
531
- sub_cascading_composite_array.should == [ :yet_another_setting ]
532
- cascading_composite_array.should == [ :other_setting ]
975
+ cascading_composite_array += :B
976
+ cascading_composite_array.should == [ :B ]
977
+ sub_cascading_composite_array.should == [ :B ]
978
+
979
+ sub_cascading_composite_array += :C
980
+ cascading_composite_array.should == [ :B ]
981
+ sub_cascading_composite_array.should == [ :B, :C ]
982
+
983
+ sub_cascading_composite_array.slice!( 0, 1 ).should == [ :B ]
984
+ cascading_composite_array.should == [ :B ]
985
+ sub_cascading_composite_array.should == [ :C ]
533
986
 
534
987
  end
535
988
 
@@ -539,52 +992,28 @@ describe CascadingConfiguration::Array::CompositingArray do
539
992
 
540
993
  it 'can clear, causing present elements to be excluded' do
541
994
 
995
+ cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @configuration_instance, @configuration_name )
996
+ sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( @sub_configuration_instance, @configuration_name )
997
+
998
+ cascading_composite_array += :A
999
+ cascading_composite_array.should == [ :A ]
1000
+ sub_cascading_composite_array.should == [ :A ]
542
1001
 
543
- module CascadingConfiguration::Array::CompositingArray::CCAMock11
544
- include CascadingConfiguration::Variable
545
- end
546
-
547
- module CascadingConfiguration::Array::CompositingArray::CIMock11A
548
- include CascadingConfiguration::Array::CompositingArray::CCAMock11
549
- def self.some_configuration
550
- end
551
- end
552
- module CascadingConfiguration::Array::CompositingArray::CIMock11B
553
- include CascadingConfiguration::Array::CompositingArray::CIMock11A
554
- end
555
-
556
- ccv = CascadingConfiguration::Variable
557
- ccm_array = CascadingConfiguration::Array::CompositingArray::CCAMock11
558
- configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock11A
559
- sub_configuration_instance = CascadingConfiguration::Array::CompositingArray::CIMock11B
560
- configuration_name = :some_configuration
561
-
562
- # Without super or sub composites
563
- cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( configuration_instance, configuration_name )
564
- cascading_composite_array[ 0 ].should == nil
565
- cascading_composite_array.local_cascading_array.should == [ ]
566
- cascading_composite_array += :some_setting
567
- cascading_composite_array.local_cascading_array.should == [ :some_setting ]
568
- cascading_composite_array.should == [ :some_setting ]
569
1002
  cascading_composite_array.clear
570
- cascading_composite_array.local_cascading_array.should == [ ]
571
1003
  cascading_composite_array.should == [ ]
572
- cascading_composite_array += :other_setting
573
- cascading_composite_array.local_cascading_array.should == [ :other_setting ]
574
- cascading_composite_array.should == [ :other_setting ]
1004
+ sub_cascading_composite_array.should == [ ]
1005
+
1006
+ cascading_composite_array += :B
1007
+ cascading_composite_array.should == [ :B ]
1008
+ sub_cascading_composite_array.should == [ :B ]
1009
+
1010
+ sub_cascading_composite_array += :C
1011
+ cascading_composite_array.should == [ :B ]
1012
+ sub_cascading_composite_array.should == [ :B, :C ]
575
1013
 
576
- # Super with a sub composite
577
- sub_cascading_composite_array = CascadingConfiguration::Array::CompositingArray.new( sub_configuration_instance, configuration_name )
578
- sub_cascading_composite_array.instance_variable_get( :@super_composite_array ).should == cascading_composite_array
579
- sub_cascading_composite_array.should == [ :other_setting ]
580
- sub_cascading_composite_array.local_cascading_array.should == [ ]
581
- sub_cascading_composite_array += :yet_another_setting
582
- sub_cascading_composite_array.local_cascading_array.should == [ :yet_another_setting ]
583
- sub_cascading_composite_array.should == [ :other_setting, :yet_another_setting ]
584
1014
  sub_cascading_composite_array.clear
585
- sub_cascading_composite_array.local_cascading_array.should == [ ]
1015
+ cascading_composite_array.should == [ :B ]
586
1016
  sub_cascading_composite_array.should == [ ]
587
- cascading_composite_array.should == [ :other_setting ]
588
1017
 
589
1018
  end
590
1019