jackbox 0.9.6.6 → 0.9.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/LICENSE.lic +0 -0
- data/LICENSE.txt +7 -1
- data/README.md +509 -406
- data/Rakefile +5 -6
- data/Vagrantfile +77 -0
- data/bin/test-jacks +13 -0
- data/jackbox.gemspec +2 -2
- data/lib/jackbox.rb +1 -1
- data/lib/jackbox/examples/dir.rb +2 -7
- data/lib/jackbox/injectors.rb +1 -1
- data/lib/jackbox/injectors/coda.rb +1 -1
- data/lib/jackbox/injectors/prelude.rb +1 -1
- data/lib/jackbox/rake.rb +1 -1
- data/lib/jackbox/tools/prefs.rb +1 -1
- data/lib/jackbox/version.rb +1 -1
- data/spec/bin/jackup_cmd_shared.rb +2 -1
- data/spec/bin/jackup_cmd_spec.rb +4 -7
- data/spec/lib/jackbox/examples/dir_spec.rb +52 -17
- data/spec/lib/jackbox/injector_composition_spec.rb +554 -85
- data/spec/lib/jackbox/injector_inheritance_spec.rb +122 -75
- data/spec/lib/jackbox/injector_introspection_spec.rb +129 -187
- data/spec/lib/jackbox/injector_namespacing_spec.rb +19 -9
- data/spec/lib/jackbox/injector_spec.rb +2 -2
- data/spec/lib/jackbox/injector_versioning_spec.rb +37 -14
- data/spec/lib/jackbox/jiti_rules_spec.rb +536 -272
- data/spec/lib/jackbox/patterns_spec.rb +142 -105
- data/spec/lib/jackbox/prefs_spec.rb +50 -39
- data/spec/lib/jackbox/vmc_spec.rb +33 -28
- data/spec/lib/jackbox_spec.rb +39 -12
- data/spec/spec_helper.rb +33 -89
- data/work +8 -0
- metadata +26 -41
@@ -137,7 +137,7 @@ describe "Injector Inheritance" do
|
|
137
137
|
|
138
138
|
end
|
139
139
|
|
140
|
-
a "more complex example:
|
140
|
+
a "more complex example:" do
|
141
141
|
|
142
142
|
jack :player do
|
143
143
|
def sound
|
@@ -188,91 +188,138 @@ describe "Injector Inheritance" do
|
|
188
188
|
end
|
189
189
|
|
190
190
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
191
|
+
describe 'jiti' do
|
192
|
+
|
193
|
+
it "follows a just-in-time inheritance policy" do
|
194
|
+
|
195
|
+
########################## important ############################
|
196
|
+
# For more information on JIT Inheritance (jiti), please see: #
|
197
|
+
# the accompanying spec file jiti_rules_spec.rb in the specs #
|
198
|
+
# directory. #
|
199
|
+
#################################################################
|
200
|
+
|
201
|
+
injector :Functionality
|
202
|
+
|
203
|
+
#
|
204
|
+
# Our Modular Closure
|
205
|
+
#
|
206
|
+
Tag1 = Functionality do
|
207
|
+
def m1
|
208
|
+
1
|
209
|
+
end
|
210
|
+
|
211
|
+
def m2
|
212
|
+
:m2
|
213
|
+
end
|
201
214
|
end
|
202
|
-
|
203
|
-
|
204
|
-
|
215
|
+
|
216
|
+
expect(Tag1.ancestors).to eql( [Tag1] )
|
217
|
+
expect(Functionality().ancestors).to eql( [Functionality()] )
|
218
|
+
|
219
|
+
|
220
|
+
#
|
221
|
+
# Normal Injector inheritance
|
222
|
+
#
|
223
|
+
Functionality do
|
224
|
+
def other # No overrides No inheritance
|
225
|
+
'other' # -- same ancestors as before
|
226
|
+
end # -- normal trait inheritance
|
205
227
|
end
|
206
|
-
end
|
207
|
-
|
208
|
-
expect(Tag1.ancestors).to eql( [Tag1] )
|
209
|
-
expect(Functionality().ancestors).to eql( [Functionality()] )
|
210
228
|
|
229
|
+
# test it
|
230
|
+
|
231
|
+
expect(Tag1.ancestors).to eql( [Tag1] )
|
232
|
+
expect(Functionality().ancestors).to eql( [Functionality()] )
|
233
|
+
|
234
|
+
o = Object.new.extend(Functionality())
|
235
|
+
|
236
|
+
# inherited
|
237
|
+
o.m1.should == 1
|
238
|
+
o.m2.should == :m2
|
239
|
+
|
240
|
+
# current
|
241
|
+
o.other.should == 'other'
|
242
|
+
|
243
|
+
|
244
|
+
#
|
245
|
+
# JIT inheritance
|
246
|
+
#
|
247
|
+
Tag2 = Functionality do
|
248
|
+
def m1 # The :m1 override invokes JIT inheritance
|
249
|
+
super + 1 # -- Tag1 is added as ancestor
|
250
|
+
end # -- allows the use of super
|
251
|
+
|
252
|
+
def m3
|
253
|
+
'em3'
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
|
258
|
+
#####
|
259
|
+
# test it
|
260
|
+
|
261
|
+
p = Object.new.extend(Tag2)
|
262
|
+
|
263
|
+
# JIT inherited
|
264
|
+
p.m1.should == 2 # using inherited function
|
265
|
+
|
266
|
+
# regular inheritance
|
267
|
+
p.m2.should == :m2
|
268
|
+
p.m3.should == 'em3'
|
269
|
+
p.other.should == 'other'
|
270
|
+
|
271
|
+
expect(Functionality().ancestors).to eql( [Functionality(), Tag1] )
|
272
|
+
expect(Tag2.ancestors).to eql( [Tag2, Tag1] )
|
273
|
+
|
274
|
+
Functionality(:implode)
|
211
275
|
|
212
|
-
#
|
213
|
-
# Normal Injector inheritance
|
214
|
-
#
|
215
|
-
Functionality do
|
216
|
-
def other # No overrides No inheritance
|
217
|
-
'other' # -- same ancestors as before
|
218
|
-
end # -- normal trait inheritance
|
219
276
|
end
|
220
|
-
|
221
|
-
# test it
|
222
277
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
# current
|
233
|
-
o.other.should == 'other'
|
234
|
-
|
235
|
-
|
236
|
-
#
|
237
|
-
# JIT inheritance
|
238
|
-
#
|
239
|
-
Tag2 = Functionality do
|
240
|
-
def m1 # The :m1 override invokes JIT inheritance
|
241
|
-
super + 1 # -- Tag1 is added as ancestor
|
242
|
-
end # -- allows the use of super
|
278
|
+
but '#define_method skips all hard tags' do
|
279
|
+
|
280
|
+
injector :J1
|
281
|
+
|
282
|
+
J1Tag1 = J1 do
|
283
|
+
def m1
|
284
|
+
1
|
285
|
+
end
|
286
|
+
end
|
243
287
|
|
244
|
-
|
245
|
-
|
288
|
+
J1Tag2 = J1 do
|
289
|
+
def m1
|
290
|
+
super * 3
|
291
|
+
end
|
246
292
|
end
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
293
|
+
|
294
|
+
o = Object.new.enrich(J1Tag2)
|
295
|
+
o.m1.should == 3
|
296
|
+
|
297
|
+
J1Tag3 = J1 do
|
298
|
+
define_method :m1 do
|
299
|
+
super() + 4
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
expect { o.m1.should == 5 }.to raise_error(RSpec::Expectations::ExpectationNotMetError)
|
304
|
+
assert( o.m1 == 3 )
|
305
|
+
|
306
|
+
|
307
|
+
p = Object.new.extend J1Tag3
|
308
|
+
p.m1.should == 7
|
263
309
|
|
264
|
-
|
265
|
-
|
310
|
+
J1 do
|
311
|
+
define_method :m1 do
|
312
|
+
super() + 4
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
expect{ p.m1.should == 9 }.to raise_error(RSpec::Expectations::ExpectationNotMetError)
|
317
|
+
assert( o.m1 == 3 )
|
318
|
+
assert( p.m1 == 7 )
|
319
|
+
|
320
|
+
end
|
266
321
|
end
|
267
322
|
|
268
|
-
|
269
|
-
########################## important ############################
|
270
|
-
# For more information on JIT Inheritance (jiti), please see: #
|
271
|
-
# the accompanying spec file jiti_rules_spec.rb in the specs #
|
272
|
-
# directory. #
|
273
|
-
#################################################################
|
274
|
-
|
275
|
-
|
276
323
|
end
|
277
324
|
|
278
325
|
describe "the behavior of traits under class inheritance" do
|
@@ -239,7 +239,7 @@ describe "the introspection api in further detail" do
|
|
239
239
|
|
240
240
|
end
|
241
241
|
|
242
|
-
the ':all
|
242
|
+
the ':all option lists CLASS instance traits first and then OBJECT instance traits' do
|
243
243
|
|
244
244
|
trait :two
|
245
245
|
trait :one
|
@@ -252,32 +252,54 @@ describe "the introspection api in further detail" do
|
|
252
252
|
Array.traits(:all).sym_list.should == [:one, :two]
|
253
253
|
|
254
254
|
Array.new.traits.sym_list.should == [:two] # :one is member of Array.singleton_class
|
255
|
-
|
255
|
+
# and does not become part of Array.instances
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'also works on injector instances' do
|
259
|
+
|
260
|
+
trait :a, :b
|
261
|
+
|
262
|
+
a do
|
263
|
+
def foo
|
264
|
+
:foo
|
265
|
+
end
|
266
|
+
end
|
267
|
+
o = Object.new.extend(a)
|
268
|
+
o.foo.should == :foo
|
269
|
+
|
270
|
+
b do
|
271
|
+
def faa
|
272
|
+
:faa
|
273
|
+
end
|
274
|
+
end
|
275
|
+
a.extend b
|
276
|
+
a.faa.should == :faa
|
277
|
+
|
256
278
|
end
|
257
279
|
|
258
280
|
end
|
259
281
|
end
|
260
282
|
|
261
283
|
|
262
|
-
describe :history do
|
284
|
+
describe :history, '#versions' do
|
263
285
|
|
264
286
|
|
265
|
-
jack :
|
287
|
+
jack :Hsample
|
266
288
|
|
267
289
|
|
268
290
|
it 'does not show original jack' do
|
269
|
-
expect(
|
291
|
+
expect(Hsample().history.first).to eq(nil)
|
270
292
|
end
|
271
293
|
|
272
294
|
it "shows additional jacks once hosted, i.e.: after extend/include" do
|
273
295
|
|
274
|
-
extend(
|
296
|
+
extend(Hsample(), Hsample()) # host two items
|
275
297
|
|
276
|
-
traits.should ==
|
298
|
+
traits.should == Hsample().history # equal at this point
|
277
299
|
|
278
|
-
expect(
|
279
|
-
expect(
|
280
|
-
expect(
|
300
|
+
expect(Hsample().history.size).to eq(2)
|
301
|
+
expect(Hsample().history.last).to eql(traits.last)
|
302
|
+
expect(Hsample().history.first).to eq(traits.first)
|
281
303
|
expect(traits.size).to eq(2)
|
282
304
|
|
283
305
|
eject *traits
|
@@ -286,66 +308,102 @@ describe "the introspection api in further detail" do
|
|
286
308
|
|
287
309
|
it "allows you to retreive items using an index" do
|
288
310
|
|
289
|
-
extend
|
311
|
+
extend Hsample(), Hsample()
|
290
312
|
|
291
|
-
traits.should ==
|
313
|
+
traits.should == Hsample().history
|
292
314
|
|
293
|
-
expect(
|
294
|
-
expect(
|
315
|
+
expect(Hsample().history.slice(0)).to be_instance_of(Injector)
|
316
|
+
expect(Hsample().history.slice(1)).to be_instance_of(Injector)
|
295
317
|
|
296
|
-
eject
|
318
|
+
eject Hsample(), Hsample()
|
297
319
|
|
298
320
|
end
|
299
321
|
|
300
322
|
it 'swallows items once ejected' do
|
301
323
|
|
302
|
-
extend(
|
324
|
+
extend(Hsample(), Hsample())
|
303
325
|
|
304
|
-
traits.should ==
|
326
|
+
traits.should == Hsample().history
|
305
327
|
|
306
|
-
expect(
|
328
|
+
expect(Hsample().history.size).to eq(2)
|
307
329
|
expect(traits.size).to eq(2)
|
308
330
|
|
309
331
|
eject *traits
|
310
332
|
|
311
333
|
expect(traits).to be_empty # target traits
|
312
|
-
expect(
|
334
|
+
expect(Hsample().history).to be_empty # Injector history
|
313
335
|
|
314
336
|
end
|
315
337
|
|
316
338
|
it 'swallows un-hosted elements other than original one' do
|
317
339
|
|
318
|
-
|
319
|
-
|
340
|
+
Hsample() #un-hosted Hsample
|
341
|
+
Hsample() #un-hosted Hsample
|
320
342
|
|
321
|
-
expect(
|
343
|
+
expect(Hsample().history.size).to eq(0)
|
322
344
|
|
323
345
|
end
|
324
346
|
|
325
347
|
it 'shows hosted items upon inspection' do
|
326
348
|
|
327
|
-
extend
|
349
|
+
extend Hsample()
|
350
|
+
|
351
|
+
expect(Hsample().history.inspect).to match(/\[\(\|Hsample\|.+\)\]/)
|
352
|
+
expect(Hsample().history.size).to eq(1)
|
353
|
+
|
354
|
+
eject Hsample()
|
328
355
|
|
329
|
-
|
330
|
-
|
356
|
+
end
|
357
|
+
|
358
|
+
describe '#versions/#history under JITY' do
|
359
|
+
before do
|
360
|
+
trait :One
|
361
|
+
|
362
|
+
suppress_warnings do
|
363
|
+
OneTag = One do
|
364
|
+
def foo
|
365
|
+
'foo'
|
366
|
+
end
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
370
|
+
One do
|
371
|
+
def foo
|
372
|
+
super
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
end
|
331
377
|
|
332
|
-
|
378
|
+
after do
|
379
|
+
suppress_warnings do
|
380
|
+
OneTag = nil
|
381
|
+
end
|
382
|
+
|
383
|
+
One(:implode)
|
384
|
+
end
|
333
385
|
|
386
|
+
|
387
|
+
it 'should only have one version' do
|
388
|
+
|
389
|
+
One().versions.size.should == 1 # OneTag
|
390
|
+
One().versions.should == [OneTag]
|
391
|
+
end
|
334
392
|
end
|
335
393
|
|
336
394
|
describe :precedent do
|
337
395
|
|
338
396
|
it 'points to the previous trait in the history' do
|
339
397
|
|
340
|
-
extend
|
398
|
+
extend Hsample(), Hsample()
|
341
399
|
|
342
400
|
# Given that
|
343
|
-
traits.should ==
|
401
|
+
traits.should == Hsample().history
|
344
402
|
|
345
403
|
# Then
|
346
|
-
expect(
|
347
|
-
expect(
|
348
|
-
expect(traits.last.precedent).to equal(
|
404
|
+
expect(Hsample().history.last.precedent).to equal(Hsample().history.first)
|
405
|
+
expect(Hsample().history.last.pre).to equal(traits.first)
|
406
|
+
expect(traits.last.precedent).to equal(Hsample().history.first)
|
349
407
|
expect(traits.last.pre).to equal(traits.first)
|
350
408
|
|
351
409
|
eject *traits
|
@@ -354,12 +412,12 @@ describe "the introspection api in further detail" do
|
|
354
412
|
|
355
413
|
it 'has spec as the first precedent' do
|
356
414
|
|
357
|
-
extend
|
415
|
+
extend Hsample(), Hsample()
|
358
416
|
|
359
|
-
traits.should ==
|
417
|
+
traits.should == Hsample().history
|
360
418
|
|
361
|
-
expect(
|
362
|
-
expect(traits.first.precedent).to equal(
|
419
|
+
expect(Hsample().history.first.precedent).to equal(Hsample().spec)
|
420
|
+
expect(traits.first.precedent).to equal(Hsample().spec)
|
363
421
|
|
364
422
|
eject *traits
|
365
423
|
|
@@ -369,13 +427,13 @@ describe "the introspection api in further detail" do
|
|
369
427
|
|
370
428
|
it 'has the latest version as the precedent to spec' do
|
371
429
|
|
372
|
-
extend
|
430
|
+
extend Hsample(), Hsample()
|
373
431
|
|
374
|
-
traits.should ==
|
432
|
+
traits.should == Hsample().history
|
375
433
|
|
376
|
-
expect(
|
377
|
-
expect(
|
378
|
-
expect(
|
434
|
+
expect(Hsample().history.first.precedent).to equal(Hsample().spec)
|
435
|
+
expect(Hsample().precedent.pre.pre).to equal(Hsample().spec)
|
436
|
+
expect(Hsample().spec.pre).to eq(Hsample().history.last)
|
379
437
|
|
380
438
|
eject *traits
|
381
439
|
|
@@ -384,149 +442,6 @@ describe "the introspection api in further detail" do
|
|
384
442
|
end
|
385
443
|
end
|
386
444
|
|
387
|
-
describe :progenitor do
|
388
|
-
|
389
|
-
before do
|
390
|
-
trait :Progample
|
391
|
-
end
|
392
|
-
after do
|
393
|
-
Progample(:implode)
|
394
|
-
end
|
395
|
-
|
396
|
-
it 'points to its progenitor: the version of trait generating it' do
|
397
|
-
|
398
|
-
expect(Progample().history).to be_empty
|
399
|
-
expect(Progample().progenitor).to equal(Progample().spec)
|
400
|
-
|
401
|
-
# apply the trait
|
402
|
-
|
403
|
-
extend Progample(), Progample()
|
404
|
-
|
405
|
-
expect(Progample().history.size).to eq(2)
|
406
|
-
|
407
|
-
|
408
|
-
# both generated form spec
|
409
|
-
|
410
|
-
expect(Progample().history.first.progenitor).to equal(Progample().spec)
|
411
|
-
expect(Progample().history.last.progenitor).to equal(Progample().spec)
|
412
|
-
|
413
|
-
|
414
|
-
# create a tag
|
415
|
-
|
416
|
-
suppress_warnings do # used because of rspec
|
417
|
-
ProgenitorsTag = Progample()
|
418
|
-
end
|
419
|
-
|
420
|
-
expect(Progample().history.size).to eq(3)
|
421
|
-
|
422
|
-
expect(Progample().history.first.progenitor).to equal(Progample().spec)
|
423
|
-
expect(Progample().history.last).to equal(ProgenitorsTag)
|
424
|
-
expect(Progample().history.last.progenitor).to equal(Progample().spec)
|
425
|
-
expect(ProgenitorsTag.progenitor).to equal(Progample().spec)
|
426
|
-
|
427
|
-
|
428
|
-
# apply the tag
|
429
|
-
|
430
|
-
extend ProgenitorsTag
|
431
|
-
|
432
|
-
expect(Progample().history.size).to eq(4)
|
433
|
-
expect(Progample().history.last).to equal(traits.first)
|
434
|
-
|
435
|
-
expect(Progample().history.last.progenitor).to equal(ProgenitorsTag)
|
436
|
-
expect(Progample().history.first.progenitor).to equal(Progample().spec)
|
437
|
-
|
438
|
-
end
|
439
|
-
|
440
|
-
it 'points the last progenitor to nil' do
|
441
|
-
|
442
|
-
expect(Progample().spec.progenitor).to equal(nil)
|
443
|
-
|
444
|
-
end
|
445
|
-
|
446
|
-
it 'works the same with soft tags' do
|
447
|
-
|
448
|
-
suppress_warnings do
|
449
|
-
ProgenitorsTag = Progample()
|
450
|
-
end
|
451
|
-
|
452
|
-
expect(Progample().history.size).to eq(1)
|
453
|
-
|
454
|
-
|
455
|
-
# soft tag
|
456
|
-
# debugger
|
457
|
-
Progample(:tag) { 'some code'}
|
458
|
-
|
459
|
-
expect(Progample().history.size).to eq(2)
|
460
|
-
|
461
|
-
# progenitors are the same
|
462
|
-
|
463
|
-
expect(Progample().history.first.progenitor).to eq(Progample().spec)
|
464
|
-
expect(Progample().history.last.progenitor).to eq(Progample().spec)
|
465
|
-
expect(Progample().history.first.progenitor.progenitor).to eq(nil)
|
466
|
-
expect(Progample().history.last.progenitor.progenitor).to eq(nil)
|
467
|
-
|
468
|
-
# tags call
|
469
|
-
|
470
|
-
expect(Progample().tags.size).to eq(2)
|
471
|
-
|
472
|
-
end
|
473
|
-
|
474
|
-
it 'carries on the metaphor with traits are shared from other objects' do
|
475
|
-
|
476
|
-
suppress_warnings do
|
477
|
-
ProgenitorsTag = Progample()
|
478
|
-
end
|
479
|
-
|
480
|
-
class ProgenitorTester1
|
481
|
-
include ProgenitorsTag
|
482
|
-
end
|
483
|
-
|
484
|
-
class ProgenitorTester2
|
485
|
-
include *ProgenitorTester1.traits # copying traits from second class
|
486
|
-
end
|
487
|
-
|
488
|
-
expect(ProgenitorTester2.traits.first.progenitor).to equal(ProgenitorTester1.traits.first)
|
489
|
-
expect(ProgenitorTester1.traits.first.progenitor).to equal(ProgenitorsTag)
|
490
|
-
expect(ProgenitorsTag.progenitor).to equal(Progample().spec)
|
491
|
-
|
492
|
-
end
|
493
|
-
|
494
|
-
end
|
495
|
-
|
496
|
-
describe :lineage do
|
497
|
-
|
498
|
-
before do
|
499
|
-
trait :Lineample
|
500
|
-
end
|
501
|
-
after do
|
502
|
-
Lineample(:implode)
|
503
|
-
end
|
504
|
-
|
505
|
-
it 'collects all the progenitors of a line of traits' do
|
506
|
-
|
507
|
-
LineagesTag = Lineample()
|
508
|
-
|
509
|
-
class LineageTester1
|
510
|
-
include LineagesTag
|
511
|
-
end
|
512
|
-
|
513
|
-
class LineageTester2
|
514
|
-
include *LineageTester1.traits
|
515
|
-
end
|
516
|
-
|
517
|
-
expect(LineageTester2.traits.first.progenitor).to equal(LineageTester1.traits.first)
|
518
|
-
expect(LineageTester1.traits.first.progenitor).to equal(LineagesTag)
|
519
|
-
expect(LineagesTag.progenitor).to equal(Lineample().spec)
|
520
|
-
|
521
|
-
expect(Lineample().lineage).to eq([Lineample().spec, Lineample()])
|
522
|
-
expect(LineageTester2.traits.first.lineage).to eq([Lineample().spec, LineagesTag, LineageTester1.traits.first, LineageTester2.traits.first])
|
523
|
-
expect(Lineample().spec.lineage).to eq([Lineample().spec])
|
524
|
-
expect(Lineample().spec.progenitor).to eq(nil)
|
525
|
-
|
526
|
-
end
|
527
|
-
|
528
|
-
end
|
529
|
-
|
530
445
|
describe 'equality of Injectors' do
|
531
446
|
|
532
447
|
before do
|
@@ -569,7 +484,7 @@ describe "the introspection api in further detail" do
|
|
569
484
|
# inequality
|
570
485
|
##################################
|
571
486
|
|
572
|
-
E().should_not
|
487
|
+
E().should_not eql F()
|
573
488
|
|
574
489
|
# if E () definitions **
|
575
490
|
E() do
|
@@ -592,6 +507,19 @@ describe "the introspection api in further detail" do
|
|
592
507
|
|
593
508
|
end
|
594
509
|
|
510
|
+
it 'has case equality showing its presence in an instance' do
|
511
|
+
|
512
|
+
o = Object.new.extend E()
|
513
|
+
|
514
|
+
E().should === o
|
515
|
+
|
516
|
+
case E()
|
517
|
+
when o
|
518
|
+
should be_true
|
519
|
+
end
|
520
|
+
|
521
|
+
end
|
522
|
+
|
595
523
|
end
|
596
524
|
|
597
525
|
describe :diff do
|
@@ -632,7 +560,7 @@ describe "the introspection api in further detail" do
|
|
632
560
|
|
633
561
|
end
|
634
562
|
|
635
|
-
it 'differs once
|
563
|
+
it 'differs once injector specalization is present' do
|
636
564
|
|
637
565
|
# difference
|
638
566
|
##################################
|
@@ -732,7 +660,7 @@ describe "the introspection api in further detail" do
|
|
732
660
|
|
733
661
|
end
|
734
662
|
|
735
|
-
it '
|
663
|
+
it 'exposes join and delta sub-traits for inclusion/extension' do
|
736
664
|
|
737
665
|
# a tag as precedent
|
738
666
|
ETag5 = E()
|
@@ -777,8 +705,22 @@ describe "the introspection api in further detail" do
|
|
777
705
|
|
778
706
|
end
|
779
707
|
|
708
|
+
it 'accepts a negative index' do
|
709
|
+
|
710
|
+
extend E(), E(), E()
|
711
|
+
|
712
|
+
E() do
|
713
|
+
def foo
|
714
|
+
end
|
715
|
+
end
|
716
|
+
|
717
|
+
E().diff( -1 ).should == [[],[:foo]]
|
718
|
+
E().diff( -3 ).should == [[],[:foo]]
|
719
|
+
E().diff( -4 ).should == [[:foo], []] # self
|
720
|
+
|
721
|
+
end
|
722
|
+
|
780
723
|
end
|
781
|
-
|
782
724
|
end
|
783
725
|
|
784
726
|
end
|