jackbox 0.9.6.3 → 0.9.6.6

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.
@@ -5,107 +5,107 @@ include Injectors
5
5
 
6
6
  describe "the introspection api in further detail" do
7
7
 
8
- describe :injectors do
8
+ describe :traits do
9
9
 
10
- describe "base injectors call" do
10
+ describe "base traits call" do
11
11
 
12
- # . Name.injectors == [j,......]
13
- # . Name.injectors.by_name == [:name, ......]
14
- # . Name.injectors.sym_list == [:name, ......]
15
- # . Name.injectors.collect_by_name(:name) == [j,......] (default method)
16
- # . same as Name.injectors :name
17
- # . Name.injectors.all_by_sym(:name) == [j,......] (default method)
18
- # . Name.injectors.find_by_name(:name) == j
19
- # . Name.injectors.#Enumerable...
12
+ # . Name.traits == [j,......]
13
+ # . Name.traits.by_name == [:name, ......]
14
+ # . Name.traits.sym_list == [:name, ......]
15
+ # . Name.traits.collect_by_name(:name) == [j,......] (default method)
16
+ # . same as Name.traits :name
17
+ # . Name.traits.all_by_sym(:name) == [j,......] (default method)
18
+ # . Name.traits.find_by_name(:name) == j
19
+ # . Name.traits.#Enumerable...
20
20
 
21
21
  before do
22
22
  class InjectorContainer
23
- injector :function
24
- injector :style
23
+ trait :function
24
+ trait :style
25
25
 
26
26
  inject function, style
27
27
  end
28
28
  end
29
29
 
30
- the 'base call returns now a list of actual injector objects' do
30
+ the 'base call returns now a list of actual trait objects' do
31
31
 
32
- # . Name.injectors == [j,......]
32
+ # . Name.traits == [j,......]
33
33
 
34
34
  # class InjectorContainer
35
- # injector :function
36
- # injector :style
35
+ # trait :function
36
+ # trait :style
37
37
  #
38
38
  # inject function, style
39
39
  # end
40
40
 
41
- expect(InjectorContainer.injectors).to all( be_an(Injector))
42
- expect(InjectorContainer.injectors).to eql([InjectorContainer.function.history.last, InjectorContainer.style.history.last])
41
+ expect(InjectorContainer.traits).to all( be_an(Injector))
42
+ expect(InjectorContainer.traits).to eql([InjectorContainer.function.history.last, InjectorContainer.style.history.last])
43
43
 
44
44
  end
45
45
 
46
- the 'injectors#by_name alias sym_list call now returns the list of injector symbols' do
46
+ the 'traits#by_name alias sym_list call now returns the list of trait symbols' do
47
47
 
48
- # . Name.injectors.by_name == [:name, ......]
48
+ # . Name.traits.by_name == [:name, ......]
49
49
 
50
- expect(InjectorContainer.injectors.by_name).to all( be_an(Symbol))
51
- expect(InjectorContainer.injectors.by_name).to eql([:function, :style])
50
+ expect(InjectorContainer.traits.by_name).to all( be_an(Symbol))
51
+ expect(InjectorContainer.traits.by_name).to eql([:function, :style])
52
52
  # alias
53
- expect(InjectorContainer.injectors.sym_list).to all( be_an(Symbol))
53
+ expect(InjectorContainer.traits.sym_list).to all( be_an(Symbol))
54
54
 
55
55
  end
56
56
 
57
- the 'injectors.collect_by_name returns a list of injector objects matching the name' do
57
+ the 'traits.collect_by_name returns a list of trait objects matching the name' do
58
58
 
59
- # . Name.injectors.collect_by_name(:name) == [j,......] (default method)
59
+ # . Name.traits.collect_by_name(:name) == [j,......] (default method)
60
60
 
61
61
  ic = InjectorContainer.new
62
62
  ic.enrich InjectorContainer.style
63
- ic.injectors.by_name.should == [:style, :function, :style]
63
+ ic.traits.by_name.should == [:style, :function, :style]
64
64
 
65
65
  # returns [Injector.name == :style, Injector.name == :style] only !!
66
- ic.injectors.collect_by_name(:style).should all(be_an(Injector).and have_attributes(:name => :style))
66
+ ic.traits.collect_by_name(:style).should all(be_an(Injector).and have_attributes(:name => :style))
67
67
 
68
68
  # also aliased
69
- ic.injectors.all_by_sym(:style).should all(be_an(Injector).and have_attributes(:name => :style))
69
+ ic.traits.all_by_sym(:style).should all(be_an(Injector).and have_attributes(:name => :style))
70
70
  end
71
71
 
72
- the 'injectors.find_by_name call returns one item of class Injector by name <sym>' do
72
+ the 'traits.find_by_name call returns one item of class Injector by name <sym>' do
73
73
 
74
- # . Name.injectors.find_by_name(:name) == j
74
+ # . Name.traits.find_by_name(:name) == j
75
75
 
76
76
  ic = InjectorContainer.new
77
77
  ic.enrich InjectorContainer.style
78
78
 
79
79
  # result
80
- ic.injectors.by_name.should == [:style, :function, :style]
81
- ic.injectors.find_by_name(:style).should be_an(Injector).and( have_attributes(:name => :style)) # the last one !!!
80
+ ic.traits.by_name.should == [:style, :function, :style]
81
+ ic.traits.find_by_name(:style).should be_an(Injector).and( have_attributes(:name => :style)) # the last one !!!
82
82
 
83
83
  # also aliased
84
- ic.injectors.last_by_sym(:style).should be_an(Injector).and( have_attributes(:name => :style)) # the last one !!!
84
+ ic.traits.last_by_sym(:style).should be_an(Injector).and( have_attributes(:name => :style)) # the last one !!!
85
85
 
86
86
  end
87
87
 
88
- the 'default calls injectors :name/injectors :name, :othername, ... get resolved to the previous methods' do
88
+ the 'default calls traits :name/traits :name, :othername, ... get resolved to the previous methods' do
89
89
 
90
- # . Name.injectors.#Enumerable...
90
+ # . Name.traits.#Enumerable...
91
91
 
92
92
  ic = InjectorContainer.new
93
93
  ic.enrich InjectorContainer.style
94
94
 
95
95
  # result
96
- ic.injectors(:style).should eql(InjectorContainer.style.history.last)
97
- ic.injectors(:style, :style).should all(be_an(Injector).and have_attributes(:name => :style))
96
+ ic.traits(:style).should eql(InjectorContainer.style.history.last)
97
+ ic.traits(:style, :style).should all(be_an(Injector).and have_attributes(:name => :style))
98
98
 
99
99
  end
100
100
 
101
101
  end
102
102
 
103
103
 
104
- describe "#injectors(:all) call" do
104
+ describe "#traits(:all) call" do
105
105
 
106
106
  before do
107
- injector :Example1
108
- injector :Example2
107
+ trait :Example1
108
+ trait :Example2
109
109
  Object.inject Example1()
110
110
  end
111
111
 
@@ -114,73 +114,73 @@ describe "the introspection api in further detail" do
114
114
  Example2(:implode)
115
115
  end
116
116
 
117
- it 'returns all the injectors in the ancestor chain of an object' do
117
+ it 'returns all the traits in the ancestor chain of an object' do
118
118
 
119
- # Object.eject *Object.injectors rescue [] # clear all injectors from other tests
119
+ # Object.eject *Object.traits rescue [] # clear all traits from other tests
120
120
 
121
121
  Hash.inject Example2()
122
122
 
123
- Hash.new.injectors(:all).should all(be_an(Injector))
124
- Hash.new.injectors(:all).should eql [Example2(), Example1()] # from Object, and Hash
123
+ Hash.new.traits(:all).should all(be_an(Injector))
124
+ Hash.new.traits(:all).should eql [Example2(), Example1()] # from Object, and Hash
125
125
 
126
- # as opposed to simple #injectors call
126
+ # as opposed to simple #traits call
127
127
 
128
- Hash.new.injectors.should eql [Example2()] # with no :all option
128
+ Hash.new.traits.should eql [Example2()] # with no :all option
129
129
 
130
130
  end
131
131
 
132
132
  it 'with any class' do
133
133
 
134
- # Object.eject *Object.injectors # clear all injectors from other tests
134
+ # Object.eject *Object.traits # clear all traits from other tests
135
135
 
136
136
  class AnyClass
137
137
  inject Example2()
138
138
  end
139
139
 
140
- AnyClass.injectors(:all).should all(be_an(Injector))
141
- AnyClass.injectors(:all).should eql [Example2(), Example1()]
140
+ AnyClass.traits(:all).should all(be_an(Injector))
141
+ AnyClass.traits(:all).should eql [Example2(), Example1()]
142
142
 
143
- # as opposed to simple #injectors call
143
+ # as opposed to simple #traits call
144
144
 
145
- AnyClass.new.injectors.should eql [Example2()]
145
+ AnyClass.new.traits.should eql [Example2()]
146
146
 
147
147
  end
148
148
 
149
- it 'returns all the injectors in the ancestors chain of a module' do
149
+ it 'returns all the traits in the ancestors chain of a module' do
150
150
 
151
151
  module AnyModule
152
152
 
153
153
  inject Example2() do
154
- include injector :Example3 # compond injector
154
+ include trait :Example3 # compond trait
155
155
  end
156
156
 
157
157
  end
158
158
 
159
- AnyModule.injectors(:all).should all(be_an(Injector))
160
- AnyModule.injectors(:all).should eql [Example2(), Example3()]
159
+ AnyModule.traits(:all).should all(be_an(Injector))
160
+ AnyModule.traits(:all).should eql [Example2(), Example3()]
161
161
 
162
- # as opposed to simple #injectors call
162
+ # as opposed to simple #traits call
163
163
 
164
- AnyModule.injectors.should eql [Example2()]
164
+ AnyModule.traits.should eql [Example2()]
165
165
 
166
166
  end
167
167
 
168
- it 'returns all the injectors in the ancestors chain of a Injector' do
168
+ it 'returns all the traits in the ancestors chain of a Injector' do
169
169
 
170
170
  Example1 do
171
171
 
172
- include injector :Example2 do
173
- include injector :Example3 # triple compound injector
172
+ include trait :Example2 do
173
+ include trait :Example3 # triple compound trait
174
174
  end
175
175
 
176
176
  end
177
177
 
178
- Example1().injectors(:all).should all(be_an(Injector))
179
- Example1().injectors(:all).should eql [Example2(), Example3()]
178
+ Example1().traits(:all).should all(be_an(Injector))
179
+ Example1().traits(:all).should eql [Example2(), Example3()]
180
180
 
181
- # as opposed to simple #injectors call
181
+ # as opposed to simple #traits call
182
182
 
183
- Example1().injectors.should eql [Example2()]
183
+ Example1().traits.should eql [Example2()]
184
184
 
185
185
  end
186
186
 
@@ -188,26 +188,26 @@ describe "the introspection api in further detail" do
188
188
 
189
189
  Example1 do
190
190
 
191
- include injector :Example2 do
192
- include injector :Example3 # triple compound injector
191
+ include trait :Example2 do
192
+ include trait :Example3 # triple compound trait
193
193
  end
194
194
 
195
195
  end
196
196
 
197
- Example1().injectors(:all).by_name.should == [:Example2, :Example3]
198
- Example1().injectors(:all).collect_by_name(:Example3).should all(be_an(Injector).and have_attributes(:name => :Example3))
199
- Example1().injectors(:all).find_by_name(:Example2).should == Example2()
197
+ Example1().traits(:all).by_name.should == [:Example2, :Example3]
198
+ Example1().traits(:all).collect_by_name(:Example3).should all(be_an(Injector).and have_attributes(:name => :Example3))
199
+ Example1().traits(:all).find_by_name(:Example2).should == Example2()
200
200
 
201
201
  end
202
202
  end
203
203
 
204
204
 
205
- describe '#injectors at the class singleton level' do
205
+ describe '#traits at the class singleton level' do
206
206
 
207
- the 'injectors applied at the CLASS instance level, ie: using extend on the class, show up only on the CLASS instance not
207
+ the 'traits applied at the CLASS instance level, ie: using extend on the class, show up only on the CLASS instance not
208
208
  its object instances and this only after using the :all directive like above' do
209
209
 
210
- injector :class_Instance_injector do
210
+ trait :class_Instance_trait do
211
211
  def new *args
212
212
  puts "--done--"
213
213
  super(*args)
@@ -220,38 +220,38 @@ describe "the introspection api in further detail" do
220
220
 
221
221
  # extend the class singleton
222
222
 
223
- InjectorUser.extend class_Instance_injector
223
+ InjectorUser.extend class_Instance_trait
224
224
 
225
225
  # run tests
226
226
 
227
- InjectorUser.injectors.size.should == 0 # not using the :all directive
227
+ InjectorUser.traits.size.should == 0 # not using the :all directive
228
228
 
229
- InjectorUser.injectors(:all).size.should == 1
230
- InjectorUser.injectors(:all).should all(be_an(Injector).and have_attributes(:name => :class_Instance_injector))
229
+ InjectorUser.traits(:all).size.should == 1
230
+ InjectorUser.traits(:all).should all(be_an(Injector).and have_attributes(:name => :class_Instance_trait))
231
231
 
232
232
  # on the class instance
233
233
 
234
234
  $stdout.should_receive(:puts).with("--done--")
235
235
 
236
236
  iu = InjectorUser.new
237
- expect(iu.injectors).to be_empty
238
- expect(iu.injectors(:all)).to be_empty
237
+ expect(iu.traits).to be_empty
238
+ expect(iu.traits(:all)).to be_empty
239
239
 
240
240
  end
241
241
 
242
- the ':all injector list for classes lists CLASS instance injectors first and then OBJECT instance injectors' do
242
+ the ':all trait list for classes lists CLASS instance traits first and then OBJECT instance traits' do
243
243
 
244
- injector :two
245
- injector :one
244
+ trait :two
245
+ trait :one
246
246
 
247
247
  Array.inject two # injected on objects of the class
248
248
  Array.extend one # extended on the class instance itself
249
249
 
250
250
  # result
251
251
 
252
- Array.injectors(:all).sym_list.should == [:one, :two]
252
+ Array.traits(:all).sym_list.should == [:one, :two]
253
253
 
254
- Array.new.injectors.sym_list.should == [:two] # :one is member of Array.singleton_class
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
256
  end
257
257
 
@@ -273,14 +273,14 @@ describe "the introspection api in further detail" do
273
273
 
274
274
  extend(Histample(), Histample()) # host two items
275
275
 
276
- injectors.should == Histample().history # equal at this point
276
+ traits.should == Histample().history # equal at this point
277
277
 
278
278
  expect(Histample().history.size).to eq(2)
279
- expect(Histample().history.last).to eql(injectors.last)
280
- expect(Histample().history.first).to eq(injectors.first)
281
- expect(injectors.size).to eq(2)
279
+ expect(Histample().history.last).to eql(traits.last)
280
+ expect(Histample().history.first).to eq(traits.first)
281
+ expect(traits.size).to eq(2)
282
282
 
283
- eject *injectors
283
+ eject *traits
284
284
 
285
285
  end
286
286
 
@@ -288,7 +288,7 @@ describe "the introspection api in further detail" do
288
288
 
289
289
  extend Histample(), Histample()
290
290
 
291
- injectors.should == Histample().history
291
+ traits.should == Histample().history
292
292
 
293
293
  expect(Histample().history.slice(0)).to be_instance_of(Injector)
294
294
  expect(Histample().history.slice(1)).to be_instance_of(Injector)
@@ -301,14 +301,14 @@ describe "the introspection api in further detail" do
301
301
 
302
302
  extend(Histample(), Histample())
303
303
 
304
- injectors.should == Histample().history
304
+ traits.should == Histample().history
305
305
 
306
306
  expect(Histample().history.size).to eq(2)
307
- expect(injectors.size).to eq(2)
307
+ expect(traits.size).to eq(2)
308
308
 
309
- eject *injectors
309
+ eject *traits
310
310
 
311
- expect(injectors).to be_empty # target injectors
311
+ expect(traits).to be_empty # target traits
312
312
  expect(Histample().history).to be_empty # Injector history
313
313
 
314
314
  end
@@ -335,20 +335,20 @@ describe "the introspection api in further detail" do
335
335
 
336
336
  describe :precedent do
337
337
 
338
- it 'points to the previous injector in the history' do
338
+ it 'points to the previous trait in the history' do
339
339
 
340
340
  extend Histample(), Histample()
341
341
 
342
342
  # Given that
343
- injectors.should == Histample().history
343
+ traits.should == Histample().history
344
344
 
345
345
  # Then
346
346
  expect(Histample().history.last.precedent).to equal(Histample().history.first)
347
- expect(Histample().history.last.pre).to equal(injectors.first)
348
- expect(injectors.last.precedent).to equal(Histample().history.first)
349
- expect(injectors.last.pre).to equal(injectors.first)
347
+ expect(Histample().history.last.pre).to equal(traits.first)
348
+ expect(traits.last.precedent).to equal(Histample().history.first)
349
+ expect(traits.last.pre).to equal(traits.first)
350
350
 
351
- eject *injectors
351
+ eject *traits
352
352
 
353
353
  end
354
354
 
@@ -356,12 +356,12 @@ describe "the introspection api in further detail" do
356
356
 
357
357
  extend Histample(), Histample()
358
358
 
359
- injectors.should == Histample().history
359
+ traits.should == Histample().history
360
360
 
361
361
  expect(Histample().history.first.precedent).to equal(Histample().spec)
362
- expect(injectors.first.precedent).to equal(Histample().spec)
362
+ expect(traits.first.precedent).to equal(Histample().spec)
363
363
 
364
- eject *injectors
364
+ eject *traits
365
365
 
366
366
  end
367
367
 
@@ -371,13 +371,13 @@ describe "the introspection api in further detail" do
371
371
 
372
372
  extend Histample(), Histample()
373
373
 
374
- injectors.should == Histample().history
374
+ traits.should == Histample().history
375
375
 
376
376
  expect(Histample().history.first.precedent).to equal(Histample().spec)
377
377
  expect(Histample().precedent.pre.pre).to equal(Histample().spec)
378
378
  expect(Histample().spec.pre).to eq(Histample().history.last)
379
379
 
380
- eject *injectors
380
+ eject *traits
381
381
 
382
382
  end
383
383
 
@@ -387,18 +387,18 @@ describe "the introspection api in further detail" do
387
387
  describe :progenitor do
388
388
 
389
389
  before do
390
- injector :Progample
390
+ trait :Progample
391
391
  end
392
392
  after do
393
393
  Progample(:implode)
394
394
  end
395
395
 
396
- it 'points to its progenitor: the version of injector generating it' do
396
+ it 'points to its progenitor: the version of trait generating it' do
397
397
 
398
398
  expect(Progample().history).to be_empty
399
399
  expect(Progample().progenitor).to equal(Progample().spec)
400
400
 
401
- # apply the injector
401
+ # apply the trait
402
402
 
403
403
  extend Progample(), Progample()
404
404
 
@@ -430,7 +430,7 @@ describe "the introspection api in further detail" do
430
430
  extend ProgenitorsTag
431
431
 
432
432
  expect(Progample().history.size).to eq(4)
433
- expect(Progample().history.last).to equal(injectors.first)
433
+ expect(Progample().history.last).to equal(traits.first)
434
434
 
435
435
  expect(Progample().history.last.progenitor).to equal(ProgenitorsTag)
436
436
  expect(Progample().history.first.progenitor).to equal(Progample().spec)
@@ -471,7 +471,7 @@ describe "the introspection api in further detail" do
471
471
 
472
472
  end
473
473
 
474
- it 'carries on the metaphor with injectors are shared from other objects' do
474
+ it 'carries on the metaphor with traits are shared from other objects' do
475
475
 
476
476
  suppress_warnings do
477
477
  ProgenitorsTag = Progample()
@@ -482,11 +482,11 @@ describe "the introspection api in further detail" do
482
482
  end
483
483
 
484
484
  class ProgenitorTester2
485
- include *ProgenitorTester1.injectors # copying injectors from second class
485
+ include *ProgenitorTester1.traits # copying traits from second class
486
486
  end
487
487
 
488
- expect(ProgenitorTester2.injectors.first.progenitor).to equal(ProgenitorTester1.injectors.first)
489
- expect(ProgenitorTester1.injectors.first.progenitor).to equal(ProgenitorsTag)
488
+ expect(ProgenitorTester2.traits.first.progenitor).to equal(ProgenitorTester1.traits.first)
489
+ expect(ProgenitorTester1.traits.first.progenitor).to equal(ProgenitorsTag)
490
490
  expect(ProgenitorsTag.progenitor).to equal(Progample().spec)
491
491
 
492
492
  end
@@ -496,13 +496,13 @@ describe "the introspection api in further detail" do
496
496
  describe :lineage do
497
497
 
498
498
  before do
499
- injector :Lineample
499
+ trait :Lineample
500
500
  end
501
501
  after do
502
502
  Lineample(:implode)
503
503
  end
504
504
 
505
- it 'collects all the progenitors of a line of injectors' do
505
+ it 'collects all the progenitors of a line of traits' do
506
506
 
507
507
  LineagesTag = Lineample()
508
508
 
@@ -511,15 +511,15 @@ describe "the introspection api in further detail" do
511
511
  end
512
512
 
513
513
  class LineageTester2
514
- include *LineageTester1.injectors
514
+ include *LineageTester1.traits
515
515
  end
516
516
 
517
- expect(LineageTester2.injectors.first.progenitor).to equal(LineageTester1.injectors.first)
518
- expect(LineageTester1.injectors.first.progenitor).to equal(LineagesTag)
517
+ expect(LineageTester2.traits.first.progenitor).to equal(LineageTester1.traits.first)
518
+ expect(LineageTester1.traits.first.progenitor).to equal(LineagesTag)
519
519
  expect(LineagesTag.progenitor).to equal(Lineample().spec)
520
520
 
521
521
  expect(Lineample().lineage).to eq([Lineample().spec, Lineample()])
522
- expect(LineageTester2.injectors.first.lineage).to eq([Lineample().spec, LineagesTag, LineageTester1.injectors.first, LineageTester2.injectors.first])
522
+ expect(LineageTester2.traits.first.lineage).to eq([Lineample().spec, LineagesTag, LineageTester1.traits.first, LineageTester2.traits.first])
523
523
  expect(Lineample().spec.lineage).to eq([Lineample().spec])
524
524
  expect(Lineample().spec.progenitor).to eq(nil)
525
525
 
@@ -530,8 +530,8 @@ describe "the introspection api in further detail" do
530
530
  describe 'equality of Injectors' do
531
531
 
532
532
  before do
533
- injector :E
534
- injector :F
533
+ trait :E
534
+ trait :F
535
535
  end
536
536
 
537
537
  after do
@@ -542,59 +542,71 @@ describe "the introspection api in further detail" do
542
542
  # For now this is how equality is defined
543
543
  describe 'equality and inequality' do
544
544
 
545
- it 'allows comparison between injectors' do
545
+ it 'allows comparison between traits' do
546
546
 
547
547
  # equality
548
548
  ##################################
549
+
549
550
  E().should == E()
550
551
  E().should == E().spec
552
+ E().should == E().pre
551
553
 
552
- E(:tag).should == E()
553
- if ETag1 = E()
554
- ETag1.should == E()
555
- end
556
- extend E()
557
- injectors.first.should == E()
554
+ # if
555
+ ETag1 = E() # with no definitions
556
+ # then
557
+ E().should == ETag1 # same thing
558
558
 
559
+ # if
560
+ extend E() # with no definitions
561
+ # then
562
+ traits.first.should == E() # same
563
+
564
+ # but
565
+ E().should == E() # always
566
+ E().should == E().spec
567
+ E(:tag).should == E()
559
568
 
560
- # ** definition **
561
- E() do
562
- def foo
563
- end
564
- end
565
- # ** definition **
566
-
567
-
568
569
  # inequality
569
570
  ##################################
570
- E().should == E()
571
- ETag1.should_not == E()
572
- injectors.first.should_not == E()
573
-
574
- E(:tag).should == E()
571
+
575
572
  E().should_not == F()
576
-
573
+
574
+ # if E () definitions **
575
+ E() do
576
+ def foo
577
+ end
578
+ end
579
+
580
+ # then (from above)
581
+ ETag1.should_not == E()
582
+
583
+ # furthermore
584
+ traits.first.should_not == E()
585
+
586
+ # and
587
+ E().should_not == E().pre
588
+
589
+ # but
590
+ E().should == E() # always
591
+ E().should == E().spec
592
+
577
593
  end
578
594
 
579
595
  end
580
596
 
581
597
  describe :diff do
582
-
583
- it 'shows the difference between injectors' do
584
-
585
- E().diff.class.should be(Array)
598
+
599
+ it 'corroborates equality' do
586
600
 
587
601
  # equality in the converse expression
588
602
  ##################################
589
- # debugger
590
603
  E().diff(E()).should be_empty
591
604
 
592
605
  # because
593
606
  E().should == E() # like above
594
607
 
595
608
 
596
- # unless changed E should be == E().pre or E().spec
597
- ##################################
609
+ # unless changed
598
610
  E().diff.should be_empty
599
611
 
600
612
  # because
@@ -602,18 +614,13 @@ describe "the introspection api in further detail" do
602
614
  E().pre.should equal( E().spec )
603
615
  # and
604
616
  E().should == E().spec # like above
605
-
606
-
607
- # unless there is a delta it cannot be loaded?
608
- ##################################
617
+ # also
609
618
  E().diff.should_not be_loaded
610
-
611
619
  # because
612
620
  E().diff.delta.should be_empty
613
621
 
614
622
 
615
623
  # tags are the same
616
- ##################################
617
624
  ETag2 = E()
618
625
 
619
626
  E().diff(ETag2).should be_empty
@@ -627,107 +634,146 @@ describe "the introspection api in further detail" do
627
634
 
628
635
  it 'differs once a definition is present' do
629
636
 
630
- # a tag to compare
631
- ##################################
632
- ETag3 = E()
637
+ # difference
638
+ ##################################
633
639
 
640
+ #diff(ver=nil) --( The argument ver=nil defaults to the previous version )
634
641
 
635
- # ** definition **
636
- E do
637
- def foo
638
- end
639
- end
640
- # ** definition **
642
+ E().diff.class.should be(Array)
641
643
 
642
644
 
643
- # E is changed so...
644
- ####################################
645
- E().diff(ETag3).should_not be_empty
645
+ #diff.empty? --( Is the delta empty? The join could still exist (see below). )
646
646
 
647
- # because
648
- ETag3.should_not == E()
649
- # and
650
- E().diff(ETag3).delta.should == [:foo]
651
-
652
-
653
- # Still not loaded
654
- ##################################
655
- E().diff(ETag3).should_not be_loaded
647
+ E().diff.should be_empty
656
648
 
657
- # because
658
- E().diff(ETag3).join.should == []
659
- # even though
660
- E().diff(ETag3).delta.should == [:foo]
661
-
662
649
 
663
- # conversely
664
- ######################################
665
- E().diff.join.should == [:foo]
666
- # and
667
- E().diff.delta.should == []
650
+ # because
651
+ E().diff.delta.should be_empty
652
+ E().diff.join.should be_empty
668
653
 
669
- # because
670
- E().diff.should_not be_loaded
671
- # and
672
- E().diff.should == [[:foo], []]
673
-
674
- # being that
675
- E().diff.should eq( E().diff(E().progenitor) )
676
- E().progenitor.should equal(E().spec)
654
+
655
+ # a tag to compare
656
+ ETag3 = E()
657
+
658
+
659
+ # if some E() definitions **
660
+ E do
661
+ def foo
662
+ end
663
+ end
664
+
665
+
666
+ # E is changed so...
667
+ E().diff(ETag3).should_not be_empty
668
+
669
+
670
+ # because (like above)
671
+ ETag3.should_not == E()
672
+
673
+ # and
674
+
675
+
676
+ #diff.delta --( The difference in methods )
677
+
678
+ E().diff(ETag3).delta.should == [:foo]
679
+
680
+
681
+ #diff.loaded? --( Is there both a join and a delta? )
682
+
683
+ E().diff(ETag3).should_not be_loaded
684
+
685
+ # because
686
+
687
+
688
+ #diff.join --( The methods common to both )
689
+
690
+ E().diff(ETag3).join.should == []
691
+
692
+
693
+ # even though
694
+ E().diff(ETag3).delta.should == [:foo]
695
+
696
+
697
+ # furthermore
698
+ E().diff.should == [[], [:foo]]
699
+
700
+
701
+ # being that
702
+ E().diff.should eq( E().diff(E().precedent) )
703
+ # and
704
+ E().progenitor.should equal(E().spec)
677
705
 
678
706
  end
679
707
 
680
- it 'works with more methods' do
708
+ it 'continues to work with expansion' do
681
709
 
682
- # a tag to compare
683
- ##################################
710
+ # a tag as precedent
684
711
  ETag4 = E()
685
712
 
686
713
 
687
- # ** definition **
714
+ # if more E() definitions **
688
715
  E do
689
716
  def foo
690
717
  end
691
718
  def bar
692
719
  end
693
720
  end
694
- # ** definition **
695
721
 
696
722
 
697
- #
698
- ##################################
723
+ # then
699
724
  E().diff(ETag4).join.should == []
700
725
  E().diff(ETag4).delta.should == [:foo, :bar]
701
- E().diff.join.should == [:foo, :bar]
702
- E().diff.delta.should == []
726
+ E().diff.join.should == []
727
+ E().diff.delta.should == [:foo, :bar]
703
728
 
704
729
  # being that
705
- E().diff.should eq( E().diff( E().progenitor) )
730
+ E().diff.should eq( E().diff( E().precedent) )
706
731
  E().progenitor.should equal( E().spec )
707
732
 
708
733
  end
709
734
 
710
- it 'creates injectors for inclusion' do
735
+ it 'creates traits for inclusion' do
711
736
 
712
- # a tag to compare
713
- ##################################
714
- ETag5 = E()
737
+ # a tag as precedent
738
+ ETag5 = E()
715
739
 
716
740
 
717
- # ** definition **
718
- E do
719
- def foo
720
- end
721
- def bar
722
- end
723
- end
724
- # ** definition **
741
+ # if E() definitions **
742
+ E do
743
+ def foo
744
+ :foo
745
+ end
746
+ def bar
747
+ :bar
748
+ end
749
+ end
725
750
 
726
751
 
727
- E().diff.should be_empty
728
- E().diff.join.should_not be_empty
729
- E().diff.delta.should be_empty
730
- E().diff.delta.injector.should_not eq(E().diff.join.injector)
752
+ # then
753
+ E().diff.should_not be_empty
754
+
755
+ # being that
756
+ E().diff.join.should be_empty
757
+ E().diff.delta.should_not be_empty
758
+ # as for
759
+ E().diff.delta.injector.instance_methods.should == [:foo, :bar]
760
+ # and
761
+ E().diff.delta.injector.should_not eq(E().diff.join.injector)
762
+
763
+ # being that
764
+ E().diff.join.injector.instance_methods.should be_empty
765
+ E().diff.delta.injector.instance_methods.should_not be_empty
766
+
767
+ # allows the following
768
+ class Incomplete
769
+ inject E().diff.delta.injector
770
+ end
771
+ # and
772
+ Incomplete.new.foo.should eq(:foo)
773
+
774
+ # being that
775
+ E().diff.delta.injector.should be_instance_of(Injector)
776
+ E().diff.delta.injector.should be_instance_of(Trait)
731
777
 
732
778
  end
733
779