vedeu 0.3.5 → 0.4.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 +4 -4
- data/.ruby-version +1 -1
- data/docs/events.md +0 -12
- data/examples/configuration_app.rb +1 -1
- data/lib/vedeu/all.rb +0 -1
- data/lib/vedeu/bindings.rb +18 -3
- data/lib/vedeu/buffers/display_buffer.rb +0 -22
- data/lib/vedeu/configuration/api.rb +8 -44
- data/lib/vedeu/configuration/cli.rb +6 -36
- data/lib/vedeu/configuration/configuration.rb +0 -4
- data/lib/vedeu/distributed/server.rb +4 -10
- data/lib/vedeu/dsl/components/keymap.rb +3 -5
- data/lib/vedeu/input/keymap.rb +22 -45
- data/lib/vedeu/main_loop.rb +2 -0
- data/lib/vedeu/models/focus.rb +1 -1
- data/lib/vedeu/models/geometry.rb +2 -2
- data/lib/vedeu/models/view/char.rb +1 -1
- data/lib/vedeu/models/view/composition.rb +1 -1
- data/lib/vedeu/models/view/interface.rb +4 -2
- data/lib/vedeu/models/view/line.rb +1 -2
- data/lib/vedeu/models/view/stream.rb +1 -1
- data/lib/vedeu/output/all.rb +8 -0
- data/lib/vedeu/{presentation → output}/background.rb +0 -0
- data/lib/vedeu/{presentation → output}/colour.rb +0 -0
- data/lib/vedeu/{presentation → output}/foreground.rb +1 -1
- data/lib/vedeu/output/html_renderer.rb +13 -30
- data/lib/vedeu/{presentation → output}/presentation.rb +0 -0
- data/lib/vedeu/{presentation → output}/style.rb +0 -0
- data/lib/vedeu/output/templates/html_renderer.vedeu +24 -0
- data/lib/vedeu/{presentation → output}/translator.rb +0 -0
- data/lib/vedeu/support/log.rb +1 -0
- data/test/integration/dsl/compositions_test.rb +0 -8
- data/test/integration/dsl/interfaces_test.rb +0 -68
- data/test/integration/dsl/keymaps_test.rb +0 -12
- data/test/integration/dsl/lines_test.rb +0 -42
- data/test/integration/dsl/streams_test.rb +0 -26
- data/test/integration/dsl/views_test.rb +0 -18
- data/test/lib/vedeu/api_test.rb +0 -97
- data/test/lib/vedeu/configuration/api_test.rb +3 -14
- data/test/lib/vedeu/configuration/cli_test.rb +0 -14
- data/test/lib/vedeu/cursor/cursor_test.rb +0 -2
- data/test/lib/vedeu/distributed/client_test.rb +0 -2
- data/test/lib/vedeu/distributed/test_application_test.rb +0 -1
- data/test/lib/vedeu/dsl/components/keymap_test.rb +1 -7
- data/test/lib/vedeu/dsl/components/menu_test.rb +0 -48
- data/test/lib/vedeu/dsl/interface_test.rb +1 -263
- data/test/lib/vedeu/dsl/shared/text_test.rb +0 -6
- data/test/lib/vedeu/dsl/stream_test.rb +0 -2
- data/test/lib/vedeu/events/event_test.rb +0 -1
- data/test/lib/vedeu/input/keymap_test.rb +8 -2
- data/test/lib/vedeu/input/mapper_test.rb +2 -2
- data/test/lib/vedeu/launcher_test.rb +0 -12
- data/test/lib/vedeu/main_loop_test.rb +0 -17
- data/test/lib/vedeu/models/focus_test.rb +59 -19
- data/test/lib/vedeu/models/geometry_test.rb +20 -26
- data/test/lib/vedeu/models/view/interface_test.rb +0 -27
- data/test/lib/vedeu/models/view/stream_test.rb +0 -1
- data/test/lib/vedeu/{presentation → output}/background_test.rb +0 -0
- data/test/lib/vedeu/{presentation → output}/colour_test.rb +0 -0
- data/test/lib/vedeu/output/compositor_test.rb +0 -5
- data/test/lib/vedeu/{presentation → output}/foreground_test.rb +0 -0
- data/test/lib/vedeu/output/html_renderer_test.rb +1 -0
- data/test/lib/vedeu/{presentation → output}/presentation_test.rb +0 -0
- data/test/lib/vedeu/{presentation → output}/style_test.rb +0 -0
- data/test/lib/vedeu/{presentation → output}/translator_test.rb +0 -0
- data/test/lib/vedeu/output/writer_test.rb +8 -21
- data/test/lib/vedeu/repositories/repository_test.rb +0 -24
- data/test/lib/vedeu/support/refresh_test.rb +0 -10
- data/test/support/helpers/model_test_class.rb +1 -1
- data/vedeu.gemspec +1 -1
- metadata +22 -22
- data/lib/vedeu/presentation/all.rb +0 -9
@@ -8,7 +8,7 @@ module Vedeu
|
|
8
8
|
|
9
9
|
let(:described) { Vedeu::DSL::Keymap }
|
10
10
|
let(:instance) { described.new(model) }
|
11
|
-
let(:model) { Vedeu::Keymap.new('_test_') }
|
11
|
+
let(:model) { Vedeu::Keymap.new({ name: '_test_' }) }
|
12
12
|
|
13
13
|
describe '#initialize' do
|
14
14
|
it { instance.must_be_instance_of(described) }
|
@@ -51,12 +51,6 @@ module Vedeu
|
|
51
51
|
end
|
52
52
|
|
53
53
|
context 'when the key is not valid (already defined)' do
|
54
|
-
# let(:key_j) { Key.new('j') { :do_something } }
|
55
|
-
# let(:key_down) { Key.new(:down) { :do_something } }
|
56
|
-
|
57
|
-
# before { model.stubs(:keys).returns([key_j, key_down]) }
|
58
|
-
|
59
|
-
# it { subject.must_equal(false) }
|
60
54
|
end
|
61
55
|
end
|
62
56
|
|
@@ -18,59 +18,11 @@ module Vedeu
|
|
18
18
|
let(:collection) { [:sodium, :magnesium, :aluminium, :silicon] }
|
19
19
|
let(:menu_name) { 'elements' }
|
20
20
|
|
21
|
-
# describe '.define' do
|
22
|
-
# before { Menus.reset }
|
23
|
-
|
24
|
-
# context 'when a block was not given' do
|
25
|
-
# it { proc { Vedeu.menu }.must_raise(InvalidSyntax) }
|
26
|
-
# end
|
27
|
-
|
28
|
-
# context 'when no name was specified' do
|
29
|
-
# it { proc { Vedeu.menu { } }.must_raise(MissingRequired) }
|
30
|
-
# end
|
31
|
-
|
32
|
-
# it 'adds the menu to the menus repository' do
|
33
|
-
# Vedeu.menu do
|
34
|
-
# name menu_name
|
35
|
-
# items menu_items
|
36
|
-
# end
|
37
|
-
|
38
|
-
# Vedeu::Menus.registered.must_equal(['elements'])
|
39
|
-
# end
|
40
|
-
# end
|
41
|
-
|
42
21
|
describe '#initialize' do
|
43
22
|
it { instance.must_be_instance_of(Vedeu::DSL::Menu) }
|
44
23
|
it { instance.instance_variable_get('@model').must_equal(model) }
|
45
24
|
end
|
46
25
|
|
47
|
-
# describe '.define' do
|
48
|
-
# before { Menus.reset }
|
49
|
-
|
50
|
-
# context 'when a block was not given' do
|
51
|
-
# it { proc { Menu.define }.must_raise(InvalidSyntax) }
|
52
|
-
# end
|
53
|
-
|
54
|
-
# context 'when no name was specified for the menu' do
|
55
|
-
# it { proc { Menu.define { } }.must_raise(MissingRequired) }
|
56
|
-
# end
|
57
|
-
|
58
|
-
# it 'adds the menu to the menus repository' do
|
59
|
-
# Menu.define do
|
60
|
-
# name 'elements'
|
61
|
-
# items [:sodium, :magnesium, :aluminium, :silicon]
|
62
|
-
# end
|
63
|
-
|
64
|
-
# Vedeu::Menus.registered.must_equal(['elements'])
|
65
|
-
# end
|
66
|
-
|
67
|
-
# it 'returns the API::Menu instance' do
|
68
|
-
# Menu.define do
|
69
|
-
# name 'elements'
|
70
|
-
# end.must_be_instance_of(Vedeu::Menu)
|
71
|
-
# end
|
72
|
-
# end
|
73
|
-
|
74
26
|
describe '#item' do
|
75
27
|
let(:value) { :platinum }
|
76
28
|
|
@@ -45,134 +45,6 @@ module Vedeu
|
|
45
45
|
it { subject.must_be_instance_of(Vedeu::Border) }
|
46
46
|
end
|
47
47
|
|
48
|
-
# describe '#define' do
|
49
|
-
# interface = Interface.new({ name: 'widget' })
|
50
|
-
|
51
|
-
# it 'creates and stores a new interface' do
|
52
|
-
# interface.define.must_be_instance_of(API::Interface)
|
53
|
-
# end
|
54
|
-
|
55
|
-
# it 'allows the setting of colours' do
|
56
|
-
# Interface.build do
|
57
|
-
# colour foreground: '#aadd00', background: '#222222'
|
58
|
-
# end.must_equal(
|
59
|
-
# {
|
60
|
-
# border: {},
|
61
|
-
# colour: {
|
62
|
-
# foreground: '#aadd00',
|
63
|
-
# background: '#222222'
|
64
|
-
# },
|
65
|
-
# cursor: :hide,
|
66
|
-
# delay: 0.0,
|
67
|
-
# geometry: {},
|
68
|
-
# group: '',
|
69
|
-
# lines: [],
|
70
|
-
# name: '',
|
71
|
-
# parent: nil,
|
72
|
-
# style: '',
|
73
|
-
# }
|
74
|
-
# )
|
75
|
-
# end
|
76
|
-
|
77
|
-
# it 'allows the setting of styles' do
|
78
|
-
# Interface.build do
|
79
|
-
# style 'underline'
|
80
|
-
# end.must_equal(
|
81
|
-
# {
|
82
|
-
# border: {},
|
83
|
-
# colour: {},
|
84
|
-
# cursor: :hide,
|
85
|
-
# delay: 0.0,
|
86
|
-
# geometry: {},
|
87
|
-
# group: '',
|
88
|
-
# lines: [],
|
89
|
-
# name: '',
|
90
|
-
# parent: nil,
|
91
|
-
# style: "underline",
|
92
|
-
# }
|
93
|
-
# )
|
94
|
-
# end
|
95
|
-
|
96
|
-
# it 'allows the use of other interfaces for attributes like geometry' do
|
97
|
-
# IO.console.stub(:winsize, [25, 40]) do
|
98
|
-
# interface = Vedeu.interface 'my_interface' do
|
99
|
-
# geometry do
|
100
|
-
# x 5
|
101
|
-
# y 5
|
102
|
-
# width 5
|
103
|
-
# height 5
|
104
|
-
# end
|
105
|
-
# end
|
106
|
-
# Interface.build do
|
107
|
-
# name 'my_other_interface'
|
108
|
-
# y use('my_interface').south
|
109
|
-
# end.must_equal({
|
110
|
-
# border: {},
|
111
|
-
# colour: {},
|
112
|
-
# cursor: :hide,
|
113
|
-
# delay: 0.0,
|
114
|
-
# geometry: {
|
115
|
-
# y: 11
|
116
|
-
# },
|
117
|
-
# group: '',
|
118
|
-
# lines: [],
|
119
|
-
# name: "my_other_interface",
|
120
|
-
# parent: nil,
|
121
|
-
# style: '',
|
122
|
-
# })
|
123
|
-
# end
|
124
|
-
# end
|
125
|
-
|
126
|
-
# it 'allows the setting of a delay for events triggered for this ' \
|
127
|
-
# 'interface' do
|
128
|
-
# Interface.build do
|
129
|
-
# delay 1.0
|
130
|
-
# end.must_equal(
|
131
|
-
# {
|
132
|
-
# border: {},
|
133
|
-
# colour: {},
|
134
|
-
# cursor: :hide,
|
135
|
-
# delay: 1.0,
|
136
|
-
# geometry: {},
|
137
|
-
# group: '',
|
138
|
-
# lines: [],
|
139
|
-
# name: '',
|
140
|
-
# parent: nil,
|
141
|
-
# style: '',
|
142
|
-
# })
|
143
|
-
# end
|
144
|
-
|
145
|
-
# it 'allows the interface to be part of a group- useful for creating ' \
|
146
|
-
# 'separate views' do
|
147
|
-
# Interface.build do
|
148
|
-
# group 'my_group'
|
149
|
-
# end.must_equal(
|
150
|
-
# {
|
151
|
-
# border: {},
|
152
|
-
# colour: {},
|
153
|
-
# cursor: :hide,
|
154
|
-
# delay: 0.0,
|
155
|
-
# geometry: {},
|
156
|
-
# group: "my_group",
|
157
|
-
# lines: [],
|
158
|
-
# name: '',
|
159
|
-
# parent: nil,
|
160
|
-
# style: '',
|
161
|
-
# }
|
162
|
-
# )
|
163
|
-
# end
|
164
|
-
# end
|
165
|
-
|
166
|
-
# describe '#centred' do
|
167
|
-
# it 'returns false if the value is false or nil' do
|
168
|
-
# DSL::Interface.new.centred(false).must_equal(false)
|
169
|
-
# end
|
170
|
-
|
171
|
-
# it 'returns true' do
|
172
|
-
# DSL::Interface.new.centred.must_equal(true)
|
173
|
-
# end
|
174
|
-
# end
|
175
|
-
|
176
48
|
describe '#cursor' do
|
177
49
|
let(:value) {}
|
178
50
|
|
@@ -262,19 +134,6 @@ module Vedeu
|
|
262
134
|
end
|
263
135
|
end
|
264
136
|
|
265
|
-
# context 'when multiple calls are made' do
|
266
|
-
# before do
|
267
|
-
# Vedeu::Focus.reset
|
268
|
-
# Vedeu.interface('curium') { focus! }
|
269
|
-
# Vedeu.interface('iodine') {}
|
270
|
-
# Vedeu.interface('dysprosium') { focus! }
|
271
|
-
# end
|
272
|
-
|
273
|
-
# it 'the last call will set that interface to be current' do
|
274
|
-
# Vedeu.focus.must_equal('dysprosium')
|
275
|
-
# end
|
276
|
-
# end
|
277
|
-
|
278
137
|
context 'when no calls are made' do
|
279
138
|
before do
|
280
139
|
Vedeu::Focus.reset
|
@@ -318,7 +177,7 @@ module Vedeu
|
|
318
177
|
end
|
319
178
|
end
|
320
179
|
|
321
|
-
describe '#
|
180
|
+
describe '#keymap' do
|
322
181
|
subject {
|
323
182
|
instance.keys do
|
324
183
|
# ...
|
@@ -326,34 +185,6 @@ module Vedeu
|
|
326
185
|
}
|
327
186
|
|
328
187
|
it { subject.must_be_instance_of(Vedeu::Keymap) }
|
329
|
-
|
330
|
-
context 'when the required block is not provided' do
|
331
|
-
subject { instance.keys }
|
332
|
-
|
333
|
-
it { proc { subject }.must_raise(InvalidSyntax) }
|
334
|
-
end
|
335
|
-
|
336
|
-
# before do
|
337
|
-
# Keymaps.reset
|
338
|
-
|
339
|
-
# Vedeu.interface 'iron' do
|
340
|
-
# keys do
|
341
|
-
# key('k') { :k_pressed }
|
342
|
-
# end
|
343
|
-
# end
|
344
|
-
# end
|
345
|
-
|
346
|
-
# it 'defines a keymap for the interface' do
|
347
|
-
# Keymaps.interface_key?('k').must_equal(true)
|
348
|
-
# end
|
349
|
-
|
350
|
-
# it 'defines a keymap for the interface' do
|
351
|
-
# Keymaps.interface_keys('iron').must_equal(['k'])
|
352
|
-
# end
|
353
|
-
|
354
|
-
# context 'when the block is not given' do
|
355
|
-
# it { proc { Vedeu.interface('iron') { keys } }.must_raise(InvalidSyntax) }
|
356
|
-
# end
|
357
188
|
end
|
358
189
|
|
359
190
|
describe '#lines' do
|
@@ -370,99 +201,6 @@ module Vedeu
|
|
370
201
|
|
371
202
|
it { proc { subject }.must_raise(InvalidSyntax) }
|
372
203
|
end
|
373
|
-
|
374
|
-
# it 'adds a blank line with no arguments' do
|
375
|
-
# interface = Vedeu.interface 'carbon' do
|
376
|
-
# line
|
377
|
-
# end
|
378
|
-
# interface.must_be_instance_of(API::Interface)
|
379
|
-
# interface.attributes.must_equal(
|
380
|
-
# {
|
381
|
-
# border: {},
|
382
|
-
# colour: {},
|
383
|
-
# cursor: :hide,
|
384
|
-
# delay: 0.0,
|
385
|
-
# geometry: {},
|
386
|
-
# group: '',
|
387
|
-
# lines: [
|
388
|
-
# {
|
389
|
-
# colour: {},
|
390
|
-
# streams: {
|
391
|
-
# text: ''
|
392
|
-
# },
|
393
|
-
# style: [],
|
394
|
-
# }
|
395
|
-
# ],
|
396
|
-
# name: 'carbon',
|
397
|
-
# parent: nil,
|
398
|
-
# style: '',
|
399
|
-
# }
|
400
|
-
# )
|
401
|
-
# end
|
402
|
-
|
403
|
-
# it 'adds a line directly with a value and no block' do
|
404
|
-
# interface = Vedeu.interface 'carbon' do
|
405
|
-
# line 'This is some text...'
|
406
|
-
# end
|
407
|
-
# interface.must_be_instance_of(API::Interface)
|
408
|
-
# interface.attributes.must_equal(
|
409
|
-
# {
|
410
|
-
# border: {},
|
411
|
-
# colour: {},
|
412
|
-
# cursor: :hide,
|
413
|
-
# delay: 0.0,
|
414
|
-
# geometry: {},
|
415
|
-
# group: '',
|
416
|
-
# lines: [
|
417
|
-
# {
|
418
|
-
# colour: {},
|
419
|
-
# parent: composition,
|
420
|
-
# streams: {
|
421
|
-
# text: "This is some text..."
|
422
|
-
# },
|
423
|
-
# style: [],
|
424
|
-
# }
|
425
|
-
# ],
|
426
|
-
# name: 'carbon',
|
427
|
-
# parent: nil,
|
428
|
-
# style: '',
|
429
|
-
# }
|
430
|
-
# )
|
431
|
-
# end
|
432
|
-
|
433
|
-
# it 'allows the addition of more attributes with a block' do
|
434
|
-
# interface = Vedeu.interface 'silicon' do
|
435
|
-
# lines do
|
436
|
-
# text 'This is different text...'
|
437
|
-
# end
|
438
|
-
# end
|
439
|
-
# interface.must_be_instance_of(API::Interface)
|
440
|
-
# interface.attributes.must_equal(
|
441
|
-
# {
|
442
|
-
# border: {},
|
443
|
-
# colour: {},
|
444
|
-
# cursor: :hide,
|
445
|
-
# delay: 0.0,
|
446
|
-
# geometry: {},
|
447
|
-
# group: '',
|
448
|
-
# lines: [
|
449
|
-
# {
|
450
|
-
# colour: {},
|
451
|
-
# parent: composition,
|
452
|
-
# streams: [
|
453
|
-
# {
|
454
|
-
# text: "This is different text..."
|
455
|
-
# }
|
456
|
-
# ],
|
457
|
-
# style: [],
|
458
|
-
# }
|
459
|
-
# ],
|
460
|
-
# name: "silicon",
|
461
|
-
# parent: nil,
|
462
|
-
# style: '',
|
463
|
-
# }
|
464
|
-
# )
|
465
|
-
# end
|
466
204
|
end
|
467
205
|
|
468
206
|
describe '#name' do
|
@@ -7,12 +7,6 @@ module Vedeu
|
|
7
7
|
describe Text do
|
8
8
|
|
9
9
|
describe '#text' do
|
10
|
-
|
11
|
-
# it { described.must_respond_to(:align) }
|
12
|
-
# it { described.must_respond_to(:center) }
|
13
|
-
# it { described.must_respond_to(:centre) }
|
14
|
-
# it { described.must_respond_to(:left) }
|
15
|
-
# it { described.must_respond_to(:right) }
|
16
10
|
end
|
17
11
|
|
18
12
|
end # Text
|
@@ -20,7 +20,6 @@ module Vedeu
|
|
20
20
|
it { instance.must_be_instance_of(Event) }
|
21
21
|
it { instance.instance_variable_get('@name').must_equal(event_name) }
|
22
22
|
it { instance.instance_variable_get('@options').must_equal(options) }
|
23
|
-
# it { instance.instance_variable_get('@closure').must_equal(closure) }
|
24
23
|
it { instance.instance_variable_get('@deadline').must_equal(0) }
|
25
24
|
it { instance.instance_variable_get('@executed_at').must_equal(0) }
|
26
25
|
it { instance.instance_variable_get('@now').must_equal(0) }
|
@@ -4,8 +4,14 @@ module Vedeu
|
|
4
4
|
|
5
5
|
describe Keymap do
|
6
6
|
|
7
|
-
let(:described)
|
8
|
-
let(:instance)
|
7
|
+
let(:described) { Vedeu::Keymap }
|
8
|
+
let(:instance) { described.new(attributes) }
|
9
|
+
let(:attributes) {
|
10
|
+
{
|
11
|
+
name: map_name,
|
12
|
+
keys: keys
|
13
|
+
}
|
14
|
+
}
|
9
15
|
let(:map_name) { 'zirconium' }
|
10
16
|
let(:keys) { [] }
|
11
17
|
let(:key) { Vedeu::Key.new('a') { :output } }
|
@@ -41,7 +41,7 @@ module Vedeu
|
|
41
41
|
|
42
42
|
context 'and the key is defined' do
|
43
43
|
let(:key_test) { Key.new('a') { :do_something } }
|
44
|
-
let(:keymap_test) { Keymap.new('test', [key_test]) }
|
44
|
+
let(:keymap_test) { Keymap.new({ name: 'test', keys: [key_test] }) }
|
45
45
|
|
46
46
|
before do
|
47
47
|
Vedeu.keymaps.reset
|
@@ -71,7 +71,7 @@ module Vedeu
|
|
71
71
|
|
72
72
|
context 'and the key is defined' do
|
73
73
|
let(:key_test) { Key.new('a') { :do_something } }
|
74
|
-
let(:keymap_test) { Keymap.new('test', [key_test]) }
|
74
|
+
let(:keymap_test) { Keymap.new({ name: 'test', keys: [key_test] }) }
|
75
75
|
|
76
76
|
before do
|
77
77
|
Vedeu.keymaps.reset
|
@@ -40,18 +40,6 @@ module Vedeu
|
|
40
40
|
it 'returns 0 for successful execution' do
|
41
41
|
subject.must_equal(0)
|
42
42
|
end
|
43
|
-
|
44
|
-
# context 'when an exception is raised' do
|
45
|
-
# before do
|
46
|
-
# Application.stubs(:start).raises(StandardError)
|
47
|
-
# end
|
48
|
-
|
49
|
-
# it 'displays the exception' do
|
50
|
-
# capture_io do
|
51
|
-
# Launcher.execute!
|
52
|
-
# end.must_equal(["", ""])
|
53
|
-
# end
|
54
|
-
# end
|
55
43
|
end
|
56
44
|
|
57
45
|
end # Launcher
|
@@ -8,15 +8,9 @@ module Vedeu
|
|
8
8
|
|
9
9
|
describe '.start!' do
|
10
10
|
before do
|
11
|
-
# subject.expects(:while).yields do
|
12
|
-
# String.expects(:new).returns("samantha")
|
13
|
-
# end
|
14
11
|
end
|
15
12
|
|
16
13
|
subject { described.start! { } }
|
17
|
-
|
18
|
-
# it { subject; described.instance_variable_get('@started').must_equal(true) }
|
19
|
-
# it { subject; described.instance_variable_get('@loop').must_equal(true) }
|
20
14
|
end
|
21
15
|
|
22
16
|
describe '.stop!' do
|
@@ -25,17 +19,6 @@ module Vedeu
|
|
25
19
|
it { subject; described.instance_variable_get('@loop').must_equal(false) }
|
26
20
|
end
|
27
21
|
|
28
|
-
describe '.safe_exit_point!' do
|
29
|
-
subject { described.safe_exit_point! }
|
30
|
-
|
31
|
-
context 'when we wish to continue' do
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'when we wish to stop' do
|
35
|
-
# it { proc { subject }.must_raise(VedeuInterrupt) }
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
22
|
end # MainLoop
|
40
23
|
|
41
24
|
end # Vedeu
|
@@ -6,17 +6,37 @@ module Vedeu
|
|
6
6
|
|
7
7
|
let(:described) { Vedeu::Focus }
|
8
8
|
|
9
|
-
before
|
9
|
+
before do
|
10
|
+
Focus.reset
|
11
|
+
Vedeu.interfaces.reset
|
12
|
+
Vedeu.interface('thallium') {}
|
13
|
+
Vedeu.interface('lead') {}
|
14
|
+
Vedeu.interface('bismuth') {}
|
15
|
+
end
|
10
16
|
|
11
17
|
describe '#add' do
|
12
|
-
|
13
|
-
|
18
|
+
context 'adds an interface to storage' do
|
19
|
+
before do
|
20
|
+
Focus.reset
|
21
|
+
Vedeu.interfaces.reset
|
22
|
+
end
|
23
|
+
|
24
|
+
it {
|
25
|
+
Focus.add('thallium').must_equal(['thallium'])
|
26
|
+
}
|
14
27
|
end
|
15
28
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
29
|
+
context 'does not add it again if already exists' do
|
30
|
+
before do
|
31
|
+
Focus.reset
|
32
|
+
Vedeu.interfaces.reset
|
33
|
+
Vedeu.interface('thallium') {}
|
34
|
+
end
|
35
|
+
|
36
|
+
it {
|
37
|
+
Focus.add('thallium')
|
38
|
+
Focus.registered.must_equal(['thallium'])
|
39
|
+
}
|
20
40
|
end
|
21
41
|
|
22
42
|
it 'does not add it again if already exists' do
|
@@ -27,16 +47,32 @@ module Vedeu
|
|
27
47
|
Focus.registered.must_equal(['bismuth', 'thallium', 'lead'])
|
28
48
|
end
|
29
49
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
50
|
+
context 'adds the interface to storage focussed' do
|
51
|
+
before do
|
52
|
+
Focus.reset
|
53
|
+
Vedeu.interfaces.reset
|
54
|
+
Vedeu.interface('thallium') {}
|
55
|
+
end
|
56
|
+
|
57
|
+
it {
|
58
|
+
Focus.add('thallium')
|
59
|
+
Focus.add('lead', true)
|
60
|
+
Focus.registered.must_equal(['lead', 'thallium'])
|
61
|
+
}
|
34
62
|
end
|
35
63
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
64
|
+
context 'adds the interface to storage unfocussed' do
|
65
|
+
before do
|
66
|
+
Focus.reset
|
67
|
+
Vedeu.interfaces.reset
|
68
|
+
Vedeu.interface('thallium') {}
|
69
|
+
end
|
70
|
+
|
71
|
+
it {
|
72
|
+
Focus.add('thallium')
|
73
|
+
Focus.add('lead')
|
74
|
+
Focus.registered.must_equal(['thallium', 'lead'])
|
75
|
+
}
|
40
76
|
end
|
41
77
|
end
|
42
78
|
|
@@ -122,8 +158,10 @@ module Vedeu
|
|
122
158
|
Focus.next_item.must_equal('lead')
|
123
159
|
end
|
124
160
|
|
125
|
-
|
126
|
-
Focus.
|
161
|
+
context 'returns false if storage is empty' do
|
162
|
+
before { Focus.reset }
|
163
|
+
|
164
|
+
it { Focus.next_item.must_equal(false) }
|
127
165
|
end
|
128
166
|
end
|
129
167
|
|
@@ -135,8 +173,10 @@ module Vedeu
|
|
135
173
|
Focus.prev_item.must_equal('bismuth')
|
136
174
|
end
|
137
175
|
|
138
|
-
|
139
|
-
Focus.
|
176
|
+
context 'returns false if storage is empty' do
|
177
|
+
before { Focus.reset }
|
178
|
+
|
179
|
+
it { Focus.prev_item.must_equal(false) }
|
140
180
|
end
|
141
181
|
end
|
142
182
|
|