aspectual 0.1.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/workflows/rubocop.yml +37 -0
- data/.github/workflows/ruby.yml +37 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +39 -0
- data/Gemfile +7 -1
- data/README.md +66 -6
- data/aspectual.gemspec +17 -16
- data/lib/aspectual/method_construction.rb +121 -0
- data/lib/aspectual/version.rb +3 -1
- data/lib/aspectual.rb +100 -60
- data/spec/lib/aspectual_block_args_spec.rb +74 -0
- data/spec/lib/aspectual_complex_args_spec.rb +115 -0
- data/spec/lib/aspectual_inheritance_spec.rb +1247 -0
- data/spec/lib/aspectual_kwargs_spec.rb +80 -0
- data/spec/lib/aspectual_non_word_ending_character_spec.rb +128 -0
- data/spec/lib/aspectual_positional_args_spec.rb +74 -0
- data/spec/lib/aspectual_return_value_spec.rb +186 -0
- data/spec/lib/aspectual_scoping_spec.rb +132 -0
- data/spec/lib/aspectual_spec.rb +232 -169
- metadata +22 -58
- data/Gemfile.lock +0 -27
- data/aspectual-0.0.1.gem +0 -0
- data/aspectual-0.0.2.gem +0 -0
|
@@ -0,0 +1,1247 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../../lib/aspectual'
|
|
4
|
+
|
|
5
|
+
class ParentClass
|
|
6
|
+
extend Aspectual
|
|
7
|
+
|
|
8
|
+
attr_reader :methods_called
|
|
9
|
+
|
|
10
|
+
def initialize
|
|
11
|
+
# This is to ensure that all methods are properly called within the
|
|
12
|
+
# context of the current instance of this object.
|
|
13
|
+
@methods_called = []
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def parent_aspect_method
|
|
17
|
+
methods_called << 'parent_aspect_method'
|
|
18
|
+
self
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def overridden_method
|
|
22
|
+
methods_called << 'overridden_parent_method'
|
|
23
|
+
self
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def overridden_aspect_method
|
|
27
|
+
methods_called << 'overridden_parent_aspect_method'
|
|
28
|
+
self
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def parent_aspect_parent_method_child_definition
|
|
32
|
+
methods_called << 'parent_aspect_parent_method_child_definition'
|
|
33
|
+
self
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def parent_aspect_parent_method_super_child_definition
|
|
37
|
+
methods_called << 'parent_aspect_parent_method_super_child_definition'
|
|
38
|
+
self
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def child_aspect_parent_method_parent_definition
|
|
42
|
+
methods_called << 'child_aspect_parent_method_parent_definition'
|
|
43
|
+
self
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def child_aspect_parent_method_child_definition
|
|
47
|
+
methods_called << 'child_aspect_parent_method_child_definition'
|
|
48
|
+
self
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def child_aspect_parent_method_super_child_definition
|
|
52
|
+
methods_called << 'child_aspect_parent_method_super_child_definition'
|
|
53
|
+
self
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def super_child_aspect_parent_method_parent_definition
|
|
57
|
+
methods_called << 'super_child_aspect_parent_method_parent_definition'
|
|
58
|
+
self
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def super_child_aspect_parent_method_child_definition
|
|
62
|
+
methods_called << 'super_child_aspect_parent_method_child_definition'
|
|
63
|
+
self
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def super_child_aspect_parent_method_super_child_definition
|
|
67
|
+
methods_called << 'super_child_aspect_parent_method_super_child_definition'
|
|
68
|
+
self
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
aspects :parent_aspect_child_method_parent_definition, before: :parent_aspect_method
|
|
72
|
+
aspects :parent_aspect_super_child_method_parent_definition, before: :parent_aspect_method
|
|
73
|
+
aspects :child_aspect_parent_method_parent_definition, before: :child_aspect_method
|
|
74
|
+
aspects :child_aspect_child_method_parent_definition, before: :child_aspect_method
|
|
75
|
+
aspects :child_aspect_super_child_method_parent_definition, before: :child_aspect_method
|
|
76
|
+
aspects :super_child_aspect_parent_method_parent_definition, before: :super_child_aspect_method
|
|
77
|
+
aspects :super_child_aspect_child_method_parent_definition, before: :super_child_aspect_method
|
|
78
|
+
aspects :super_child_aspect_super_child_method_parent_definition, before: :super_child_aspect_method
|
|
79
|
+
aspects :overridden_method, before: :overridden_aspect_method
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
class ChildClass < ParentClass
|
|
83
|
+
aspects :parent_aspect_parent_method_child_definition, before: :parent_aspect_method
|
|
84
|
+
aspects :parent_aspect_child_method_child_definition, before: :parent_aspect_method
|
|
85
|
+
aspects :parent_aspect_super_child_method_child_definition, before: :parent_aspect_method
|
|
86
|
+
aspects :child_aspect_parent_method_child_definition, before: :child_aspect_method
|
|
87
|
+
aspects :child_aspect_super_child_method_child_definition, before: :child_aspect_method
|
|
88
|
+
aspects :super_child_aspect_parent_method_child_definition, before: :super_child_aspect_method
|
|
89
|
+
aspects :super_child_aspect_child_method_child_definition, before: :super_child_aspect_method
|
|
90
|
+
aspects :super_child_aspect_super_child_method_child_definition, before: :super_child_aspect_method
|
|
91
|
+
|
|
92
|
+
def child_aspect_method
|
|
93
|
+
methods_called << 'child_aspect_method'
|
|
94
|
+
self
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def overridden_method
|
|
98
|
+
methods_called << 'overridden_child_method'
|
|
99
|
+
self
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def overridden_aspect_method
|
|
103
|
+
methods_called << 'overridden_child_aspect_method'
|
|
104
|
+
self
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# The parent consumed the definition of the overridden aspect, so we need to
|
|
108
|
+
# set it again.
|
|
109
|
+
aspects :overridden_method, before: :overridden_aspect_method
|
|
110
|
+
|
|
111
|
+
def parent_aspect_child_method_parent_definition
|
|
112
|
+
methods_called << 'parent_aspect_child_method_parent_definition'
|
|
113
|
+
self
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def parent_aspect_child_method_child_definition
|
|
117
|
+
methods_called << 'parent_aspect_child_method_child_definition'
|
|
118
|
+
self
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def parent_aspect_child_method_super_child_definition
|
|
122
|
+
methods_called << 'parent_aspect_child_method_super_child_definition'
|
|
123
|
+
self
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def child_aspect_child_method_parent_definition
|
|
127
|
+
methods_called << 'child_aspect_child_method_parent_definition'
|
|
128
|
+
self
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def child_aspect_child_method_super_child_definition
|
|
132
|
+
methods_called << 'child_aspect_child_method_super_child_definition'
|
|
133
|
+
self
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def super_child_aspect_child_method_parent_definition
|
|
137
|
+
methods_called << 'super_child_aspect_child_method_parent_definition'
|
|
138
|
+
self
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def super_child_aspect_child_method_child_definition
|
|
142
|
+
methods_called << 'super_child_aspect_child_method_child_definition'
|
|
143
|
+
self
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def super_child_aspect_child_method_super_child_definition
|
|
147
|
+
methods_called << 'super_child_aspect_child_method_super_child_definition'
|
|
148
|
+
self
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
class OtherChildClass < ParentClass
|
|
153
|
+
aspects :parent_aspect_super_child_method_child_definition, before: :parent_aspect_method
|
|
154
|
+
aspects :child_aspect_parent_method_child_definition, before: :child_aspect_method
|
|
155
|
+
aspects :child_aspect_super_child_method_child_definition, before: :child_aspect_method
|
|
156
|
+
aspects :super_child_aspect_parent_method_child_definition, before: :super_child_aspect_method
|
|
157
|
+
aspects :super_child_aspect_child_method_child_definition, before: :super_child_aspect_method
|
|
158
|
+
aspects :super_child_aspect_super_child_method_child_definition, before: :super_child_aspect_method
|
|
159
|
+
|
|
160
|
+
def child_aspect_method
|
|
161
|
+
methods_called << 'other_child_aspect_method'
|
|
162
|
+
self
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def overridden_method
|
|
166
|
+
methods_called << 'overridden_other_child_method'
|
|
167
|
+
self
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# The parent consumed the definition of the overridden aspect, so we need to
|
|
171
|
+
# set it again.
|
|
172
|
+
aspects :overridden_method, before: :overridden_aspect_method
|
|
173
|
+
|
|
174
|
+
def overridden_aspect_method
|
|
175
|
+
methods_called << 'overridden_other_child_aspect_method'
|
|
176
|
+
self
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def parent_aspect_child_method_parent_definition
|
|
180
|
+
methods_called << 'parent_aspect_other_child_method_parent_definition'
|
|
181
|
+
self
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def parent_aspect_child_method_child_definition
|
|
185
|
+
methods_called << 'parent_aspect_other_child_method_other_child_definition'
|
|
186
|
+
self
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def parent_aspect_child_method_super_child_definition
|
|
190
|
+
methods_called << 'parent_aspect_other_child_method_super_child_definition'
|
|
191
|
+
self
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
def child_aspect_child_method_parent_definition
|
|
195
|
+
methods_called << 'child_aspect_other_child_method_parent_definition'
|
|
196
|
+
self
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def child_aspect_child_method_super_child_definition
|
|
200
|
+
methods_called << 'child_aspect_other_child_method_super_child_definition'
|
|
201
|
+
self
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
def super_child_aspect_child_method_parent_definition
|
|
205
|
+
methods_called << 'super_child_aspect_other_child_method_parent_definition'
|
|
206
|
+
self
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def super_child_aspect_child_method_child_definition
|
|
210
|
+
methods_called << 'super_child_aspect_other_child_method_other_child_definition'
|
|
211
|
+
self
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def super_child_aspect_child_method_super_child_definition
|
|
215
|
+
methods_called << 'super_child_aspect_other_child_method_super_child_definition'
|
|
216
|
+
self
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
class SuperChildClass < ChildClass
|
|
221
|
+
aspects :parent_aspect_parent_method_super_child_definition, before: :parent_aspect_method
|
|
222
|
+
aspects :parent_aspect_child_method_super_child_definition, before: :parent_aspect_method
|
|
223
|
+
aspects :parent_aspect_super_child_method_super_child_definition, before: :parent_aspect_method
|
|
224
|
+
aspects :child_aspect_parent_method_super_child_definition, before: :child_aspect_method
|
|
225
|
+
aspects :child_aspect_child_method_super_child_definition, before: :child_aspect_method
|
|
226
|
+
aspects :child_aspect_super_child_method_super_child_definition, before: :child_aspect_method
|
|
227
|
+
aspects :super_child_aspect_parent_method_super_child_definition, before: :super_child_aspect_method
|
|
228
|
+
aspects :super_child_aspect_child_method_super_child_definition, before: :super_child_aspect_method
|
|
229
|
+
|
|
230
|
+
def super_child_aspect_method
|
|
231
|
+
methods_called << 'super_child_aspect_method'
|
|
232
|
+
self
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
def overridden_method
|
|
236
|
+
methods_called << 'overridden_super_child_method'
|
|
237
|
+
self
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
def overridden_aspect_method
|
|
241
|
+
methods_called << 'overridden_super_child_aspect_method'
|
|
242
|
+
self
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# The parent consumed the definition of the overridden aspect, so we need to
|
|
246
|
+
# set it again.
|
|
247
|
+
aspects :overridden_method, before: :overridden_aspect_method
|
|
248
|
+
|
|
249
|
+
def parent_aspect_super_child_method_parent_definition
|
|
250
|
+
methods_called << 'parent_aspect_super_child_method_parent_definition'
|
|
251
|
+
self
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
def parent_aspect_super_child_method_child_definition
|
|
255
|
+
methods_called << 'parent_aspect_super_child_method_child_definition'
|
|
256
|
+
self
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
def parent_aspect_super_child_method_super_child_definition
|
|
260
|
+
methods_called << 'parent_aspect_super_child_method_super_child_definition'
|
|
261
|
+
self
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
def child_aspect_super_child_method_parent_definition
|
|
265
|
+
methods_called << 'child_aspect_super_child_method_parent_definition'
|
|
266
|
+
self
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
def child_aspect_super_child_method_child_definition
|
|
270
|
+
methods_called << 'child_aspect_super_child_method_child_definition'
|
|
271
|
+
self
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def child_aspect_super_child_method_super_child_definition
|
|
275
|
+
methods_called << 'child_aspect_super_child_method_super_child_definition'
|
|
276
|
+
self
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
def super_child_aspect_super_child_method_parent_definition
|
|
280
|
+
methods_called << 'super_child_aspect_super_child_method_parent_definition'
|
|
281
|
+
self
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def super_child_aspect_super_child_method_child_definition
|
|
285
|
+
methods_called << 'super_child_aspect_super_child_method_child_definition'
|
|
286
|
+
self
|
|
287
|
+
end
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
describe Aspectual do
|
|
291
|
+
describe 'aspects across inheritance' do
|
|
292
|
+
describe 'methods defined on the parent' do
|
|
293
|
+
it 'is unaffected when overridden by descendants' do
|
|
294
|
+
result = ParentClass.new.overridden_method
|
|
295
|
+
|
|
296
|
+
expect(result.methods_called).to eq(
|
|
297
|
+
%w[
|
|
298
|
+
overridden_parent_aspect_method
|
|
299
|
+
overridden_parent_method
|
|
300
|
+
],
|
|
301
|
+
)
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
describe 'can have aspects from a parent defined on the child' do
|
|
305
|
+
it 'does not affect the parent class' do
|
|
306
|
+
result = ParentClass.new.parent_aspect_parent_method_child_definition
|
|
307
|
+
|
|
308
|
+
expect(result.methods_called).to eq(
|
|
309
|
+
%w[
|
|
310
|
+
parent_aspect_parent_method_child_definition
|
|
311
|
+
],
|
|
312
|
+
)
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
it 'does affect the child class' do
|
|
316
|
+
result = ChildClass.new.parent_aspect_parent_method_child_definition
|
|
317
|
+
|
|
318
|
+
expect(result.methods_called).to eq(
|
|
319
|
+
%w[
|
|
320
|
+
parent_aspect_method
|
|
321
|
+
parent_aspect_parent_method_child_definition
|
|
322
|
+
],
|
|
323
|
+
)
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
it 'does not affect the other child class' do
|
|
327
|
+
result = OtherChildClass.new.parent_aspect_parent_method_child_definition
|
|
328
|
+
|
|
329
|
+
expect(result.methods_called).to eq(
|
|
330
|
+
%w[
|
|
331
|
+
parent_aspect_parent_method_child_definition
|
|
332
|
+
],
|
|
333
|
+
)
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
it 'does affect the super child class' do
|
|
337
|
+
result = SuperChildClass.new.parent_aspect_parent_method_child_definition
|
|
338
|
+
|
|
339
|
+
expect(result.methods_called).to eq(
|
|
340
|
+
%w[
|
|
341
|
+
parent_aspect_method
|
|
342
|
+
parent_aspect_parent_method_child_definition
|
|
343
|
+
],
|
|
344
|
+
)
|
|
345
|
+
end
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
describe 'can have aspects from a parent defined on the super child' do
|
|
349
|
+
it 'does not affect the parent class' do
|
|
350
|
+
result = ParentClass.new.parent_aspect_parent_method_super_child_definition
|
|
351
|
+
|
|
352
|
+
expect(result.methods_called).to eq(
|
|
353
|
+
%w[
|
|
354
|
+
parent_aspect_parent_method_super_child_definition
|
|
355
|
+
],
|
|
356
|
+
)
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
it 'does not affect the child class' do
|
|
360
|
+
result = ChildClass.new.parent_aspect_parent_method_super_child_definition
|
|
361
|
+
|
|
362
|
+
expect(result.methods_called).to eq(
|
|
363
|
+
%w[
|
|
364
|
+
parent_aspect_parent_method_super_child_definition
|
|
365
|
+
],
|
|
366
|
+
)
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
it 'does not affect the other child class' do
|
|
370
|
+
result = OtherChildClass.new.parent_aspect_parent_method_super_child_definition
|
|
371
|
+
|
|
372
|
+
expect(result.methods_called).to eq(
|
|
373
|
+
%w[
|
|
374
|
+
parent_aspect_parent_method_super_child_definition
|
|
375
|
+
],
|
|
376
|
+
)
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
it 'does affect the super child class' do
|
|
380
|
+
result = SuperChildClass.new.parent_aspect_parent_method_super_child_definition
|
|
381
|
+
|
|
382
|
+
expect(result.methods_called).to eq(
|
|
383
|
+
%w[
|
|
384
|
+
parent_aspect_method
|
|
385
|
+
parent_aspect_parent_method_super_child_definition
|
|
386
|
+
],
|
|
387
|
+
)
|
|
388
|
+
end
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
describe 'can have aspects from a child defined on the parent' do
|
|
392
|
+
it 'does not affect the parent class' do
|
|
393
|
+
# The specified aspect is not defined on the parent class
|
|
394
|
+
expect do
|
|
395
|
+
ParentClass.new.child_aspect_parent_method_parent_definition
|
|
396
|
+
end.to raise_error(NoMethodError)
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
it 'does affect the child class' do
|
|
400
|
+
result = ChildClass.new.child_aspect_parent_method_parent_definition
|
|
401
|
+
|
|
402
|
+
expect(result.methods_called).to eq(
|
|
403
|
+
%w[
|
|
404
|
+
child_aspect_method
|
|
405
|
+
child_aspect_parent_method_parent_definition
|
|
406
|
+
],
|
|
407
|
+
)
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
it 'does affect the other child class' do
|
|
411
|
+
result = OtherChildClass.new.child_aspect_parent_method_parent_definition
|
|
412
|
+
|
|
413
|
+
expect(result.methods_called).to eq(
|
|
414
|
+
%w[
|
|
415
|
+
other_child_aspect_method
|
|
416
|
+
child_aspect_parent_method_parent_definition
|
|
417
|
+
],
|
|
418
|
+
)
|
|
419
|
+
end
|
|
420
|
+
|
|
421
|
+
it 'does affect the super child class' do
|
|
422
|
+
result = SuperChildClass.new.child_aspect_parent_method_parent_definition
|
|
423
|
+
|
|
424
|
+
expect(result.methods_called).to eq(
|
|
425
|
+
%w[
|
|
426
|
+
child_aspect_method
|
|
427
|
+
child_aspect_parent_method_parent_definition
|
|
428
|
+
],
|
|
429
|
+
)
|
|
430
|
+
end
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
describe 'can have aspects from a child defined on the child' do
|
|
434
|
+
it 'does not affect the parent class' do
|
|
435
|
+
result = ParentClass.new.child_aspect_parent_method_child_definition
|
|
436
|
+
|
|
437
|
+
expect(result.methods_called).to eq(
|
|
438
|
+
%w[
|
|
439
|
+
child_aspect_parent_method_child_definition
|
|
440
|
+
],
|
|
441
|
+
)
|
|
442
|
+
end
|
|
443
|
+
|
|
444
|
+
it 'does affect the child class' do
|
|
445
|
+
result = ChildClass.new.child_aspect_parent_method_child_definition
|
|
446
|
+
|
|
447
|
+
expect(result.methods_called).to eq(
|
|
448
|
+
%w[
|
|
449
|
+
child_aspect_method
|
|
450
|
+
child_aspect_parent_method_child_definition
|
|
451
|
+
],
|
|
452
|
+
)
|
|
453
|
+
end
|
|
454
|
+
|
|
455
|
+
it 'does affect the other child class' do
|
|
456
|
+
result = OtherChildClass.new.child_aspect_parent_method_child_definition
|
|
457
|
+
|
|
458
|
+
expect(result.methods_called).to eq(
|
|
459
|
+
%w[
|
|
460
|
+
other_child_aspect_method
|
|
461
|
+
child_aspect_parent_method_child_definition
|
|
462
|
+
],
|
|
463
|
+
)
|
|
464
|
+
end
|
|
465
|
+
|
|
466
|
+
it 'does affect the super child class' do
|
|
467
|
+
result = SuperChildClass.new.child_aspect_parent_method_child_definition
|
|
468
|
+
|
|
469
|
+
expect(result.methods_called).to eq(
|
|
470
|
+
%w[
|
|
471
|
+
child_aspect_method
|
|
472
|
+
child_aspect_parent_method_child_definition
|
|
473
|
+
],
|
|
474
|
+
)
|
|
475
|
+
end
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
describe 'can have aspects from a child defined on the super child' do
|
|
479
|
+
it 'does not affect the parent class' do
|
|
480
|
+
result = ParentClass.new.child_aspect_parent_method_super_child_definition
|
|
481
|
+
|
|
482
|
+
expect(result.methods_called).to eq(
|
|
483
|
+
%w[
|
|
484
|
+
child_aspect_parent_method_super_child_definition
|
|
485
|
+
],
|
|
486
|
+
)
|
|
487
|
+
end
|
|
488
|
+
|
|
489
|
+
it 'does not affect the child class' do
|
|
490
|
+
result = ChildClass.new.child_aspect_parent_method_super_child_definition
|
|
491
|
+
|
|
492
|
+
expect(result.methods_called).to eq(
|
|
493
|
+
%w[
|
|
494
|
+
child_aspect_parent_method_super_child_definition
|
|
495
|
+
],
|
|
496
|
+
)
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
it 'does not affect the other child class' do
|
|
500
|
+
result = OtherChildClass.new.child_aspect_parent_method_super_child_definition
|
|
501
|
+
|
|
502
|
+
expect(result.methods_called).to eq(
|
|
503
|
+
%w[
|
|
504
|
+
child_aspect_parent_method_super_child_definition
|
|
505
|
+
],
|
|
506
|
+
)
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
it 'does affect the super child class' do
|
|
510
|
+
result = SuperChildClass.new.child_aspect_parent_method_super_child_definition
|
|
511
|
+
|
|
512
|
+
expect(result.methods_called).to eq(
|
|
513
|
+
%w[
|
|
514
|
+
child_aspect_method
|
|
515
|
+
child_aspect_parent_method_super_child_definition
|
|
516
|
+
],
|
|
517
|
+
)
|
|
518
|
+
end
|
|
519
|
+
end
|
|
520
|
+
|
|
521
|
+
describe 'can have aspects from a super child defined on the parent' do
|
|
522
|
+
it 'does not affect the parent class' do
|
|
523
|
+
# The specified aspect is not defined on the parent class
|
|
524
|
+
expect do
|
|
525
|
+
ParentClass.new.super_child_aspect_parent_method_parent_definition
|
|
526
|
+
end.to raise_error(NoMethodError)
|
|
527
|
+
end
|
|
528
|
+
|
|
529
|
+
it 'does not affect the child class' do
|
|
530
|
+
# The specified aspect is not defined on the child class
|
|
531
|
+
expect do
|
|
532
|
+
ChildClass.new.super_child_aspect_parent_method_parent_definition
|
|
533
|
+
end.to raise_error(NoMethodError)
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
it 'does not affect the other child class' do
|
|
537
|
+
# The specified aspect is not defined on the other child class
|
|
538
|
+
expect do
|
|
539
|
+
ChildClass.new.super_child_aspect_parent_method_parent_definition
|
|
540
|
+
end.to raise_error(NoMethodError)
|
|
541
|
+
end
|
|
542
|
+
|
|
543
|
+
it 'does affect the super child class' do
|
|
544
|
+
result = SuperChildClass.new.super_child_aspect_parent_method_parent_definition
|
|
545
|
+
|
|
546
|
+
expect(result.methods_called).to eq(
|
|
547
|
+
%w[
|
|
548
|
+
super_child_aspect_method
|
|
549
|
+
super_child_aspect_parent_method_parent_definition
|
|
550
|
+
],
|
|
551
|
+
)
|
|
552
|
+
end
|
|
553
|
+
end
|
|
554
|
+
|
|
555
|
+
describe 'can have aspects from a super child defined on the child' do
|
|
556
|
+
it 'does not affect the parent class' do
|
|
557
|
+
result = ParentClass.new.super_child_aspect_parent_method_child_definition
|
|
558
|
+
|
|
559
|
+
expect(result.methods_called).to eq(
|
|
560
|
+
%w[
|
|
561
|
+
super_child_aspect_parent_method_child_definition
|
|
562
|
+
],
|
|
563
|
+
)
|
|
564
|
+
end
|
|
565
|
+
|
|
566
|
+
it 'does not affect the child class' do
|
|
567
|
+
# The specified aspect is not defined on the child class
|
|
568
|
+
expect do
|
|
569
|
+
ChildClass.new.super_child_aspect_parent_method_child_definition
|
|
570
|
+
end.to raise_error(NoMethodError)
|
|
571
|
+
end
|
|
572
|
+
|
|
573
|
+
it 'does not affect the other child class' do
|
|
574
|
+
# The specified aspect is not defined on the other child class
|
|
575
|
+
expect do
|
|
576
|
+
ChildClass.new.super_child_aspect_parent_method_child_definition
|
|
577
|
+
end.to raise_error(NoMethodError)
|
|
578
|
+
end
|
|
579
|
+
|
|
580
|
+
it 'does affect the super child class' do
|
|
581
|
+
result = SuperChildClass.new.super_child_aspect_parent_method_child_definition
|
|
582
|
+
|
|
583
|
+
expect(result.methods_called).to eq(
|
|
584
|
+
%w[
|
|
585
|
+
super_child_aspect_method
|
|
586
|
+
super_child_aspect_parent_method_child_definition
|
|
587
|
+
],
|
|
588
|
+
)
|
|
589
|
+
end
|
|
590
|
+
end
|
|
591
|
+
|
|
592
|
+
describe 'can have aspects from a super child defined on the super child' do
|
|
593
|
+
it 'does not affect the parent class' do
|
|
594
|
+
result = ParentClass.new.super_child_aspect_parent_method_super_child_definition
|
|
595
|
+
|
|
596
|
+
expect(result.methods_called).to eq(
|
|
597
|
+
%w[
|
|
598
|
+
super_child_aspect_parent_method_super_child_definition
|
|
599
|
+
],
|
|
600
|
+
)
|
|
601
|
+
end
|
|
602
|
+
|
|
603
|
+
it 'does not affect the child class' do
|
|
604
|
+
result = ChildClass.new.super_child_aspect_parent_method_super_child_definition
|
|
605
|
+
|
|
606
|
+
expect(result.methods_called).to eq(
|
|
607
|
+
%w[
|
|
608
|
+
super_child_aspect_parent_method_super_child_definition
|
|
609
|
+
],
|
|
610
|
+
)
|
|
611
|
+
end
|
|
612
|
+
|
|
613
|
+
it 'does not affect the other child class' do
|
|
614
|
+
result = OtherChildClass.new.super_child_aspect_parent_method_super_child_definition
|
|
615
|
+
|
|
616
|
+
expect(result.methods_called).to eq(
|
|
617
|
+
%w[
|
|
618
|
+
super_child_aspect_parent_method_super_child_definition
|
|
619
|
+
],
|
|
620
|
+
)
|
|
621
|
+
end
|
|
622
|
+
|
|
623
|
+
it 'does affect the super child class' do
|
|
624
|
+
result = SuperChildClass.new.super_child_aspect_parent_method_super_child_definition
|
|
625
|
+
|
|
626
|
+
expect(result.methods_called).to eq(
|
|
627
|
+
%w[
|
|
628
|
+
super_child_aspect_method
|
|
629
|
+
super_child_aspect_parent_method_super_child_definition
|
|
630
|
+
],
|
|
631
|
+
)
|
|
632
|
+
end
|
|
633
|
+
end
|
|
634
|
+
end
|
|
635
|
+
|
|
636
|
+
describe 'methods defined on the child' do
|
|
637
|
+
it 'can override parent definitions' do
|
|
638
|
+
result = ChildClass.new.overridden_method
|
|
639
|
+
|
|
640
|
+
expect(result.methods_called).to eq(
|
|
641
|
+
%w[
|
|
642
|
+
overridden_child_aspect_method
|
|
643
|
+
overridden_child_method
|
|
644
|
+
],
|
|
645
|
+
)
|
|
646
|
+
end
|
|
647
|
+
|
|
648
|
+
describe 'can have aspects from the parent defined on the parent' do
|
|
649
|
+
it 'does not affect the parent class' do
|
|
650
|
+
# The specified method is not defined on the parent class
|
|
651
|
+
expect do
|
|
652
|
+
ParentClass.new.parent_aspect_child_method_parent_definition
|
|
653
|
+
end.to raise_error(NoMethodError)
|
|
654
|
+
end
|
|
655
|
+
|
|
656
|
+
it 'does affect the child class' do
|
|
657
|
+
result = ChildClass.new.parent_aspect_child_method_parent_definition
|
|
658
|
+
|
|
659
|
+
expect(result.methods_called).to eq(
|
|
660
|
+
%w[
|
|
661
|
+
parent_aspect_method
|
|
662
|
+
parent_aspect_child_method_parent_definition
|
|
663
|
+
],
|
|
664
|
+
)
|
|
665
|
+
end
|
|
666
|
+
|
|
667
|
+
it 'does affect the other child class' do
|
|
668
|
+
result = OtherChildClass.new.parent_aspect_child_method_parent_definition
|
|
669
|
+
|
|
670
|
+
expect(result.methods_called).to eq(
|
|
671
|
+
%w[
|
|
672
|
+
parent_aspect_method
|
|
673
|
+
parent_aspect_other_child_method_parent_definition
|
|
674
|
+
],
|
|
675
|
+
)
|
|
676
|
+
end
|
|
677
|
+
|
|
678
|
+
it 'does affect the super child class' do
|
|
679
|
+
result = SuperChildClass.new.parent_aspect_child_method_parent_definition
|
|
680
|
+
|
|
681
|
+
expect(result.methods_called).to eq(
|
|
682
|
+
%w[
|
|
683
|
+
parent_aspect_method
|
|
684
|
+
parent_aspect_child_method_parent_definition
|
|
685
|
+
],
|
|
686
|
+
)
|
|
687
|
+
end
|
|
688
|
+
end
|
|
689
|
+
|
|
690
|
+
describe 'can have aspects from the parent defined on the child' do
|
|
691
|
+
it 'does not affect the parent class' do
|
|
692
|
+
# The specified method is not defined on the parent class
|
|
693
|
+
expect do
|
|
694
|
+
ParentClass.new.parent_aspect_child_method_child_definition
|
|
695
|
+
end.to raise_error(NoMethodError)
|
|
696
|
+
end
|
|
697
|
+
|
|
698
|
+
it 'does affect the child class' do
|
|
699
|
+
result = ChildClass.new.parent_aspect_child_method_child_definition
|
|
700
|
+
|
|
701
|
+
expect(result.methods_called).to eq(
|
|
702
|
+
%w[
|
|
703
|
+
parent_aspect_method
|
|
704
|
+
parent_aspect_child_method_child_definition
|
|
705
|
+
],
|
|
706
|
+
)
|
|
707
|
+
end
|
|
708
|
+
|
|
709
|
+
it 'does not affect the other child class' do
|
|
710
|
+
result = OtherChildClass.new.parent_aspect_child_method_child_definition
|
|
711
|
+
|
|
712
|
+
expect(result.methods_called).to eq(
|
|
713
|
+
%w[
|
|
714
|
+
parent_aspect_other_child_method_other_child_definition
|
|
715
|
+
],
|
|
716
|
+
)
|
|
717
|
+
end
|
|
718
|
+
|
|
719
|
+
it 'does affect the super child class' do
|
|
720
|
+
result = SuperChildClass.new.parent_aspect_child_method_child_definition
|
|
721
|
+
|
|
722
|
+
expect(result.methods_called).to eq(
|
|
723
|
+
%w[
|
|
724
|
+
parent_aspect_method
|
|
725
|
+
parent_aspect_child_method_child_definition
|
|
726
|
+
],
|
|
727
|
+
)
|
|
728
|
+
end
|
|
729
|
+
end
|
|
730
|
+
|
|
731
|
+
describe 'can have aspects from the parent defined on the super child' do
|
|
732
|
+
it 'does not affect the parent class' do
|
|
733
|
+
# The specified method is not defined on the parent class
|
|
734
|
+
expect do
|
|
735
|
+
ParentClass.new.parent_aspect_child_method_super_child_definition
|
|
736
|
+
end.to raise_error(NoMethodError)
|
|
737
|
+
end
|
|
738
|
+
|
|
739
|
+
it 'does not affect the child class' do
|
|
740
|
+
result = ChildClass.new.parent_aspect_child_method_super_child_definition
|
|
741
|
+
|
|
742
|
+
expect(result.methods_called).to eq(
|
|
743
|
+
%w[
|
|
744
|
+
parent_aspect_child_method_super_child_definition
|
|
745
|
+
],
|
|
746
|
+
)
|
|
747
|
+
end
|
|
748
|
+
|
|
749
|
+
it 'does not affect the other child class' do
|
|
750
|
+
result = OtherChildClass.new.parent_aspect_child_method_super_child_definition
|
|
751
|
+
|
|
752
|
+
expect(result.methods_called).to eq(
|
|
753
|
+
%w[
|
|
754
|
+
parent_aspect_other_child_method_super_child_definition
|
|
755
|
+
],
|
|
756
|
+
)
|
|
757
|
+
end
|
|
758
|
+
|
|
759
|
+
it 'does affect the super child class' do
|
|
760
|
+
result = SuperChildClass.new.parent_aspect_child_method_super_child_definition
|
|
761
|
+
|
|
762
|
+
expect(result.methods_called).to eq(
|
|
763
|
+
%w[
|
|
764
|
+
parent_aspect_method
|
|
765
|
+
parent_aspect_child_method_super_child_definition
|
|
766
|
+
],
|
|
767
|
+
)
|
|
768
|
+
end
|
|
769
|
+
end
|
|
770
|
+
|
|
771
|
+
describe 'can have aspects from the child defined on the parent' do
|
|
772
|
+
it 'does not affect the parent class' do
|
|
773
|
+
# The specified method is not defined on the parent class
|
|
774
|
+
expect do
|
|
775
|
+
ParentClass.new.child_aspect_child_method_parent_definition
|
|
776
|
+
end.to raise_error(NoMethodError)
|
|
777
|
+
end
|
|
778
|
+
|
|
779
|
+
it 'does affect the child class' do
|
|
780
|
+
result = ChildClass.new.child_aspect_child_method_parent_definition
|
|
781
|
+
|
|
782
|
+
expect(result.methods_called).to eq(
|
|
783
|
+
%w[
|
|
784
|
+
child_aspect_method
|
|
785
|
+
child_aspect_child_method_parent_definition
|
|
786
|
+
],
|
|
787
|
+
)
|
|
788
|
+
end
|
|
789
|
+
|
|
790
|
+
it 'does affect the other child class' do
|
|
791
|
+
result = OtherChildClass.new.child_aspect_child_method_parent_definition
|
|
792
|
+
|
|
793
|
+
expect(result.methods_called).to eq(
|
|
794
|
+
%w[
|
|
795
|
+
other_child_aspect_method
|
|
796
|
+
child_aspect_other_child_method_parent_definition
|
|
797
|
+
],
|
|
798
|
+
)
|
|
799
|
+
end
|
|
800
|
+
|
|
801
|
+
it 'does affect the super child class' do
|
|
802
|
+
result = SuperChildClass.new.child_aspect_child_method_parent_definition
|
|
803
|
+
|
|
804
|
+
expect(result.methods_called).to eq(
|
|
805
|
+
%w[
|
|
806
|
+
child_aspect_method
|
|
807
|
+
child_aspect_child_method_parent_definition
|
|
808
|
+
],
|
|
809
|
+
)
|
|
810
|
+
end
|
|
811
|
+
end
|
|
812
|
+
|
|
813
|
+
describe 'can have aspects from the child defined on the super child' do
|
|
814
|
+
it 'does not affect the parent class' do
|
|
815
|
+
# The specified method is not defined on the parent class
|
|
816
|
+
expect do
|
|
817
|
+
ParentClass.new.child_aspect_child_method_super_child_definition
|
|
818
|
+
end.to raise_error(NoMethodError)
|
|
819
|
+
end
|
|
820
|
+
|
|
821
|
+
it 'does not affect the child class' do
|
|
822
|
+
result = ChildClass.new.child_aspect_child_method_super_child_definition
|
|
823
|
+
|
|
824
|
+
expect(result.methods_called).to eq(
|
|
825
|
+
%w[
|
|
826
|
+
child_aspect_child_method_super_child_definition
|
|
827
|
+
],
|
|
828
|
+
)
|
|
829
|
+
end
|
|
830
|
+
|
|
831
|
+
it 'does affect the other child class' do
|
|
832
|
+
result = OtherChildClass.new.child_aspect_child_method_super_child_definition
|
|
833
|
+
|
|
834
|
+
expect(result.methods_called).to eq(
|
|
835
|
+
%w[
|
|
836
|
+
child_aspect_other_child_method_super_child_definition
|
|
837
|
+
],
|
|
838
|
+
)
|
|
839
|
+
end
|
|
840
|
+
|
|
841
|
+
it 'does affect the super child class' do
|
|
842
|
+
result = SuperChildClass.new.child_aspect_child_method_super_child_definition
|
|
843
|
+
|
|
844
|
+
expect(result.methods_called).to eq(
|
|
845
|
+
%w[
|
|
846
|
+
child_aspect_method
|
|
847
|
+
child_aspect_child_method_super_child_definition
|
|
848
|
+
],
|
|
849
|
+
)
|
|
850
|
+
end
|
|
851
|
+
end
|
|
852
|
+
|
|
853
|
+
describe 'can have aspects from the super child defined on the parent' do
|
|
854
|
+
it 'does not affect the parent class' do
|
|
855
|
+
# The specified method is not defined on the parent class
|
|
856
|
+
expect do
|
|
857
|
+
ParentClass.new.super_child_aspect_child_method_parent_definition
|
|
858
|
+
end.to raise_error(NoMethodError)
|
|
859
|
+
end
|
|
860
|
+
|
|
861
|
+
it 'does not affect the child class' do
|
|
862
|
+
# The specified aspect is not defined on the child class
|
|
863
|
+
expect do
|
|
864
|
+
ChildClass.new.super_child_aspect_child_method_parent_definition
|
|
865
|
+
end.to raise_error(NoMethodError)
|
|
866
|
+
end
|
|
867
|
+
|
|
868
|
+
it 'does not affect the other child class' do
|
|
869
|
+
# The specified aspect is not defined on the other child class
|
|
870
|
+
expect do
|
|
871
|
+
OtherChildClass.new.super_child_aspect_child_method_parent_definition
|
|
872
|
+
end.to raise_error(NoMethodError)
|
|
873
|
+
end
|
|
874
|
+
|
|
875
|
+
it 'does affect the super child class' do
|
|
876
|
+
result = SuperChildClass.new.super_child_aspect_child_method_parent_definition
|
|
877
|
+
|
|
878
|
+
expect(result.methods_called).to eq(
|
|
879
|
+
%w[
|
|
880
|
+
super_child_aspect_method
|
|
881
|
+
super_child_aspect_child_method_parent_definition
|
|
882
|
+
],
|
|
883
|
+
)
|
|
884
|
+
end
|
|
885
|
+
end
|
|
886
|
+
|
|
887
|
+
describe 'can have aspects from the super child defined on the child' do
|
|
888
|
+
it 'does not affect the parent class' do
|
|
889
|
+
# The specified method is not defined on the parent class
|
|
890
|
+
expect do
|
|
891
|
+
ParentClass.new.super_child_aspect_child_method_child_definition
|
|
892
|
+
end.to raise_error(NoMethodError)
|
|
893
|
+
end
|
|
894
|
+
|
|
895
|
+
it 'does not affect the child class' do
|
|
896
|
+
# The specified aspect is not defined on the child class
|
|
897
|
+
expect do
|
|
898
|
+
ChildClass.new.super_child_aspect_child_method_child_definition
|
|
899
|
+
end.to raise_error(NoMethodError)
|
|
900
|
+
end
|
|
901
|
+
|
|
902
|
+
it 'does not affect the other child class' do
|
|
903
|
+
# The specified aspect is not defined on the other child class
|
|
904
|
+
expect do
|
|
905
|
+
OtherChildClass.new.super_child_aspect_child_method_child_definition
|
|
906
|
+
end.to raise_error(NoMethodError)
|
|
907
|
+
end
|
|
908
|
+
|
|
909
|
+
it 'does affect the super child class' do
|
|
910
|
+
result = SuperChildClass.new.super_child_aspect_child_method_child_definition
|
|
911
|
+
|
|
912
|
+
expect(result.methods_called).to eq(
|
|
913
|
+
%w[
|
|
914
|
+
super_child_aspect_method
|
|
915
|
+
super_child_aspect_child_method_child_definition
|
|
916
|
+
],
|
|
917
|
+
)
|
|
918
|
+
end
|
|
919
|
+
end
|
|
920
|
+
|
|
921
|
+
describe 'can have aspects from the super child defined on the super child' do
|
|
922
|
+
it 'does not affect the parent class' do
|
|
923
|
+
# The specified method is not defined on the parent class
|
|
924
|
+
expect do
|
|
925
|
+
ParentClass.new.super_child_aspect_child_method_super_child_definition
|
|
926
|
+
end.to raise_error(NoMethodError)
|
|
927
|
+
end
|
|
928
|
+
|
|
929
|
+
it 'does not affect the child class' do
|
|
930
|
+
result = ChildClass.new.child_aspect_child_method_super_child_definition
|
|
931
|
+
|
|
932
|
+
expect(result.methods_called).to eq(
|
|
933
|
+
%w[
|
|
934
|
+
child_aspect_child_method_super_child_definition
|
|
935
|
+
],
|
|
936
|
+
)
|
|
937
|
+
end
|
|
938
|
+
|
|
939
|
+
it 'does not affect the other child class' do
|
|
940
|
+
result = OtherChildClass.new.child_aspect_child_method_super_child_definition
|
|
941
|
+
|
|
942
|
+
expect(result.methods_called).to eq(
|
|
943
|
+
%w[
|
|
944
|
+
child_aspect_other_child_method_super_child_definition
|
|
945
|
+
],
|
|
946
|
+
)
|
|
947
|
+
end
|
|
948
|
+
|
|
949
|
+
it 'does affect the super child class' do
|
|
950
|
+
result = SuperChildClass.new.super_child_aspect_child_method_super_child_definition
|
|
951
|
+
|
|
952
|
+
expect(result.methods_called).to eq(
|
|
953
|
+
%w[
|
|
954
|
+
super_child_aspect_method
|
|
955
|
+
super_child_aspect_child_method_super_child_definition
|
|
956
|
+
],
|
|
957
|
+
)
|
|
958
|
+
end
|
|
959
|
+
end
|
|
960
|
+
end
|
|
961
|
+
|
|
962
|
+
describe 'methods defined on the super child' do
|
|
963
|
+
it 'can override parent definitions' do
|
|
964
|
+
result = SuperChildClass.new.overridden_method
|
|
965
|
+
|
|
966
|
+
expect(result.methods_called).to eq(
|
|
967
|
+
%w[
|
|
968
|
+
overridden_super_child_aspect_method
|
|
969
|
+
overridden_super_child_method
|
|
970
|
+
],
|
|
971
|
+
)
|
|
972
|
+
end
|
|
973
|
+
|
|
974
|
+
describe 'can have aspects from the parent defined on the parent' do
|
|
975
|
+
it 'does not affect the parent class' do
|
|
976
|
+
# The specified method is not defined on the parent class
|
|
977
|
+
expect do
|
|
978
|
+
ParentClass.new.parent_aspect_super_child_method_parent_definition
|
|
979
|
+
end.to raise_error(NoMethodError)
|
|
980
|
+
end
|
|
981
|
+
|
|
982
|
+
it 'does not affect the child class' do
|
|
983
|
+
# The specified method is not defined on the child class
|
|
984
|
+
expect do
|
|
985
|
+
ChildClass.new.parent_aspect_super_child_method_parent_definition
|
|
986
|
+
end.to raise_error(NoMethodError)
|
|
987
|
+
end
|
|
988
|
+
|
|
989
|
+
it 'does not affect the other child class' do
|
|
990
|
+
# The specified method is not defined on the other child class
|
|
991
|
+
expect do
|
|
992
|
+
OtherChildClass.new.parent_aspect_super_child_method_parent_definition
|
|
993
|
+
end.to raise_error(NoMethodError)
|
|
994
|
+
end
|
|
995
|
+
|
|
996
|
+
it 'does affect the super child class' do
|
|
997
|
+
result = SuperChildClass.new.parent_aspect_super_child_method_parent_definition
|
|
998
|
+
|
|
999
|
+
expect(result.methods_called).to eq(
|
|
1000
|
+
%w[
|
|
1001
|
+
parent_aspect_method
|
|
1002
|
+
parent_aspect_super_child_method_parent_definition
|
|
1003
|
+
],
|
|
1004
|
+
)
|
|
1005
|
+
end
|
|
1006
|
+
end
|
|
1007
|
+
end
|
|
1008
|
+
|
|
1009
|
+
describe 'can have aspects from the parent defined on the child' do
|
|
1010
|
+
it 'does not affect the parent class' do
|
|
1011
|
+
# The specified method is not defined on the parent class
|
|
1012
|
+
expect do
|
|
1013
|
+
ParentClass.new.parent_aspect_super_child_method_child_definition
|
|
1014
|
+
end.to raise_error(NoMethodError)
|
|
1015
|
+
end
|
|
1016
|
+
|
|
1017
|
+
it 'does not affect the child class' do
|
|
1018
|
+
# The specified method is not defined on the child class
|
|
1019
|
+
expect do
|
|
1020
|
+
ChildClass.new.parent_aspect_super_child_method_child_definition
|
|
1021
|
+
end.to raise_error(NoMethodError)
|
|
1022
|
+
end
|
|
1023
|
+
|
|
1024
|
+
it 'does not affect the other child class' do
|
|
1025
|
+
# The specified method is not defined on the other child class
|
|
1026
|
+
expect do
|
|
1027
|
+
OtherChildClass.new.parent_aspect_super_child_method_child_definition
|
|
1028
|
+
end.to raise_error(NoMethodError)
|
|
1029
|
+
end
|
|
1030
|
+
|
|
1031
|
+
it 'does affect the super child class' do
|
|
1032
|
+
result = SuperChildClass.new.parent_aspect_super_child_method_child_definition
|
|
1033
|
+
|
|
1034
|
+
expect(result.methods_called).to eq(
|
|
1035
|
+
%w[
|
|
1036
|
+
parent_aspect_method
|
|
1037
|
+
parent_aspect_super_child_method_child_definition
|
|
1038
|
+
],
|
|
1039
|
+
)
|
|
1040
|
+
end
|
|
1041
|
+
end
|
|
1042
|
+
|
|
1043
|
+
describe 'can have aspects from the parent defined on the super child' do
|
|
1044
|
+
it 'does not affect the parent class' do
|
|
1045
|
+
# The specified method is not defined on the parent class
|
|
1046
|
+
expect do
|
|
1047
|
+
ParentClass.new.parent_aspect_super_child_method_super_child_definition
|
|
1048
|
+
end.to raise_error(NoMethodError)
|
|
1049
|
+
end
|
|
1050
|
+
|
|
1051
|
+
it 'does not affect the child class' do
|
|
1052
|
+
# The specified method is not defined on the child class
|
|
1053
|
+
expect do
|
|
1054
|
+
ChildClass.new.parent_aspect_super_child_method_super_child_definition
|
|
1055
|
+
end.to raise_error(NoMethodError)
|
|
1056
|
+
end
|
|
1057
|
+
|
|
1058
|
+
it 'does not affect the other child class' do
|
|
1059
|
+
# The specified method is not defined on the other child class
|
|
1060
|
+
expect do
|
|
1061
|
+
OtherChildClass.new.parent_aspect_super_child_method_super_child_definition
|
|
1062
|
+
end.to raise_error(NoMethodError)
|
|
1063
|
+
end
|
|
1064
|
+
|
|
1065
|
+
it 'does affect the super child class' do
|
|
1066
|
+
result = SuperChildClass.new.parent_aspect_super_child_method_super_child_definition
|
|
1067
|
+
|
|
1068
|
+
expect(result.methods_called).to eq(
|
|
1069
|
+
%w[
|
|
1070
|
+
parent_aspect_method
|
|
1071
|
+
parent_aspect_super_child_method_super_child_definition
|
|
1072
|
+
],
|
|
1073
|
+
)
|
|
1074
|
+
end
|
|
1075
|
+
end
|
|
1076
|
+
|
|
1077
|
+
describe 'can have aspects from the child defined on the parent' do
|
|
1078
|
+
it 'does not affect the parent class' do
|
|
1079
|
+
# The specified method is not defined on the parent class
|
|
1080
|
+
expect do
|
|
1081
|
+
ParentClass.new.child_aspect_super_child_method_parent_definition
|
|
1082
|
+
end.to raise_error(NoMethodError)
|
|
1083
|
+
end
|
|
1084
|
+
|
|
1085
|
+
it 'does not affect the child class' do
|
|
1086
|
+
# The specified method is not defined on the child class
|
|
1087
|
+
expect do
|
|
1088
|
+
ChildClass.new.child_aspect_super_child_method_parent_definition
|
|
1089
|
+
end.to raise_error(NoMethodError)
|
|
1090
|
+
end
|
|
1091
|
+
|
|
1092
|
+
it 'does not affect the other child class' do
|
|
1093
|
+
# The specified method is not defined on the other child class
|
|
1094
|
+
expect do
|
|
1095
|
+
OtherChildClass.new.child_aspect_super_child_method_parent_definition
|
|
1096
|
+
end.to raise_error(NoMethodError)
|
|
1097
|
+
end
|
|
1098
|
+
|
|
1099
|
+
it 'does affect the super child class' do
|
|
1100
|
+
result = SuperChildClass.new.child_aspect_super_child_method_parent_definition
|
|
1101
|
+
|
|
1102
|
+
expect(result.methods_called).to eq(
|
|
1103
|
+
%w[
|
|
1104
|
+
child_aspect_method
|
|
1105
|
+
child_aspect_super_child_method_parent_definition
|
|
1106
|
+
],
|
|
1107
|
+
)
|
|
1108
|
+
end
|
|
1109
|
+
end
|
|
1110
|
+
|
|
1111
|
+
describe 'can have aspects from the child defined on the child' do
|
|
1112
|
+
it 'does not affect the parent class' do
|
|
1113
|
+
# The specified method is not defined on the parent class
|
|
1114
|
+
expect do
|
|
1115
|
+
ParentClass.new.child_aspect_super_child_method_child_definition
|
|
1116
|
+
end.to raise_error(NoMethodError)
|
|
1117
|
+
end
|
|
1118
|
+
|
|
1119
|
+
it 'does not affect the child class' do
|
|
1120
|
+
# The specified method is not defined on the child class
|
|
1121
|
+
expect do
|
|
1122
|
+
ChildClass.new.child_aspect_super_child_method_child_definition
|
|
1123
|
+
end.to raise_error(NoMethodError)
|
|
1124
|
+
end
|
|
1125
|
+
|
|
1126
|
+
it 'does not affect the other child class' do
|
|
1127
|
+
# The specified method is not defined on the other child class
|
|
1128
|
+
expect do
|
|
1129
|
+
OtherChildClass.new.child_aspect_super_child_method_child_definition
|
|
1130
|
+
end.to raise_error(NoMethodError)
|
|
1131
|
+
end
|
|
1132
|
+
|
|
1133
|
+
it 'does affect the super child class' do
|
|
1134
|
+
result = SuperChildClass.new.child_aspect_super_child_method_child_definition
|
|
1135
|
+
|
|
1136
|
+
expect(result.methods_called).to eq(
|
|
1137
|
+
%w[
|
|
1138
|
+
child_aspect_method
|
|
1139
|
+
child_aspect_super_child_method_child_definition
|
|
1140
|
+
],
|
|
1141
|
+
)
|
|
1142
|
+
end
|
|
1143
|
+
end
|
|
1144
|
+
|
|
1145
|
+
describe 'can have aspects from the child defined on the super child' do
|
|
1146
|
+
it 'does not affect the parent class' do
|
|
1147
|
+
# The specified method is not defined on the parent class
|
|
1148
|
+
expect do
|
|
1149
|
+
ParentClass.new.child_aspect_super_child_method_super_child_definition
|
|
1150
|
+
end.to raise_error(NoMethodError)
|
|
1151
|
+
end
|
|
1152
|
+
|
|
1153
|
+
it 'does not affect the child class' do
|
|
1154
|
+
# The specified method is not defined on the child class
|
|
1155
|
+
expect do
|
|
1156
|
+
ChildClass.new.child_aspect_super_child_method_super_child_definition
|
|
1157
|
+
end.to raise_error(NoMethodError)
|
|
1158
|
+
end
|
|
1159
|
+
|
|
1160
|
+
it 'does not affect the other child class' do
|
|
1161
|
+
# The specified method is not defined on the other child class
|
|
1162
|
+
expect do
|
|
1163
|
+
OtherChildClass.new.child_aspect_super_child_method_super_child_definition
|
|
1164
|
+
end.to raise_error(NoMethodError)
|
|
1165
|
+
end
|
|
1166
|
+
|
|
1167
|
+
it 'does affect the super child class' do
|
|
1168
|
+
result = SuperChildClass.new.child_aspect_super_child_method_super_child_definition
|
|
1169
|
+
|
|
1170
|
+
expect(result.methods_called).to eq(
|
|
1171
|
+
%w[
|
|
1172
|
+
child_aspect_method
|
|
1173
|
+
child_aspect_super_child_method_super_child_definition
|
|
1174
|
+
],
|
|
1175
|
+
)
|
|
1176
|
+
end
|
|
1177
|
+
end
|
|
1178
|
+
|
|
1179
|
+
describe 'can have aspects from the super child defined on the parent' do
|
|
1180
|
+
it 'does not affect the parent class' do
|
|
1181
|
+
# The specified method is not defined on the parent class
|
|
1182
|
+
expect do
|
|
1183
|
+
ParentClass.new.super_child_aspect_super_child_method_parent_definition
|
|
1184
|
+
end.to raise_error(NoMethodError)
|
|
1185
|
+
end
|
|
1186
|
+
|
|
1187
|
+
it 'does not affect the child class' do
|
|
1188
|
+
# The specified method is not defined on the child class
|
|
1189
|
+
expect do
|
|
1190
|
+
ChildClass.new.super_child_aspect_super_child_method_parent_definition
|
|
1191
|
+
end.to raise_error(NoMethodError)
|
|
1192
|
+
end
|
|
1193
|
+
|
|
1194
|
+
it 'does not affect the other child class' do
|
|
1195
|
+
# The specified method is not defined on the other child class
|
|
1196
|
+
expect do
|
|
1197
|
+
OtherChildClass.new.super_child_aspect_super_child_method_parent_definition
|
|
1198
|
+
end.to raise_error(NoMethodError)
|
|
1199
|
+
end
|
|
1200
|
+
|
|
1201
|
+
it 'does affect the super child class' do
|
|
1202
|
+
result = SuperChildClass.new.super_child_aspect_super_child_method_parent_definition
|
|
1203
|
+
|
|
1204
|
+
expect(result.methods_called).to eq(
|
|
1205
|
+
%w[
|
|
1206
|
+
super_child_aspect_method
|
|
1207
|
+
super_child_aspect_super_child_method_parent_definition
|
|
1208
|
+
],
|
|
1209
|
+
)
|
|
1210
|
+
end
|
|
1211
|
+
end
|
|
1212
|
+
|
|
1213
|
+
describe 'can have aspects from the super child defined on the child' do
|
|
1214
|
+
it 'does not affect the parent class' do
|
|
1215
|
+
# The specified method is not defined on the parent class
|
|
1216
|
+
expect do
|
|
1217
|
+
ParentClass.new.super_child_aspect_super_child_method_child_definition
|
|
1218
|
+
end.to raise_error(NoMethodError)
|
|
1219
|
+
end
|
|
1220
|
+
|
|
1221
|
+
it 'does not affect the child class' do
|
|
1222
|
+
# The specified method is not defined on the child class
|
|
1223
|
+
expect do
|
|
1224
|
+
ChildClass.new.super_child_aspect_super_child_method_child_definition
|
|
1225
|
+
end.to raise_error(NoMethodError)
|
|
1226
|
+
end
|
|
1227
|
+
|
|
1228
|
+
it 'does not affect the other child class' do
|
|
1229
|
+
# The specified method is not defined on the other child class
|
|
1230
|
+
expect do
|
|
1231
|
+
OtherChildClass.new.super_child_aspect_super_child_method_child_definition
|
|
1232
|
+
end.to raise_error(NoMethodError)
|
|
1233
|
+
end
|
|
1234
|
+
|
|
1235
|
+
it 'does affect the super child class' do
|
|
1236
|
+
result = SuperChildClass.new.super_child_aspect_super_child_method_child_definition
|
|
1237
|
+
|
|
1238
|
+
expect(result.methods_called).to eq(
|
|
1239
|
+
%w[
|
|
1240
|
+
super_child_aspect_method
|
|
1241
|
+
super_child_aspect_super_child_method_child_definition
|
|
1242
|
+
],
|
|
1243
|
+
)
|
|
1244
|
+
end
|
|
1245
|
+
end
|
|
1246
|
+
end
|
|
1247
|
+
end
|