cascading-configuration-array-sorted-unique 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,224 @@
1
+
2
+ module ::CascadingConfiguration::Array::Sorted::Unique::Interface::GettersSetters
3
+
4
+ #################################################
5
+ # define_cascading_sorted_unique_array_setter #
6
+ #################################################
7
+
8
+ def define_cascading_sorted_unique_array_setter( configuration_name )
9
+
10
+ configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
11
+
12
+ array_setter_proc = Proc.new do |array|
13
+
14
+ return ::CascadingConfiguration::Array::Sorted::Unique.
15
+ set_composite_sorted_unique_array( self,
16
+ configuration_name,
17
+ array )
18
+
19
+ end
20
+
21
+ ::CascadingConfiguration::Variable.define_module_method( self,
22
+ configuration_setter_name,
23
+ & array_setter_proc )
24
+
25
+ ::CascadingConfiguration::Variable.
26
+ define_instance_method_if_support_exists( self,
27
+ configuration_setter_name,
28
+ & array_setter_proc )
29
+
30
+ end
31
+
32
+ #################################################
33
+ # define_cascading_sorted_unique_array_getter #
34
+ #################################################
35
+
36
+ def define_cascading_sorted_unique_array_getter( configuration_name )
37
+
38
+ configuration_getter_name = configuration_name
39
+
40
+ array_getter_proc = Proc.new do
41
+
42
+ return ::CascadingConfiguration::Array::Sorted::Unique.
43
+ composite_sorted_unique_array( self, configuration_name )
44
+
45
+ end
46
+
47
+ ::CascadingConfiguration::Variable.define_module_method( self,
48
+ configuration_getter_name,
49
+ & array_getter_proc )
50
+
51
+ ::CascadingConfiguration::Variable.
52
+ define_instance_method_if_support_exists( self,
53
+ configuration_getter_name,
54
+ & array_getter_proc )
55
+
56
+ end
57
+
58
+ ###########################################################
59
+ # define_class_configuration_sorted_unique_array_setter #
60
+ ###########################################################
61
+
62
+ def define_class_configuration_sorted_unique_array_setter( configuration_name )
63
+
64
+ configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
65
+
66
+ ::CascadingConfiguration::Variable.define_module_method( self,
67
+ configuration_setter_name ) do |array|
68
+
69
+ return ::CascadingConfiguration::Array::Sorted::Unique.
70
+ set_composite_sorted_unique_array( self,
71
+ configuration_name,
72
+ array )
73
+
74
+ end
75
+
76
+ end
77
+
78
+ ###########################################################
79
+ # define_class_configuration_sorted_unique_array_getter #
80
+ ###########################################################
81
+
82
+ def define_class_configuration_sorted_unique_array_getter( configuration_name )
83
+
84
+ configuration_getter_name = configuration_name
85
+
86
+ ::CascadingConfiguration::Variable.define_module_method( self, configuration_getter_name ) do
87
+
88
+ return ::CascadingConfiguration::Array::Sorted::Unique.
89
+ composite_sorted_unique_array( self, configuration_name )
90
+
91
+ end
92
+
93
+ end
94
+
95
+ ###########################################################
96
+ # define_local_configuration_sorted_unique_array_setter #
97
+ ###########################################################
98
+
99
+ def define_local_configuration_sorted_unique_array_setter( configuration_name )
100
+
101
+ configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
102
+
103
+ local_setter_proc = Proc.new do |array|
104
+
105
+ return ::CascadingConfiguration::Array::Sorted::Unique.
106
+ set_composite_sorted_unique_array( self,
107
+ configuration_name,
108
+ array )
109
+
110
+ end
111
+
112
+ ::CascadingConfiguration::Variable.define_local_instance_method( self,
113
+ configuration_setter_name,
114
+ & local_setter_proc )
115
+
116
+ ::CascadingConfiguration::Variable.
117
+ define_instance_method_if_support_exists( self,
118
+ configuration_setter_name,
119
+ & local_setter_proc )
120
+
121
+ end
122
+
123
+ ###########################################################
124
+ # define_local_configuration_sorted_unique_array_getter #
125
+ ###########################################################
126
+
127
+ def define_local_configuration_sorted_unique_array_getter( configuration_name )
128
+
129
+ configuration_getter_name = configuration_name
130
+
131
+ local_getter_proc = Proc.new do
132
+
133
+ return ::CascadingConfiguration::Array::Sorted::Unique.
134
+ composite_sorted_unique_array( self, configuration_name )
135
+
136
+ end
137
+
138
+ ::CascadingConfiguration::Variable.define_local_instance_method( self,
139
+ configuration_getter_name,
140
+ & local_getter_proc )
141
+
142
+ ::CascadingConfiguration::Variable.
143
+ define_instance_method_if_support_exists( self,
144
+ configuration_getter_name,
145
+ & local_getter_proc )
146
+
147
+ end
148
+
149
+ ##############################################################
150
+ # define_instance_configuration_sorted_unique_array_setter #
151
+ ##############################################################
152
+
153
+ def define_instance_configuration_sorted_unique_array_setter( configuration_name )
154
+
155
+ configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
156
+
157
+ ::CascadingConfiguration::Variable.
158
+ define_instance_method( self, configuration_setter_name ) do |array|
159
+
160
+ return ::CascadingConfiguration::Array::Sorted::Unique.
161
+ set_composite_sorted_unique_array( self,
162
+ configuration_name,
163
+ array )
164
+
165
+ end
166
+
167
+ end
168
+
169
+ ##############################################################
170
+ # define_instance_configuration_sorted_unique_array_getter #
171
+ ##############################################################
172
+
173
+ def define_instance_configuration_sorted_unique_array_getter( configuration_name )
174
+
175
+ configuration_getter_name = configuration_name
176
+
177
+ ::CascadingConfiguration::Variable.define_instance_method( self, configuration_getter_name ) do
178
+
179
+ return ::CascadingConfiguration::Array::Sorted::Unique.
180
+ composite_sorted_unique_array( self, configuration_name )
181
+
182
+ end
183
+
184
+ end
185
+
186
+ ############################################################
187
+ # define_object_configuration_sorted_unique_array_setter #
188
+ ############################################################
189
+
190
+ def define_object_configuration_sorted_unique_array_setter( configuration_name )
191
+
192
+ configuration_setter_name = ( configuration_name.to_s + '=' ).to_sym
193
+
194
+ ::CascadingConfiguration::Variable.
195
+ define_local_instance_method( self, configuration_setter_name ) do |array|
196
+
197
+ return ::CascadingConfiguration::Array::Sorted::Unique.
198
+ set_composite_sorted_unique_array( self,
199
+ configuration_name,
200
+ array )
201
+
202
+ end
203
+
204
+ end
205
+
206
+ ############################################################
207
+ # define_object_configuration_sorted_unique_array_getter #
208
+ ############################################################
209
+
210
+ def define_object_configuration_sorted_unique_array_getter( configuration_name )
211
+
212
+ configuration_getter_name = configuration_name
213
+
214
+ ::CascadingConfiguration::Variable.define_local_instance_method( self,
215
+ configuration_getter_name ) do
216
+
217
+ return ::CascadingConfiguration::Array::Sorted::Unique.
218
+ composite_sorted_unique_array( self, configuration_name )
219
+
220
+ end
221
+
222
+ end
223
+
224
+ end
@@ -0,0 +1,47 @@
1
+
2
+ module ::CascadingConfiguration::Array::Sorted::Unique::ModuleSupportMethods
3
+
4
+ ###################################
5
+ # composite_sorted_unique_array #
6
+ ###################################
7
+
8
+ def composite_sorted_unique_array( configuration_instance, configuration_name )
9
+
10
+ composite_sorted_unique_array = nil
11
+
12
+ if ::CascadingConfiguration::Variable.has_configuration_variable?( configuration_instance,
13
+ configuration_name )
14
+ composite_sorted_unique_array = ::CascadingConfiguration::Variable.
15
+ get_configuration_variable( configuration_instance,
16
+ configuration_name )
17
+ else
18
+ composite_sorted_unique_array = ::CascadingConfiguration::Array::
19
+ Sorted::Unique::CompositingArray.
20
+ new( configuration_instance, configuration_name )
21
+ end
22
+
23
+ return composite_sorted_unique_array
24
+
25
+ end
26
+
27
+ #######################################
28
+ # set_composite_sorted_unique_array #
29
+ #######################################
30
+
31
+ def set_composite_sorted_unique_array( configuration_instance, configuration_name, array )
32
+
33
+ composite_sorted_unique_array = composite_sorted_unique_array( configuration_instance,
34
+ configuration_name )
35
+
36
+ # we want the array to supplant existing config
37
+ # clear the array (excludes everything explicitly)
38
+ composite_sorted_unique_array.clear
39
+
40
+ # push array elements (removes anything excluded from exclude)
41
+ composite_sorted_unique_array.push( *array )
42
+
43
+ return composite_sorted_unique_array
44
+
45
+ end
46
+
47
+ end
@@ -0,0 +1,748 @@
1
+
2
+ if $__cascading_configuration__spec__development
3
+ require_relative '../../../../lib/cascading-configuration-array-sorted-unique.rb'
4
+ else
5
+ require 'cascading-configuration-array-sorted-unique'
6
+ end
7
+
8
+ describe CascadingConfiguration::Array::Sorted::Unique do
9
+
10
+ ############################################
11
+ # attr_configuration_sorted_unique_array #
12
+ ############################################
13
+
14
+ it 'can define a configuration array, which is the primary interface' do
15
+
16
+ # possibilities:
17
+ # * module extended with setting
18
+ # => singleton gets attr_configuration and configurations
19
+ # => including modules and classes get nothing
20
+ # => extending modules and classes get nothing
21
+ # => instances of including and extending classes get nothing
22
+ # * module included with setting
23
+ # => singleton gets attr_configuration and configurations
24
+ # => including modules and classes get attr_configuration and configurations
25
+ # => instances of including classes get configurations
26
+ # => extending modules and classes get attr_configuration and configurations
27
+ # => instances of extending classes get nothing
28
+ module CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleExtended
29
+ extend CascadingConfiguration::Array::Sorted::Unique
30
+ # => singleton gets attr_configuration and configurations
31
+ respond_to?( :attr_configuration_sorted_unique_array ).should == true
32
+ attr_configuration_sorted_unique_array :configuration_setting
33
+ respond_to?( :configuration_setting ).should == true
34
+ configuration_setting.should == []
35
+ configuration_setting.push( :a_configuration )
36
+ configuration_setting.should == [ :a_configuration ]
37
+ instance_methods.include?( :configuration_setting ).should == false
38
+ instance_variables.empty?.should == true
39
+ # => including modules and classes get nothing
40
+ module SubmoduleIncluding
41
+ include CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleExtended
42
+ instance_methods.include?( :configuration_setting ).should == false
43
+ respond_to?( :configuration_setting ).should == false
44
+ instance_variables.empty?.should == true
45
+ end
46
+ # => extending modules and classes get nothing
47
+ module SubmoduleExtending
48
+ extend CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleExtended
49
+ instance_methods.include?( :configuration_setting ).should == false
50
+ respond_to?( :configuration_setting ).should == false
51
+ instance_variables.empty?.should == true
52
+ end
53
+ # => instances of including and extending classes get nothing
54
+ class ClassIncluding
55
+ include CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleExtended
56
+ instance_methods.include?( :configuration_setting ).should == false
57
+ respond_to?( :configuration_setting ).should == false
58
+ instance_variables.empty?.should == true
59
+ end
60
+ class ClassExtending
61
+ extend CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleExtended
62
+ instance_methods.include?( :configuration_setting ).should == false
63
+ respond_to?( :configuration_setting ).should == false
64
+ instance_variables.empty?.should == true
65
+ end
66
+ end
67
+
68
+ # * module included with setting
69
+ module CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleIncluded
70
+ include CascadingConfiguration::Array::Sorted::Unique
71
+ # => singleton gets attr_configuration and configurations
72
+ respond_to?( :attr_configuration_sorted_unique_array ).should == true
73
+ attr_configuration_sorted_unique_array :configuration_setting
74
+ respond_to?( :configuration_setting ).should == true
75
+ configuration_setting.should == []
76
+ configuration_setting.push( :a_configuration )
77
+ configuration_setting.should == [ :a_configuration ]
78
+ instance_methods.include?( :configuration_setting ).should == true
79
+ instance_variables.empty?.should == true
80
+ # => including modules and classes get attr_configuration and configurations
81
+ module SubmoduleIncluding
82
+ include CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleIncluded
83
+ instance_methods.include?( :configuration_setting ).should == true
84
+ respond_to?( :configuration_setting ).should == true
85
+ configuration_setting.should == [ :a_configuration ]
86
+ configuration_setting.push( :another_configuration )
87
+ configuration_setting.should == [ :a_configuration, :another_configuration ]
88
+ instance_variables.empty?.should == true
89
+ end
90
+ # => extending modules and classes get attr_configuration and configurations
91
+ module SubmoduleExtending
92
+ extend CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleIncluded
93
+ # if we're extended then we want to use the eigenclass ancestor chain
94
+ # - the first ancestor will be the extending module
95
+ # - the rest of the ancestors will be the extending module's include chain
96
+ respond_to?( :configuration_setting ).should == true
97
+ configuration_setting.should == [ :a_configuration ]
98
+ configuration_setting.push( :some_other_configuration )
99
+ configuration_setting.should == [ :a_configuration, :some_other_configuration ]
100
+ instance_methods.include?( :configuration_setting ).should == false
101
+ instance_variables.empty?.should == true
102
+ end
103
+ # => instances of including classes get configurations
104
+ class ClassIncluding
105
+ include CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleIncluded
106
+ instance_methods.include?( :configuration_setting ).should == true
107
+ respond_to?( :configuration_setting ).should == true
108
+ configuration_setting.should == [ :a_configuration ]
109
+ configuration_setting.push( :some_other_configuration )
110
+ configuration_setting.should == [ :a_configuration, :some_other_configuration ]
111
+ instance_variables.empty?.should == true
112
+ end
113
+ setting_class_including_instance = ClassIncluding.new
114
+ setting_class_including_instance.respond_to?( :configuration_setting ).should == true
115
+ setting_class_including_instance.configuration_setting.should == [ :a_configuration, :some_other_configuration ]
116
+ setting_class_including_instance.configuration_setting.delete( :some_other_configuration )
117
+ setting_class_including_instance.configuration_setting = [ :our_setting_value ]
118
+ setting_class_including_instance.configuration_setting.should == [ :our_setting_value ]
119
+ setting_class_including_instance.instance_variables.empty?.should == true
120
+ # => instances of extending classes get nothing
121
+ class ClassExtending
122
+ extend CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleIncluded
123
+ respond_to?( :configuration_setting ).should == true
124
+ configuration_setting.should == [ :a_configuration ]
125
+ configuration_setting.push( :some_other_configuration )
126
+ configuration_setting.should == [ :a_configuration, :some_other_configuration ]
127
+ instance_variables.empty?.should == true
128
+ end
129
+ setting_class_including_instance = ClassExtending.new
130
+ setting_class_including_instance.respond_to?( :configuration_setting ).should == false
131
+ setting_class_including_instance.instance_variables.empty?.should == true
132
+ end
133
+
134
+ class CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass
135
+ include CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockModuleIncluded::SubmoduleIncluding
136
+ configuration_setting.should == [ :a_configuration, :another_configuration ]
137
+ configuration_setting.push( :some_other_configuration )
138
+ configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
139
+ instance_variables.empty?.should == true
140
+ end
141
+ object_instance_one = CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass.new
142
+ object_instance_one.configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
143
+ object_instance_one.configuration_setting.delete( :a_configuration )
144
+ object_instance_one.configuration_setting.should == [ :another_configuration, :some_other_configuration ]
145
+ object_instance_one.instance_variables.empty?.should == true
146
+ class CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub1 < CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass
147
+ configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
148
+ configuration_setting.delete( :a_configuration )
149
+ configuration_setting.should == [ :another_configuration, :some_other_configuration ]
150
+ instance_variables.empty?.should == true
151
+ end
152
+ object_instance_two = CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub1.new
153
+ object_instance_two.configuration_setting.should == [ :another_configuration, :some_other_configuration ]
154
+ object_instance_two.configuration_setting.delete( :another_configuration )
155
+ object_instance_two.configuration_setting.should == [ :some_other_configuration ]
156
+ object_instance_two.instance_variables.empty?.should == true
157
+ class CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub2 < CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub1
158
+ configuration_setting.should == [ :another_configuration, :some_other_configuration ]
159
+ configuration_setting.push( :yet_another_configuration )
160
+ configuration_setting.should == [ :another_configuration, :some_other_configuration, :yet_another_configuration ]
161
+ instance_variables.empty?.should == true
162
+ end
163
+
164
+ # change ancestor setting
165
+ CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass.configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
166
+ CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass.configuration_setting.push( :a_yet_unused_configuration )
167
+ CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
168
+ object_instance_one.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
169
+ CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
170
+ object_instance_two.configuration_setting.should == [ :a_yet_unused_configuration, :some_other_configuration ]
171
+
172
+ # freeze ancestor setting
173
+ object_instance_one.configuration_setting.freeze!
174
+ object_instance_one.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
175
+ CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub1.configuration_setting.freeze!
176
+ CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
177
+ CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass.configuration_setting.push( :non_cascading_configuration )
178
+ CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :non_cascading_configuration, :some_other_configuration ]
179
+ object_instance_one.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
180
+ CascadingConfiguration::Array::Sorted::Unique::ConfigurationMockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
181
+ object_instance_two.configuration_setting.should == [ :a_yet_unused_configuration, :some_other_configuration ]
182
+
183
+ end
184
+
185
+ ###################################################
186
+ # attr_module_configuration_sorted_unique_array #
187
+ # attr_class_configuration_sorted_unique_array #
188
+ ###################################################
189
+
190
+ it 'can define a class configuration array, which will not cascade to instances' do
191
+
192
+ # possibilities:
193
+ # * module extended with setting
194
+ # => singleton gets attr_configuration and configurations
195
+ # => including modules and classes get nothing
196
+ # => extending modules and classes get nothing
197
+ # => instances of including and extending classes get nothing
198
+ # * module included with setting
199
+ # => singleton gets attr_configuration and configurations
200
+ # => including modules and classes get attr_configuration and configurations
201
+ # => instances of including classes get configurations
202
+ # => extending modules and classes get attr_configuration and configurations
203
+ # => instances of extending classes get nothing
204
+ module CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleExtended
205
+ extend CascadingConfiguration::Array::Sorted::Unique
206
+ # => singleton gets attr_configuration and configurations
207
+ respond_to?( :attr_module_configuration_sorted_unique_array ).should == true
208
+ method( :attr_module_configuration_sorted_unique_array ).should == method( :attr_class_configuration_sorted_unique_array )
209
+ attr_module_configuration_sorted_unique_array :configuration_setting
210
+ respond_to?( :configuration_setting ).should == true
211
+ configuration_setting.should == []
212
+ configuration_setting.push( :a_configuration )
213
+ configuration_setting.should == [ :a_configuration ]
214
+ instance_methods.include?( :configuration_setting ).should == false
215
+ instance_variables.empty?.should == true
216
+ # => including modules and classes get nothing
217
+ module SubmoduleIncluding
218
+ include CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleExtended
219
+ instance_methods.include?( :configuration_setting ).should == false
220
+ respond_to?( :configuration_setting ).should == false
221
+ instance_variables.empty?.should == true
222
+ end
223
+ # => extending modules and classes get nothing
224
+ module SubmoduleExtending
225
+ extend CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleExtended
226
+ instance_methods.include?( :configuration_setting ).should == false
227
+ respond_to?( :configuration_setting ).should == false
228
+ instance_variables.empty?.should == true
229
+ end
230
+ # => instances of including and extending classes get nothing
231
+ class ClassIncluding
232
+ include CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleExtended
233
+ instance_methods.include?( :configuration_setting ).should == false
234
+ respond_to?( :configuration_setting ).should == false
235
+ instance_variables.empty?.should == true
236
+ end
237
+ class ClassExtending
238
+ extend CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleExtended
239
+ instance_methods.include?( :configuration_setting ).should == false
240
+ respond_to?( :configuration_setting ).should == false
241
+ instance_variables.empty?.should == true
242
+ end
243
+ end
244
+
245
+ # * module included with setting
246
+ module CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleIncluded
247
+ include CascadingConfiguration::Array::Sorted::Unique
248
+ # => singleton gets attr_configuration and configurations
249
+ respond_to?( :attr_module_configuration_sorted_unique_array ).should == true
250
+ attr_module_configuration_sorted_unique_array :configuration_setting
251
+ respond_to?( :configuration_setting ).should == true
252
+ configuration_setting.should == []
253
+ configuration_setting.push( :a_configuration )
254
+ configuration_setting.should == [ :a_configuration ]
255
+ instance_methods.include?( :configuration_setting ).should == false
256
+ instance_variables.empty?.should == true
257
+ # => including modules and classes get attr_configuration and configurations
258
+ module SubmoduleIncluding
259
+ include CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleIncluded
260
+ instance_methods.include?( :configuration_setting ).should == false
261
+ respond_to?( :configuration_setting ).should == true
262
+ configuration_setting.should == [ :a_configuration ]
263
+ configuration_setting.push( :another_configuration )
264
+ configuration_setting.should == [ :a_configuration, :another_configuration ]
265
+ instance_methods.include?( :configuration_setting ).should == false
266
+ instance_variables.empty?.should == true
267
+ end
268
+ # => extending modules and classes get attr_configuration and configurations
269
+ module SubmoduleExtending
270
+ extend CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleIncluded
271
+ # if we're extended then we want to use the eigenclass ancestor chain
272
+ # - the first ancestor will be the extending module
273
+ # - the rest of the ancestors will be the extending module's include chain
274
+ respond_to?( :configuration_setting ).should == true
275
+ configuration_setting.should == [ :a_configuration ]
276
+ configuration_setting.push( :some_other_configuration )
277
+ configuration_setting.should == [ :a_configuration, :some_other_configuration ]
278
+ instance_methods.include?( :configuration_setting ).should == false
279
+ instance_variables.empty?.should == true
280
+ end
281
+ # => instances of including classes get configurations
282
+ class ClassIncluding
283
+ include CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleIncluded
284
+ instance_methods.include?( :configuration_setting ).should == false
285
+ respond_to?( :configuration_setting ).should == true
286
+ configuration_setting.should == [ :a_configuration ]
287
+ configuration_setting.push( :some_other_configuration )
288
+ configuration_setting.should == [ :a_configuration, :some_other_configuration ]
289
+ instance_variables.empty?.should == true
290
+ end
291
+ setting_class_including_instance = ClassIncluding.new
292
+ setting_class_including_instance.respond_to?( :configuration_setting ).should == false
293
+ setting_class_including_instance.instance_variables.empty?.should == true
294
+ # => instances of extending classes get nothing
295
+ class ClassExtending
296
+ extend CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleIncluded
297
+ instance_methods.include?( :configuration_setting ).should == false
298
+ respond_to?( :configuration_setting ).should == true
299
+ configuration_setting.should == [ :a_configuration ]
300
+ configuration_setting.push( :some_other_configuration )
301
+ configuration_setting.should == [ :a_configuration, :some_other_configuration ]
302
+ instance_variables.empty?.should == true
303
+ end
304
+ setting_class_including_instance = ClassExtending.new
305
+ setting_class_including_instance.respond_to?( :configuration_setting ).should == false
306
+ setting_class_including_instance.instance_variables.empty?.should == true
307
+ end
308
+
309
+ class CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass
310
+ include CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockModuleIncluded::SubmoduleIncluding
311
+ instance_methods.include?( :configuration_setting ).should == false
312
+ configuration_setting.should == [ :a_configuration, :another_configuration ]
313
+ configuration_setting.push( :some_other_configuration )
314
+ configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
315
+ instance_variables.empty?.should == true
316
+ end
317
+ object_instance_one = CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass.new
318
+ object_instance_one.respond_to?( :configuration_setting ).should == false
319
+ object_instance_one.instance_variables.empty?.should == true
320
+ class CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub1 < CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass
321
+ instance_methods.include?( :configuration_setting ).should == false
322
+ configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
323
+ configuration_setting.delete( :a_configuration )
324
+ configuration_setting.should == [ :another_configuration, :some_other_configuration ]
325
+ instance_variables.empty?.should == true
326
+ end
327
+ object_instance_two = CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub1.new
328
+ object_instance_two.respond_to?( :configuration_setting ).should == false
329
+ object_instance_two.instance_variables.empty?.should == true
330
+ class CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub2 < CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub1
331
+ instance_methods.include?( :configuration_setting ).should == false
332
+ configuration_setting.should == [ :another_configuration, :some_other_configuration ]
333
+ configuration_setting.push( :yet_another_configuration )
334
+ configuration_setting.should == [ :another_configuration, :some_other_configuration, :yet_another_configuration ]
335
+ instance_variables.empty?.should == true
336
+ end
337
+
338
+ # change ancestor setting
339
+ CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass.configuration_setting.should == [ :a_configuration, :another_configuration, :some_other_configuration ]
340
+ CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass.configuration_setting.push( :a_yet_unused_configuration )
341
+ CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
342
+ CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
343
+
344
+ # freeze ancestor setting
345
+ CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub1.configuration_setting.freeze!
346
+ CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
347
+ CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass.configuration_setting.push( :non_cascading_configuration )
348
+ CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClass.configuration_setting.should == [ :a_configuration, :a_yet_unused_configuration, :another_configuration, :non_cascading_configuration, :some_other_configuration ]
349
+ CascadingConfiguration::Array::Sorted::Unique::ClassConfigurationMockClassSub1.configuration_setting.should == [ :a_yet_unused_configuration, :another_configuration, :some_other_configuration ]
350
+
351
+ end
352
+
353
+ ##################################################
354
+ # attr_local_configuration_sorted_unique_array #
355
+ ##################################################
356
+
357
+ it 'can define a local configuration array, which will not cascade' do
358
+
359
+ # possibilities:
360
+ # * module extended with setting
361
+ # => singleton gets attr_configuration and configurations
362
+ # => including modules and classes get nothing
363
+ # => extending modules and classes get nothing
364
+ # => instances of including and extending classes get nothing
365
+ # * module included with setting
366
+ # => singleton gets attr_configuration and configurations
367
+ # => including modules and classes get attr_configuration and configurations
368
+ # => instances of including classes get configurations
369
+ # => extending modules and classes get attr_configuration and configurations
370
+ # => instances of extending classes get nothing
371
+ module CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleExtended
372
+ extend CascadingConfiguration::Array::Sorted::Unique
373
+ # => singleton gets attr_configuration and configurations
374
+ respond_to?( :attr_local_configuration_sorted_unique_array ).should == true
375
+ attr_local_configuration_sorted_unique_array :configuration_setting
376
+ respond_to?( :configuration_setting ).should == true
377
+ configuration_setting.should == []
378
+ configuration_setting.push( :a_configuration )
379
+ configuration_setting.should == [ :a_configuration ]
380
+ instance_methods.include?( :configuration_setting ).should == false
381
+ instance_variables.empty?.should == true
382
+ # => including modules and classes get nothing
383
+ module SubmoduleIncluding
384
+ include CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleExtended
385
+ instance_methods.include?( :configuration_setting ).should == false
386
+ respond_to?( :configuration_setting ).should == false
387
+ instance_variables.empty?.should == true
388
+ end
389
+ # => extending modules and classes get nothing
390
+ module SubmoduleExtending
391
+ extend CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleExtended
392
+ instance_methods.include?( :configuration_setting ).should == false
393
+ respond_to?( :configuration_setting ).should == false
394
+ instance_variables.empty?.should == true
395
+ end
396
+ # => instances of including and extending classes get nothing
397
+ class ClassIncluding
398
+ include CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleExtended
399
+ instance_methods.include?( :configuration_setting ).should == false
400
+ respond_to?( :configuration_setting ).should == false
401
+ instance_variables.empty?.should == true
402
+ end
403
+ class ClassExtending
404
+ extend CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleExtended
405
+ instance_methods.include?( :configuration_setting ).should == false
406
+ respond_to?( :configuration_setting ).should == false
407
+ instance_variables.empty?.should == true
408
+ end
409
+ end
410
+
411
+ # * module included with setting
412
+ module CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleIncluded
413
+ include CascadingConfiguration::Array::Sorted::Unique
414
+ # => singleton gets attr_configuration and configurations
415
+ respond_to?( :attr_local_configuration_sorted_unique_array ).should == true
416
+ attr_local_configuration_sorted_unique_array :configuration_setting
417
+ respond_to?( :configuration_setting ).should == true
418
+ configuration_setting.should == []
419
+ configuration_setting.push( :a_configuration )
420
+ configuration_setting.should == [ :a_configuration ]
421
+ instance_methods.include?( :configuration_setting ).should == true
422
+ instance_variables.empty?.should == true
423
+ # => including modules and classes get attr_configuration and configurations
424
+ module SubmoduleIncluding
425
+ include CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleIncluded
426
+ instance_methods.include?( :configuration_setting ).should == true
427
+ respond_to?( :configuration_setting ).should == false
428
+ instance_variables.empty?.should == true
429
+ end
430
+ # => extending modules and classes get attr_configuration and configurations
431
+ module SubmoduleExtending
432
+ extend CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleIncluded
433
+ # if we're extended then we want to use the eigenclass ancestor chain
434
+ # - the first ancestor will be the extending module
435
+ # - the rest of the ancestors will be the extending module's include chain
436
+ respond_to?( :configuration_setting ).should == true
437
+ instance_methods.include?( :configuration_setting ).should == false
438
+ instance_variables.empty?.should == true
439
+ end
440
+ # => instances of including classes get configurations
441
+ class ClassIncluding
442
+ include CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleIncluded
443
+ instance_methods.include?( :configuration_setting ).should == true
444
+ respond_to?( :configuration_setting ).should == false
445
+ instance_variables.empty?.should == true
446
+ end
447
+ setting_class_including_instance = ClassIncluding.new
448
+ setting_class_including_instance.respond_to?( :configuration_setting ).should == true
449
+ setting_class_including_instance.instance_variables.empty?.should == true
450
+ # => instances of extending classes get nothing
451
+ class ClassExtending
452
+ extend CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleIncluded
453
+ instance_methods.include?( :configuration_setting ).should == false
454
+ respond_to?( :configuration_setting ).should == true
455
+ instance_variables.empty?.should == true
456
+ end
457
+ setting_class_including_instance = ClassExtending.new
458
+ setting_class_including_instance.respond_to?( :configuration_setting ).should == false
459
+ setting_class_including_instance.instance_variables.empty?.should == true
460
+ end
461
+
462
+ class CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockClass
463
+ include CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockModuleIncluded::SubmoduleIncluding
464
+ instance_methods.include?( :configuration_setting ).should == true
465
+ respond_to?( :configuration_setting ).should == false
466
+ instance_variables.empty?.should == true
467
+ end
468
+ object_instance_one = CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockClass.new
469
+ object_instance_one.respond_to?( :configuration_setting ).should == true
470
+ object_instance_one.instance_variables.empty?.should == true
471
+ class CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockClassSub1 < CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockClass
472
+ instance_methods.include?( :configuration_setting ).should == true
473
+ respond_to?( :configuration_setting ).should == false
474
+ instance_variables.empty?.should == true
475
+ end
476
+ object_instance_two = CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockClassSub1.new
477
+ object_instance_two.respond_to?( :configuration_setting ).should == true
478
+ object_instance_two.instance_variables.empty?.should == true
479
+ class CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockClassSub2 < CascadingConfiguration::Array::Sorted::Unique::LocalConfigurationMockClassSub1
480
+ instance_methods.include?( :configuration_setting ).should == true
481
+ respond_to?( :configuration_setting ).should == false
482
+ instance_variables.empty?.should == true
483
+ end
484
+
485
+ end
486
+
487
+ #####################################################
488
+ # attr_instance_configuration_sorted_unique_array #
489
+ #####################################################
490
+
491
+ it 'can define an instance configuration array, which will not cascade' do
492
+
493
+ # possibilities:
494
+ # * module extended with setting
495
+ # => singleton gets attr_configuration and configurations
496
+ # => including modules and classes get nothing
497
+ # => extending modules and classes get nothing
498
+ # => instances of including and extending classes get nothing
499
+ # * module included with setting
500
+ # => singleton gets attr_configuration and configurations
501
+ # => including modules and classes get attr_configuration and configurations
502
+ # => instances of including classes get configurations
503
+ # => extending modules and classes get attr_configuration and configurations
504
+ # => instances of extending classes get nothing
505
+ module CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleExtended
506
+ extend CascadingConfiguration::Array::Sorted::Unique
507
+ # => singleton gets attr_configuration and configurations
508
+ instance_variables.empty?.should == true
509
+ # => including modules and classes get nothing
510
+ module SubmoduleIncluding
511
+ include CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleExtended
512
+ instance_methods.include?( :configuration_setting ).should == false
513
+ respond_to?( :configuration_setting ).should == false
514
+ instance_variables.empty?.should == true
515
+ end
516
+ # => extending modules and classes get nothing
517
+ module SubmoduleExtending
518
+ extend CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleExtended
519
+ instance_methods.include?( :configuration_setting ).should == false
520
+ respond_to?( :configuration_setting ).should == false
521
+ instance_variables.empty?.should == true
522
+ end
523
+ # => instances of including and extending classes get nothing
524
+ class ClassIncluding
525
+ include CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleExtended
526
+ instance_methods.include?( :configuration_setting ).should == false
527
+ respond_to?( :configuration_setting ).should == false
528
+ instance_variables.empty?.should == true
529
+ end
530
+ class ClassExtending
531
+ extend CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleExtended
532
+ instance_methods.include?( :configuration_setting ).should == false
533
+ respond_to?( :configuration_setting ).should == false
534
+ instance_variables.empty?.should == true
535
+ end
536
+ end
537
+
538
+ # * module included with setting
539
+ module CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleIncluded
540
+ include CascadingConfiguration::Array::Sorted::Unique
541
+ # => singleton gets attr_configuration and configurations
542
+ respond_to?( :attr_instance_configuration_sorted_unique_array ).should == true
543
+ attr_instance_configuration_sorted_unique_array :configuration_setting
544
+ respond_to?( :configuration_setting ).should == false
545
+ instance_methods.include?( :configuration_setting ).should == true
546
+ instance_variables.empty?.should == true
547
+ # => including modules and classes get attr_configuration and configurations
548
+ module SubmoduleIncluding
549
+ include CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleIncluded
550
+ instance_methods.include?( :configuration_setting ).should == true
551
+ respond_to?( :configuration_setting ).should == false
552
+ instance_methods.include?( :configuration_setting ).should == true
553
+ instance_variables.empty?.should == true
554
+ end
555
+ # => extending modules and classes get attr_configuration and configurations
556
+ module SubmoduleExtending
557
+ extend CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleIncluded
558
+ # if we're extended then we want to use the eigenclass ancestor chain
559
+ # - the first ancestor will be the extending module
560
+ # - the rest of the ancestors will be the extending module's include chain
561
+ respond_to?( :configuration_setting ).should == true
562
+ instance_methods.include?( :configuration_setting ).should == false
563
+ instance_variables.empty?.should == true
564
+ end
565
+ # => instances of including classes get configurations
566
+ class ClassIncluding
567
+ include CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleIncluded
568
+ instance_methods.include?( :configuration_setting ).should == true
569
+ respond_to?( :configuration_setting ).should == false
570
+ instance_variables.empty?.should == true
571
+ end
572
+ setting_class_including_instance = ClassIncluding.new
573
+ setting_class_including_instance.respond_to?( :configuration_setting ).should == true
574
+ setting_class_including_instance.instance_variables.empty?.should == true
575
+ # => instances of extending classes get nothing
576
+ class ClassExtending
577
+ extend CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleIncluded
578
+ instance_methods.include?( :configuration_setting ).should == false
579
+ respond_to?( :configuration_setting ).should == true
580
+ instance_variables.empty?.should == true
581
+ end
582
+ setting_class_including_instance = ClassExtending.new
583
+ setting_class_including_instance.respond_to?( :configuration_setting ).should == false
584
+ setting_class_including_instance.instance_variables.empty?.should == true
585
+ end
586
+
587
+ class CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockClass
588
+ include CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockModuleIncluded::SubmoduleIncluding
589
+ instance_methods.include?( :configuration_setting ).should == true
590
+ respond_to?( :configuration_setting ).should == false
591
+ instance_variables.empty?.should == true
592
+ end
593
+ object_instance_one = CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockClass.new
594
+ object_instance_one.respond_to?( :configuration_setting ).should == true
595
+ object_instance_one.instance_variables.empty?.should == true
596
+ class CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockClassSub1 < CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockClass
597
+ instance_methods.include?( :configuration_setting ).should == true
598
+ respond_to?( :configuration_setting ).should == false
599
+ instance_variables.empty?.should == true
600
+ end
601
+ object_instance_two = CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockClassSub1.new
602
+ object_instance_two.respond_to?( :configuration_setting ).should == true
603
+ object_instance_two.instance_variables.empty?.should == true
604
+ class CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockClassSub2 < CascadingConfiguration::Array::Sorted::Unique::InstanceConfigurationMockClassSub1
605
+ instance_methods.include?( :configuration_setting ).should == true
606
+ respond_to?( :configuration_setting ).should == false
607
+ instance_variables.empty?.should == true
608
+ end
609
+
610
+ end
611
+
612
+
613
+ ###################################################
614
+ # attr_object_configuration_sorted_unique_array #
615
+ ###################################################
616
+
617
+ it 'can define an object configuration array, which will not cascade' do
618
+
619
+ # possibilities:
620
+ # * module extended with setting
621
+ # => singleton gets attr_configuration and configurations
622
+ # => including modules and classes get nothing
623
+ # => extending modules and classes get nothing
624
+ # => instances of including and extending classes get nothing
625
+ # * module included with setting
626
+ # => singleton gets attr_configuration and configurations
627
+ # => including modules and classes get attr_configuration and configurations
628
+ # => instances of including classes get configurations
629
+ # => extending modules and classes get attr_configuration and configurations
630
+ # => instances of extending classes get nothing
631
+ module CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleExtended
632
+ extend CascadingConfiguration::Array::Sorted::Unique
633
+ # => singleton gets attr_configuration and configurations
634
+ respond_to?( :attr_object_configuration_sorted_unique_array ).should == true
635
+ attr_object_configuration_sorted_unique_array :configuration_setting
636
+ respond_to?( :configuration_setting ).should == true
637
+ configuration_setting.should == []
638
+ configuration_setting.push( :a_configuration )
639
+ configuration_setting.should == [ :a_configuration ]
640
+ instance_methods.include?( :configuration_setting ).should == false
641
+ instance_variables.empty?.should == true
642
+ # => including modules and classes get nothing
643
+ module SubmoduleIncluding
644
+ include CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleExtended
645
+ instance_methods.include?( :configuration_setting ).should == false
646
+ respond_to?( :configuration_setting ).should == false
647
+ instance_variables.empty?.should == true
648
+ end
649
+ # => extending modules and classes get nothing
650
+ module SubmoduleExtending
651
+ extend CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleExtended
652
+ instance_methods.include?( :configuration_setting ).should == false
653
+ respond_to?( :configuration_setting ).should == false
654
+ instance_variables.empty?.should == true
655
+ end
656
+ # => instances of including and extending classes get nothing
657
+ class ClassIncluding
658
+ include CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleExtended
659
+ instance_methods.include?( :configuration_setting ).should == false
660
+ respond_to?( :configuration_setting ).should == false
661
+ instance_variables.empty?.should == true
662
+ end
663
+ class ClassExtending
664
+ extend CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleExtended
665
+ instance_methods.include?( :configuration_setting ).should == false
666
+ respond_to?( :configuration_setting ).should == false
667
+ instance_variables.empty?.should == true
668
+ end
669
+ end
670
+
671
+ # * module included with setting
672
+ module CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleIncluded
673
+ include CascadingConfiguration::Array::Sorted::Unique
674
+ # => singleton gets attr_configuration and configurations
675
+ respond_to?( :attr_object_configuration_sorted_unique_array ).should == true
676
+ attr_object_configuration_sorted_unique_array :configuration_setting
677
+ respond_to?( :configuration_setting ).should == true
678
+ configuration_setting.should == []
679
+ configuration_setting.push( :a_configuration )
680
+ configuration_setting.should == [ :a_configuration ]
681
+ instance_methods.include?( :configuration_setting ).should == false
682
+ instance_variables.empty?.should == true
683
+ # => including modules and classes get attr_configuration and configurations
684
+ module SubmoduleIncluding
685
+ include CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleIncluded
686
+ instance_methods.include?( :configuration_setting ).should == false
687
+ respond_to?( :configuration_setting ).should == false
688
+ instance_methods.include?( :configuration_setting ).should == false
689
+ instance_variables.empty?.should == true
690
+ end
691
+ # => extending modules and classes get attr_configuration and configurations
692
+ module SubmoduleExtending
693
+ extend CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleIncluded
694
+ # if we're extended then we want to use the eigenclass ancestor chain
695
+ # - the first ancestor will be the extending module
696
+ # - the rest of the ancestors will be the extending module's include chain
697
+ respond_to?( :configuration_setting ).should == false
698
+ instance_methods.include?( :configuration_setting ).should == false
699
+ instance_variables.empty?.should == true
700
+ end
701
+ # => instances of including classes get configurations
702
+ class ClassIncluding
703
+ include CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleIncluded
704
+ instance_methods.include?( :configuration_setting ).should == false
705
+ respond_to?( :configuration_setting ).should == false
706
+ instance_variables.empty?.should == true
707
+ end
708
+ setting_class_including_instance = ClassIncluding.new
709
+ setting_class_including_instance.respond_to?( :configuration_setting ).should == false
710
+ setting_class_including_instance.instance_variables.empty?.should == true
711
+ # => instances of extending classes get nothing
712
+ class ClassExtending
713
+ extend CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleIncluded
714
+ instance_methods.include?( :configuration_setting ).should == false
715
+ respond_to?( :configuration_setting ).should == false
716
+ instance_variables.empty?.should == true
717
+ end
718
+ setting_class_including_instance = ClassExtending.new
719
+ setting_class_including_instance.respond_to?( :configuration_setting ).should == false
720
+ setting_class_including_instance.instance_variables.empty?.should == true
721
+ end
722
+
723
+ class CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockClass
724
+ include CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockModuleIncluded::SubmoduleIncluding
725
+ instance_methods.include?( :configuration_setting ).should == false
726
+ respond_to?( :configuration_setting ).should == false
727
+ instance_variables.empty?.should == true
728
+ end
729
+ object_instance_one = CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockClass.new
730
+ object_instance_one.respond_to?( :configuration_setting ).should == false
731
+ object_instance_one.instance_variables.empty?.should == true
732
+ class CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockClassSub1 < CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockClass
733
+ instance_methods.include?( :configuration_setting ).should == false
734
+ respond_to?( :configuration_setting ).should == false
735
+ instance_variables.empty?.should == true
736
+ end
737
+ object_instance_two = CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockClassSub1.new
738
+ object_instance_two.respond_to?( :configuration_setting ).should == false
739
+ object_instance_two.instance_variables.empty?.should == true
740
+ class CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockClassSub2 < CascadingConfiguration::Array::Sorted::Unique::ObjectConfigurationMockClassSub1
741
+ instance_methods.include?( :configuration_setting ).should == false
742
+ respond_to?( :configuration_setting ).should == false
743
+ instance_variables.empty?.should == true
744
+ end
745
+
746
+ end
747
+
748
+ end