vedeu 0.6.20 → 0.6.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/README.md +4 -0
- data/Rakefile +13 -0
- data/bin/vedeu_drb_server +6 -6
- data/docs/api.md +14 -0
- data/docs/dsl.md +12 -12
- data/docs/events/document.md +4 -2
- data/docs/events/drb.md +4 -0
- data/docs/events/focus.md +2 -0
- data/docs/events/menu.md +2 -0
- data/docs/events/movement.md +7 -5
- data/docs/events/refresh.md +2 -0
- data/docs/events/system.md +5 -0
- data/docs/events/view.md +2 -0
- data/docs/events/visibility.md +2 -0
- data/lib/vedeu.rb +0 -23
- data/lib/vedeu/all.rb +2 -4
- data/lib/vedeu/application/application_view.rb +1 -1
- data/lib/vedeu/borders/all.rb +3 -3
- data/lib/vedeu/borders/border.rb +2 -2
- data/lib/vedeu/borders/dsl.rb +21 -27
- data/lib/vedeu/borders/null.rb +2 -15
- data/lib/vedeu/borders/render.rb +1 -1
- data/lib/vedeu/borders/repository.rb +9 -0
- data/lib/vedeu/buffers/buffer.rb +2 -2
- data/lib/vedeu/buffers/null.rb +1 -31
- data/lib/vedeu/buffers/refresh.rb +8 -8
- data/lib/vedeu/buffers/repository.rb +9 -0
- data/lib/vedeu/colours/backgrounds.rb +9 -0
- data/lib/vedeu/colours/colour.rb +1 -1
- data/lib/vedeu/colours/foregrounds.rb +9 -0
- data/lib/vedeu/common.rb +22 -13
- data/lib/vedeu/configuration/configuration.rb +6 -0
- data/lib/vedeu/cursors/cursor.rb +13 -8
- data/lib/vedeu/cursors/refresh.rb +2 -2
- data/lib/vedeu/cursors/repository.rb +18 -1
- data/lib/vedeu/distributed/server.rb +23 -0
- data/lib/vedeu/distributed/templates/default_borders.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_geometries.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_interfaces.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_keymaps.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_menus.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_views.vedeu +1 -1
- data/lib/vedeu/dsl/composition.rb +7 -17
- data/lib/vedeu/dsl/dsl.rb +12 -0
- data/lib/vedeu/dsl/interface.rb +32 -33
- data/lib/vedeu/dsl/keymap.rb +13 -19
- data/lib/vedeu/dsl/line.rb +3 -13
- data/lib/vedeu/dsl/shared.rb +5 -5
- data/lib/vedeu/dsl/stream.rb +0 -10
- data/lib/vedeu/dsl/use.rb +6 -6
- data/lib/vedeu/dsl/view.rb +17 -19
- data/lib/vedeu/editor/cursor.rb +32 -10
- data/lib/vedeu/editor/document.rb +33 -35
- data/lib/vedeu/editor/editor.rb +3 -4
- data/lib/vedeu/editor/insert.rb +1 -1
- data/lib/vedeu/editor/line.rb +1 -8
- data/lib/vedeu/editor/lines.rb +1 -1
- data/lib/vedeu/editor/repository.rb +9 -0
- data/lib/vedeu/esc/esc.rb +2 -1
- data/lib/vedeu/events/aliases.rb +8 -1
- data/lib/vedeu/events/event.rb +8 -0
- data/lib/vedeu/events/repository.rb +9 -0
- data/lib/vedeu/events/trigger.rb +9 -5
- data/lib/vedeu/geometry/coordinate.rb +2 -2
- data/lib/vedeu/geometry/dsl.rb +32 -38
- data/lib/vedeu/geometry/generic_coordinate.rb +1 -1
- data/lib/vedeu/geometry/geometry.rb +3 -3
- data/lib/vedeu/geometry/null.rb +2 -24
- data/lib/vedeu/geometry/repository.rb +9 -0
- data/lib/vedeu/groups/clear.rb +7 -3
- data/lib/vedeu/groups/dsl.rb +29 -35
- data/lib/vedeu/groups/group.rb +28 -4
- data/lib/vedeu/groups/refresh.rb +3 -2
- data/lib/vedeu/groups/repository.rb +9 -0
- data/lib/vedeu/input/capture.rb +1 -1
- data/lib/vedeu/input/keymap.rb +2 -1
- data/lib/vedeu/input/keymaps.rb +9 -0
- data/lib/vedeu/input/mapper.rb +4 -0
- data/lib/vedeu/input/translator.rb +1 -1
- data/lib/vedeu/logging/debug.rb +13 -0
- data/lib/vedeu/logging/log.rb +8 -0
- data/lib/vedeu/logging/timer.rb +13 -0
- data/lib/vedeu/menus/dsl.rb +8 -18
- data/lib/vedeu/menus/menu.rb +8 -4
- data/lib/vedeu/menus/null.rb +1 -1
- data/lib/vedeu/menus/repository.rb +9 -0
- data/lib/vedeu/models/cell.rb +5 -0
- data/lib/vedeu/models/escape.rb +5 -0
- data/lib/vedeu/models/focus.rb +20 -5
- data/lib/vedeu/models/interface.rb +10 -1
- data/lib/vedeu/models/interfaces.rb +9 -0
- data/lib/vedeu/models/toggleable.rb +19 -4
- data/lib/vedeu/models/views/char.rb +6 -1
- data/lib/vedeu/models/views/html_char.rb +1 -4
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/view.rb +1 -1
- data/lib/vedeu/null/generic.rb +14 -2
- data/lib/vedeu/null/interface.rb +1 -1
- data/lib/vedeu/null/view.rb +1 -1
- data/lib/vedeu/output/clear/interface.rb +5 -1
- data/lib/vedeu/output/compressor.rb +8 -4
- data/lib/vedeu/output/direct.rb +4 -4
- data/lib/vedeu/output/presentation/all.rb +15 -0
- data/lib/vedeu/output/presentation/presentation.rb +0 -7
- data/lib/vedeu/output/refresh/refresh.rb +1 -3
- data/lib/vedeu/output/renderers/all.rb +10 -0
- data/lib/vedeu/output/renderers/terminal.rb +1 -3
- data/lib/vedeu/repositories/collection.rb +3 -3
- data/lib/vedeu/repositories/model.rb +1 -1
- data/lib/vedeu/repositories/repository.rb +8 -8
- data/lib/vedeu/repositories/store.rb +3 -2
- data/lib/vedeu/runtime/application.rb +4 -0
- data/lib/vedeu/runtime/bootstrap.rb +1 -1
- data/lib/vedeu/runtime/flags.rb +7 -0
- data/lib/vedeu/runtime/main_loop.rb +2 -0
- data/lib/vedeu/runtime/router.rb +4 -0
- data/lib/vedeu/templating/decoder.rb +1 -1
- data/lib/vedeu/templating/encoder.rb +1 -1
- data/lib/vedeu/templating/helpers.rb +2 -0
- data/lib/vedeu/templating/template.rb +1 -1
- data/lib/vedeu/terminal/buffer.rb +7 -0
- data/lib/vedeu/terminal/terminal.rb +8 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/dsl_test.rb +0 -6
- data/test/lib/vedeu/borders/null_test.rb +0 -12
- data/test/lib/vedeu/buffers/null_test.rb +0 -37
- data/test/lib/vedeu/common_test.rb +33 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +1 -1
- data/test/lib/vedeu/dsl/composition_test.rb +0 -6
- data/test/lib/vedeu/dsl/dsl_test.rb +1 -0
- data/test/lib/vedeu/dsl/interface_test.rb +0 -6
- data/test/lib/vedeu/dsl/keymap_test.rb +0 -5
- data/test/lib/vedeu/dsl/line_test.rb +0 -7
- data/test/lib/vedeu/dsl/stream_test.rb +0 -7
- data/test/lib/vedeu/editor/cursor_test.rb +23 -8
- data/test/lib/vedeu/editor/document_test.rb +27 -23
- data/test/lib/vedeu/editor/line_test.rb +0 -30
- data/test/lib/vedeu/geometry/dsl_test.rb +0 -5
- data/test/lib/vedeu/geometry/null_test.rb +0 -30
- data/test/lib/vedeu/groups/dsl_test.rb +0 -6
- data/test/lib/vedeu/groups/group_test.rb +15 -7
- data/test/lib/vedeu/menus/dsl_test.rb +0 -5
- data/test/lib/vedeu/models/cell_test.rb +4 -0
- data/test/lib/vedeu/models/escape_test.rb +4 -0
- data/test/lib/vedeu/models/views/char_test.rb +4 -0
- data/test/lib/vedeu/null/generic_test.rb +13 -0
- data/test/lib/vedeu/terminal/buffer_test.rb +3 -2
- data/test/lib/vedeu_test.rb +81 -3
- data/test/support/examples/borders_app.rb +1 -3
- data/test/support/examples/drb_app.rb +1 -3
- data/test/support/examples/editor_app.rb +2 -4
- data/test/support/examples/focus_app.rb +1 -3
- data/test/support/examples/hello_world.rb +1 -6
- data/test/support/examples/material_colours_app.rb +1 -3
- data/test/support/examples/view_templates_app/view_templates_app.rb +1 -3
- data/test/support/helpers/model_test_class.rb +1 -5
- data/test/support/who.rb +29 -0
- data/test/test_helper.rb +0 -1
- metadata +5 -17
- data/lib/vedeu/api/all.rb +0 -15
- data/lib/vedeu/api/external.rb +0 -194
- data/lib/vedeu/api/internal.rb +0 -177
- data/test/lib/vedeu/api/external_test.rb +0 -74
- data/test/lib/vedeu/api/internal_test.rb +0 -33
- data/test/support/examples/typed_commands/command.erb +0 -1
- data/test/support/examples/typed_commands/output.erb +0 -1
- data/test/support/examples/typed_commands/status.erb +0 -1
- data/test/support/examples/typed_commands/typed_commands_app.rb +0 -94
@@ -11,12 +11,6 @@ module Vedeu
|
|
11
11
|
let(:model) { Vedeu::Views::Composition.new }
|
12
12
|
let(:client) {}
|
13
13
|
|
14
|
-
describe '#initialize' do
|
15
|
-
it { instance.must_be_instance_of(described) }
|
16
|
-
it { instance.instance_variable_get('@model').must_equal(model) }
|
17
|
-
it { instance.instance_variable_get('@client').must_equal(client) }
|
18
|
-
end
|
19
|
-
|
20
14
|
describe '#view' do
|
21
15
|
subject {
|
22
16
|
instance.view('dysprosium') do
|
@@ -14,12 +14,6 @@ module Vedeu
|
|
14
14
|
let(:_name) { 'actinium' }
|
15
15
|
let(:client) {}
|
16
16
|
|
17
|
-
describe '#initialize' do
|
18
|
-
it { instance.must_be_instance_of(described) }
|
19
|
-
it { instance.instance_variable_get('@model').must_equal(model) }
|
20
|
-
it { instance.instance_variable_get('@client').must_equal(client) }
|
21
|
-
end
|
22
|
-
|
23
17
|
describe '.interface' do
|
24
18
|
after { Vedeu.interfaces.reset }
|
25
19
|
|
@@ -10,11 +10,6 @@ module Vedeu
|
|
10
10
|
let(:instance) { described.new(model) }
|
11
11
|
let(:model) { Vedeu::Input::Keymap.new(name: '_test_') }
|
12
12
|
|
13
|
-
describe '#initialize' do
|
14
|
-
it { instance.must_be_instance_of(described) }
|
15
|
-
it { instance.instance_variable_get('@model').must_equal(model) }
|
16
|
-
end
|
17
|
-
|
18
13
|
describe '#key' do
|
19
14
|
let(:value_or_values) { ['j', :down] }
|
20
15
|
|
@@ -24,13 +24,6 @@ module Vedeu
|
|
24
24
|
}
|
25
25
|
}
|
26
26
|
|
27
|
-
|
28
|
-
describe '#initialize' do
|
29
|
-
it { instance.must_be_instance_of(described) }
|
30
|
-
it { instance.instance_variable_get('@model').must_equal(model) }
|
31
|
-
it { instance.instance_variable_get('@client').must_equal(client) }
|
32
|
-
end
|
33
|
-
|
34
27
|
describe '#line' do
|
35
28
|
let(:_value) { '' }
|
36
29
|
|
@@ -9,15 +9,8 @@ module Vedeu
|
|
9
9
|
let(:described) { Vedeu::DSL::Stream }
|
10
10
|
let(:instance) { described.new(model) }
|
11
11
|
let(:model) { Vedeu::Views::Stream.new(parent: parent) }
|
12
|
-
let(:client) {}
|
13
12
|
let(:parent) { Vedeu::Views::Line.new }
|
14
13
|
|
15
|
-
describe '#initialize' do
|
16
|
-
it { instance.must_be_instance_of(described) }
|
17
|
-
it { instance.instance_variable_get('@model').must_equal(model) }
|
18
|
-
it { instance.instance_variable_get('@client').must_equal(client) }
|
19
|
-
end
|
20
|
-
|
21
14
|
describe '#stream' do
|
22
15
|
subject { instance.stream { } }
|
23
16
|
|
@@ -10,14 +10,15 @@ module Vedeu
|
|
10
10
|
let(:instance) { described.new(attributes) }
|
11
11
|
let(:attributes) {
|
12
12
|
{
|
13
|
-
y:
|
14
|
-
x:
|
15
|
-
bx:
|
16
|
-
by:
|
17
|
-
byn:
|
18
|
-
bxn:
|
19
|
-
|
20
|
-
|
13
|
+
y: y,
|
14
|
+
x: x,
|
15
|
+
bx: bx,
|
16
|
+
by: by,
|
17
|
+
byn: byn,
|
18
|
+
bxn: bxn,
|
19
|
+
name: _name,
|
20
|
+
oy: oy,
|
21
|
+
ox: ox
|
21
22
|
}
|
22
23
|
}
|
23
24
|
let(:y) { 0 }
|
@@ -26,6 +27,7 @@ module Vedeu
|
|
26
27
|
let(:bx) { 1 }
|
27
28
|
let(:byn) { 6 }
|
28
29
|
let(:bxn) { 6 }
|
30
|
+
let(:_name) { 'editor_cursor' }
|
29
31
|
let(:oy) { 0 }
|
30
32
|
let(:ox) { 0 }
|
31
33
|
|
@@ -37,6 +39,7 @@ module Vedeu
|
|
37
39
|
it { instance.instance_variable_get('@bx').must_equal(bx) }
|
38
40
|
it { instance.instance_variable_get('@byn').must_equal(byn) }
|
39
41
|
it { instance.instance_variable_get('@bxn').must_equal(bxn) }
|
42
|
+
it { instance.instance_variable_get('@name').must_equal(_name) }
|
40
43
|
it { instance.instance_variable_get('@oy').must_equal(0) }
|
41
44
|
it { instance.instance_variable_get('@ox').must_equal(0) }
|
42
45
|
|
@@ -71,6 +74,7 @@ module Vedeu
|
|
71
74
|
instance.must_respond_to(:bxn=)
|
72
75
|
instance.must_respond_to(:byn)
|
73
76
|
instance.must_respond_to(:byn=)
|
77
|
+
instance.must_respond_to(:name)
|
74
78
|
instance.must_respond_to(:ox)
|
75
79
|
instance.must_respond_to(:ox=)
|
76
80
|
instance.must_respond_to(:oy)
|
@@ -116,6 +120,17 @@ module Vedeu
|
|
116
120
|
it { subject.ox.must_equal(3) }
|
117
121
|
end
|
118
122
|
|
123
|
+
describe '#store' do
|
124
|
+
before { Vedeu::Cursors::Cursor.stubs(:store) }
|
125
|
+
|
126
|
+
subject { instance.store }
|
127
|
+
|
128
|
+
it 'stores the virtual cursor in place of the real cursor' do
|
129
|
+
Vedeu::Cursors::Cursor.expects(:store)
|
130
|
+
subject.must_be_instance_of(described)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
119
134
|
describe '#reset!' do
|
120
135
|
let(:x) { 11 }
|
121
136
|
let(:y) { 5 }
|
@@ -19,9 +19,24 @@ module Vedeu
|
|
19
19
|
"Helium\n" \
|
20
20
|
"Lithium\n"
|
21
21
|
}
|
22
|
-
let(:_name)
|
22
|
+
let(:_name) { 'Vedeu::Editor::Document' }
|
23
|
+
let(:border) {
|
24
|
+
Vedeu::Borders::Border.new({ name: _name, enabled: false })
|
25
|
+
}
|
26
|
+
let(:geometry) {
|
27
|
+
Vedeu::Geometry::Geometry.new({ name: _name, x: 1, xn: 5, y: 1, yn: 5 })
|
28
|
+
}
|
29
|
+
let(:interface) {
|
30
|
+
Vedeu::Models::Interface.new({ name: _name })
|
31
|
+
}
|
23
32
|
|
24
|
-
before {
|
33
|
+
before {
|
34
|
+
Vedeu.borders.stubs(:by_name).with(_name).returns(border)
|
35
|
+
Vedeu.geometries.stubs(:by_name).with(_name).returns(geometry)
|
36
|
+
Vedeu.interfaces.stubs(:by_name).with(_name).returns(interface)
|
37
|
+
|
38
|
+
Vedeu::Output::Output.stubs(:render)
|
39
|
+
}
|
25
40
|
|
26
41
|
describe '#initialize' do
|
27
42
|
it { instance.must_be_instance_of(described) }
|
@@ -44,28 +59,14 @@ module Vedeu
|
|
44
59
|
end
|
45
60
|
|
46
61
|
describe '#clear' do
|
47
|
-
|
48
|
-
"\e[1;1H\e[1;1H " \
|
49
|
-
"\e[2;1H " \
|
50
|
-
"\e[3;1H " \
|
51
|
-
"\e[4;1H " \
|
52
|
-
"\e[5;1H " \
|
53
|
-
"\e[1;1H"
|
54
|
-
}
|
55
|
-
|
56
|
-
before do
|
57
|
-
Vedeu::Geometry::Geometry.new(name: _name,
|
58
|
-
x: 1,
|
59
|
-
y: 1,
|
60
|
-
xn: 5,
|
61
|
-
yn: 5).store
|
62
|
-
Vedeu::Terminal.stubs(:output)
|
63
|
-
Vedeu::Output::Direct.stubs(:write).returns(expected)
|
64
|
-
end
|
62
|
+
before { Vedeu.stubs(:trigger).with(:_clear_view_, _name) }
|
65
63
|
|
66
64
|
subject { instance.clear }
|
67
65
|
|
68
|
-
it {
|
66
|
+
it {
|
67
|
+
Vedeu.expects(:trigger).with(:_clear_view_, _name)
|
68
|
+
subject
|
69
|
+
}
|
69
70
|
end
|
70
71
|
|
71
72
|
describe '#delete_character' do
|
@@ -181,12 +182,15 @@ module Vedeu
|
|
181
182
|
}
|
182
183
|
let(:output) { "\e[1;1HA\e[2;1HB\e[3;1HC\e[1;1H\e[?25h" }
|
183
184
|
|
184
|
-
before {
|
185
|
+
before {
|
186
|
+
Vedeu.stubs(:trigger).with(:_clear_view_, _name)
|
187
|
+
Vedeu::Output::Output.stubs(:render)
|
188
|
+
}
|
185
189
|
|
186
190
|
subject { instance.render }
|
187
191
|
|
188
192
|
it {
|
189
|
-
Vedeu::Output::
|
193
|
+
Vedeu::Output::Output.expects(:render)
|
190
194
|
subject
|
191
195
|
}
|
192
196
|
end
|
@@ -282,36 +282,6 @@ module Vedeu
|
|
282
282
|
end
|
283
283
|
end
|
284
284
|
|
285
|
-
describe '#to_chars' do
|
286
|
-
subject { instance.to_chars }
|
287
|
-
|
288
|
-
context 'when the line is empty' do
|
289
|
-
let(:line) {}
|
290
|
-
|
291
|
-
it { subject.must_equal([]) }
|
292
|
-
end
|
293
|
-
|
294
|
-
context 'when the line is not empty' do
|
295
|
-
let(:expected) {
|
296
|
-
[
|
297
|
-
Vedeu::Views::Char.new(value: 'S'),
|
298
|
-
Vedeu::Views::Char.new(value: 'o'),
|
299
|
-
Vedeu::Views::Char.new(value: 'm'),
|
300
|
-
Vedeu::Views::Char.new(value: 'e'),
|
301
|
-
Vedeu::Views::Char.new(value: ' '),
|
302
|
-
Vedeu::Views::Char.new(value: 't'),
|
303
|
-
Vedeu::Views::Char.new(value: 'e'),
|
304
|
-
Vedeu::Views::Char.new(value: 'x'),
|
305
|
-
Vedeu::Views::Char.new(value: 't'),
|
306
|
-
Vedeu::Views::Char.new(value: '.'),
|
307
|
-
Vedeu::Views::Char.new(value: '.'),
|
308
|
-
Vedeu::Views::Char.new(value: '.'),
|
309
|
-
]
|
310
|
-
}
|
311
|
-
it { subject.must_equal(expected) }
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|
315
285
|
describe '#to_s' do
|
316
286
|
subject { instance.to_s }
|
317
287
|
|
@@ -10,11 +10,6 @@ module Vedeu
|
|
10
10
|
let(:instance) { described.new(model) }
|
11
11
|
let(:model) { Vedeu::Geometry::Geometry.new }
|
12
12
|
|
13
|
-
describe '#initialize' do
|
14
|
-
it { instance.must_be_instance_of(described) }
|
15
|
-
it { instance.instance_variable_get('@model').must_equal(model) }
|
16
|
-
end
|
17
|
-
|
18
13
|
describe '.geometry' do
|
19
14
|
it { described.must_respond_to(:geometry) }
|
20
15
|
end
|
@@ -29,36 +29,6 @@ module Vedeu
|
|
29
29
|
it { instance.must_respond_to(:name) }
|
30
30
|
end
|
31
31
|
|
32
|
-
describe '#null?' do
|
33
|
-
subject { instance.null? }
|
34
|
-
|
35
|
-
it { subject.must_be_instance_of(TrueClass) }
|
36
|
-
end
|
37
|
-
|
38
|
-
describe '#centred' do
|
39
|
-
subject { instance.centred }
|
40
|
-
|
41
|
-
it { subject.must_equal(false) }
|
42
|
-
end
|
43
|
-
|
44
|
-
describe '#maximise' do
|
45
|
-
subject { instance.maximise }
|
46
|
-
|
47
|
-
it { subject.must_equal(false) }
|
48
|
-
end
|
49
|
-
|
50
|
-
describe '#store' do
|
51
|
-
subject { instance.store }
|
52
|
-
|
53
|
-
it { subject.must_be_instance_of(described) }
|
54
|
-
end
|
55
|
-
|
56
|
-
describe '#unmaximise' do
|
57
|
-
subject { instance.unmaximise }
|
58
|
-
|
59
|
-
it { subject.must_equal(false) }
|
60
|
-
end
|
61
|
-
|
62
32
|
describe '#height' do
|
63
33
|
before { Vedeu::Terminal.stubs(:size).returns([25, 40]) }
|
64
34
|
|
@@ -12,12 +12,6 @@ module Vedeu
|
|
12
12
|
let(:client) {}
|
13
13
|
let(:group_name) { 'main_screen' }
|
14
14
|
|
15
|
-
describe '#initialize' do
|
16
|
-
it { instance.must_be_instance_of(described) }
|
17
|
-
it { instance.instance_variable_get('@model').must_equal(model) }
|
18
|
-
it { instance.instance_variable_get('@client').must_equal(client) }
|
19
|
-
end
|
20
|
-
|
21
15
|
describe '.group' do
|
22
16
|
context 'when the block is given' do
|
23
17
|
subject {
|
@@ -41,20 +41,30 @@ module Vedeu
|
|
41
41
|
}
|
42
42
|
end
|
43
43
|
|
44
|
+
describe '.store' do
|
45
|
+
subject { described.store(attributes) }
|
46
|
+
|
47
|
+
it { subject.must_equal(instance) }
|
48
|
+
end
|
49
|
+
|
44
50
|
describe '#add' do
|
45
51
|
subject { instance.add('hydrogen') }
|
46
52
|
|
47
|
-
it { subject.must_be_instance_of(
|
53
|
+
it { subject.must_be_instance_of(described) }
|
48
54
|
|
49
55
|
context 'when the member already exists' do
|
56
|
+
let(:members) { ['hydrogen', 'carbon', 'nitrogen', 'oxygen'] }
|
57
|
+
|
50
58
|
it 'does not add the member again but returns a new Group' do
|
51
|
-
subject.
|
59
|
+
subject.members.must_equal(Set.new(members))
|
52
60
|
end
|
53
61
|
end
|
54
62
|
|
55
63
|
context 'when the member does not exist' do
|
64
|
+
let(:members) { ['carbon', 'nitrogen', 'oxygen'] }
|
65
|
+
|
56
66
|
it 'adds the member and returns a new Group' do
|
57
|
-
subject.
|
67
|
+
subject.members.must_include('hydrogen')
|
58
68
|
end
|
59
69
|
end
|
60
70
|
end
|
@@ -104,18 +114,16 @@ module Vedeu
|
|
104
114
|
context 'when the group is already empty' do
|
105
115
|
let(:members) { [] }
|
106
116
|
|
107
|
-
it { subject.
|
117
|
+
it { subject.members.must_equal(Set.new) }
|
108
118
|
end
|
109
119
|
|
110
120
|
context 'when the member exists' do
|
111
121
|
let(:member) { 'oxygen' }
|
112
122
|
|
113
|
-
it { subject.wont_equal(instance) }
|
114
123
|
it { subject.members.wont_include(member) }
|
115
124
|
end
|
116
125
|
|
117
126
|
context 'when the member does not exist' do
|
118
|
-
it { subject.wont_equal(instance) }
|
119
127
|
it { subject.members.wont_include(member) }
|
120
128
|
end
|
121
129
|
end
|
@@ -123,7 +131,7 @@ module Vedeu
|
|
123
131
|
describe '#reset' do
|
124
132
|
subject { instance.reset }
|
125
133
|
|
126
|
-
it { subject.must_be_instance_of(
|
134
|
+
it { subject.must_be_instance_of(described) }
|
127
135
|
it { subject.members.must_be_empty }
|
128
136
|
end
|
129
137
|
|
@@ -18,11 +18,6 @@ module Vedeu
|
|
18
18
|
let(:collection) { [:sodium, :magnesium, :aluminium, :silicon] }
|
19
19
|
let(:menu_name) { 'elements' }
|
20
20
|
|
21
|
-
describe '#initialize' do
|
22
|
-
it { instance.must_be_instance_of(described) }
|
23
|
-
it { instance.instance_variable_get('@model').must_equal(model) }
|
24
|
-
end
|
25
|
-
|
26
21
|
describe '#item' do
|
27
22
|
let(:_value) { :platinum }
|
28
23
|
|
@@ -23,6 +23,10 @@ module Vedeu
|
|
23
23
|
it { instance.instance_variable_get('@value').must_equal(_value) }
|
24
24
|
end
|
25
25
|
|
26
|
+
describe '#cell?' do
|
27
|
+
it { instance.cell?.must_equal(false) }
|
28
|
+
end
|
29
|
+
|
26
30
|
describe '#null' do
|
27
31
|
it { instance.null.must_equal(nil) }
|
28
32
|
it { instance.background.must_equal(nil) }
|
@@ -28,12 +28,24 @@ module Vedeu
|
|
28
28
|
}
|
29
29
|
end
|
30
30
|
|
31
|
+
describe '#falsy' do
|
32
|
+
subject { instance.falsy }
|
33
|
+
|
34
|
+
it { subject.must_be_instance_of(FalseClass) }
|
35
|
+
|
36
|
+
it { instance.must_respond_to(:centred) }
|
37
|
+
it { instance.must_respond_to(:maximise) }
|
38
|
+
it { instance.must_respond_to(:maximised?) }
|
39
|
+
it { instance.must_respond_to(:unmaximise) }
|
40
|
+
end
|
41
|
+
|
31
42
|
describe '#null' do
|
32
43
|
subject { instance.null }
|
33
44
|
|
34
45
|
it { subject.must_be_instance_of(NilClass) }
|
35
46
|
it { instance.must_respond_to(:add) }
|
36
47
|
it { instance.must_respond_to(:bottom_item) }
|
48
|
+
it { instance.must_respond_to(:clear) }
|
37
49
|
it { instance.must_respond_to(:colour) }
|
38
50
|
it { instance.must_respond_to(:current_item) }
|
39
51
|
it { instance.must_respond_to(:deselect_item) }
|
@@ -43,6 +55,7 @@ module Vedeu
|
|
43
55
|
it { instance.must_respond_to(:next_item) }
|
44
56
|
it { instance.must_respond_to(:parent) }
|
45
57
|
it { instance.must_respond_to(:prev_item) }
|
58
|
+
it { instance.must_respond_to(:render) }
|
46
59
|
it { instance.must_respond_to(:select_item) }
|
47
60
|
it { instance.must_respond_to(:selected_item) }
|
48
61
|
it { instance.must_respond_to(:show) }
|