vedeu 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/dsl.md +3 -3
- data/examples/borders_app.rb +2 -0
- data/examples/colours_app.rb +2 -0
- data/examples/configuration_app.rb +2 -0
- data/examples/drb_app.rb +2 -0
- data/examples/focus_app.rb +2 -0
- data/examples/hello_world.rb +2 -0
- data/examples/material_colours_app.rb +2 -0
- data/lib/vedeu.rb +2 -0
- data/lib/vedeu/all.rb +4 -13
- data/lib/vedeu/api.rb +7 -6
- data/lib/vedeu/borders/border.rb +1 -1
- data/lib/vedeu/borders/render_border.rb +18 -18
- data/lib/vedeu/buffers/buffer.rb +18 -28
- data/lib/vedeu/colours/colour.rb +1 -1
- data/lib/vedeu/colours/colour_translator.rb +1 -1
- data/lib/vedeu/cursor/cursor.rb +9 -6
- data/lib/vedeu/dsl/border.rb +1 -1
- data/lib/vedeu/dsl/composition.rb +5 -5
- data/lib/vedeu/dsl/geometry.rb +1 -1
- data/lib/vedeu/dsl/group.rb +1 -1
- data/lib/vedeu/dsl/interface.rb +69 -93
- data/lib/vedeu/dsl/keymap.rb +1 -1
- data/lib/vedeu/dsl/line.rb +11 -11
- data/lib/vedeu/dsl/shared.rb +81 -0
- data/lib/vedeu/dsl/stream.rb +3 -3
- data/lib/vedeu/dsl/view.rb +76 -64
- data/lib/vedeu/models/escape.rb +1 -1
- data/lib/vedeu/models/interface.rb +3 -57
- data/lib/vedeu/models/menu.rb +1 -1
- data/lib/vedeu/models/views/all.rb +22 -0
- data/lib/vedeu/models/views/char.rb +175 -0
- data/lib/vedeu/models/views/chars.rb +13 -0
- data/lib/vedeu/models/views/composition.rb +73 -0
- data/lib/vedeu/models/views/line.rb +111 -0
- data/lib/vedeu/models/views/lines.rb +13 -0
- data/lib/vedeu/models/views/stream.rb +122 -0
- data/lib/vedeu/models/views/streams.rb +13 -0
- data/lib/vedeu/models/views/view.rb +157 -0
- data/lib/vedeu/models/views/view_collection.rb +13 -0
- data/lib/vedeu/null/view.rb +67 -0
- data/lib/vedeu/output/clear/named_interface.rb +4 -4
- data/lib/vedeu/output/compressor.rb +6 -6
- data/lib/vedeu/output/html_char.rb +6 -6
- data/lib/vedeu/output/output.rb +3 -3
- data/lib/vedeu/output/presentation.rb +1 -1
- data/lib/vedeu/output/renderers/escape_sequence.rb +1 -1
- data/lib/vedeu/output/renderers/file.rb +1 -1
- data/lib/vedeu/output/renderers/html.rb +3 -3
- data/lib/vedeu/output/renderers/json.rb +4 -4
- data/lib/vedeu/output/renderers/null.rb +1 -1
- data/lib/vedeu/output/renderers/terminal.rb +5 -5
- data/lib/vedeu/output/renderers/text.rb +3 -3
- data/lib/vedeu/output/style.rb +1 -1
- data/lib/vedeu/output/text.rb +20 -15
- data/lib/vedeu/output/viewport.rb +16 -23
- data/lib/vedeu/output/virtual_buffer.rb +9 -8
- data/lib/vedeu/output/virtual_terminal.rb +11 -11
- data/lib/vedeu/output/wordwrap.rb +5 -5
- data/lib/vedeu/runtime/application.rb +1 -1
- data/lib/vedeu/runtime/main_loop.rb +1 -1
- data/lib/vedeu/templating/helpers.rb +11 -10
- data/lib/vedeu/templating/template.rb +1 -1
- data/lib/vedeu/templating/view_template.rb +6 -6
- data/lib/vedeu/version.rb +1 -2
- data/test/lib/vedeu/api_test.rb +30 -30
- data/test/lib/vedeu/buffers/buffer_test.rb +5 -139
- data/test/lib/vedeu/colours/colour_translator_test.rb +3 -3
- data/test/lib/vedeu/configuration/api_test.rb +3 -3
- data/test/lib/vedeu/cursor/refresh_cursor_test.rb +1 -1
- data/test/lib/vedeu/dsl/composition_test.rb +7 -7
- data/test/lib/vedeu/dsl/group_test.rb +2 -2
- data/test/lib/vedeu/dsl/interface_test.rb +31 -21
- data/test/lib/vedeu/dsl/keymap_test.rb +4 -4
- data/test/lib/vedeu/dsl/line_test.rb +8 -8
- data/test/lib/vedeu/dsl/stream_test.rb +4 -4
- data/test/lib/vedeu/dsl/text_test.rb +11 -11
- data/test/lib/vedeu/dsl/view_test.rb +24 -29
- data/test/lib/vedeu/geometry/grid_test.rb +4 -4
- data/test/lib/vedeu/input/key_test.rb +1 -1
- data/test/lib/vedeu/internal_api_test.rb +18 -18
- data/test/lib/vedeu/models/focus_test.rb +54 -54
- data/test/lib/vedeu/models/interface_test.rb +11 -105
- data/test/lib/vedeu/models/menu_test.rb +1 -1
- data/test/lib/vedeu/models/views/char_test.rb +257 -0
- data/test/lib/vedeu/models/views/chars_test.rb +22 -0
- data/test/lib/vedeu/models/views/composition_test.rb +61 -0
- data/test/lib/vedeu/models/views/line_test.rb +189 -0
- data/test/lib/vedeu/models/views/lines_test.rb +22 -0
- data/test/lib/vedeu/models/views/stream_test.rb +138 -0
- data/test/lib/vedeu/models/views/streams_test.rb +22 -0
- data/test/lib/vedeu/models/views/view_test.rb +40 -0
- data/test/lib/vedeu/null/view_test.rb +12 -0
- data/test/lib/vedeu/output/clear/named_interface_test.rb +4 -4
- data/test/lib/vedeu/output/compressor_test.rb +28 -28
- data/test/lib/vedeu/output/html_char_test.rb +2 -2
- data/test/lib/vedeu/output/presentation_test.rb +10 -14
- data/test/lib/vedeu/output/renderers/escape_sequence_test.rb +20 -4
- data/test/lib/vedeu/output/renderers/html_test.rb +4 -4
- data/test/lib/vedeu/output/renderers/json_test.rb +3 -3
- data/test/lib/vedeu/output/text_test.rb +10 -10
- data/test/lib/vedeu/output/viewport_test.rb +21 -23
- data/test/lib/vedeu/output/virtual_buffer_test.rb +1 -1
- data/test/lib/vedeu/output/virtual_terminal_test.rb +1 -1
- data/test/lib/vedeu/output/wordwrap_test.rb +9 -9
- data/test/lib/vedeu/repositories/repository_test.rb +2 -2
- data/test/lib/vedeu/templating/helpers_test.rb +6 -39
- data/test/lib/vedeu/templating/template_test.rb +2 -2
- data/test/lib/vedeu/templating/view_template_test.rb +91 -91
- data/test/lib/vedeu/terminal_test.rb +1 -1
- metadata +33 -27
- data/lib/vedeu/buffers/display_buffer.rb +0 -39
- data/lib/vedeu/models/char.rb +0 -170
- data/lib/vedeu/models/chars.rb +0 -9
- data/lib/vedeu/models/composition.rb +0 -66
- data/lib/vedeu/models/line.rb +0 -112
- data/lib/vedeu/models/lines.rb +0 -9
- data/lib/vedeu/models/stream.rb +0 -122
- data/lib/vedeu/models/streams.rb +0 -9
- data/test/lib/vedeu/buffers/display_buffer_test.rb +0 -61
- data/test/lib/vedeu/models/char_test.rb +0 -253
- data/test/lib/vedeu/models/chars_test.rb +0 -18
- data/test/lib/vedeu/models/composition_test.rb +0 -57
- data/test/lib/vedeu/models/line_test.rb +0 -189
- data/test/lib/vedeu/models/lines_test.rb +0 -18
- data/test/lib/vedeu/models/stream_test.rb +0 -141
- data/test/lib/vedeu/models/streams_test.rb +0 -18
@@ -199,19 +199,19 @@ module Vedeu
|
|
199
199
|
context 'when the value is invalid (nil)' do
|
200
200
|
it { proc {
|
201
201
|
Vedeu.configure { colour_mode(nil) }
|
202
|
-
}.must_raise(InvalidSyntax) }
|
202
|
+
}.must_raise(Vedeu::InvalidSyntax) }
|
203
203
|
end
|
204
204
|
|
205
205
|
context 'when the value is invalid (empty)' do
|
206
206
|
it { proc {
|
207
207
|
Vedeu.configure { colour_mode('') }
|
208
|
-
}.must_raise(InvalidSyntax) }
|
208
|
+
}.must_raise(Vedeu::InvalidSyntax) }
|
209
209
|
end
|
210
210
|
|
211
211
|
context 'when the value is invalid' do
|
212
212
|
it { proc {
|
213
213
|
Vedeu.configure { colour_mode(1234) }
|
214
|
-
}.must_raise(InvalidSyntax) }
|
214
|
+
}.must_raise(Vedeu::InvalidSyntax) }
|
215
215
|
end
|
216
216
|
|
217
217
|
it 'sets the option to the desired value' do
|
@@ -8,7 +8,7 @@ module Vedeu
|
|
8
8
|
|
9
9
|
let(:described) { Vedeu::DSL::Composition }
|
10
10
|
let(:instance) { described.new(model) }
|
11
|
-
let(:model) { Vedeu::Composition.new }
|
11
|
+
let(:model) { Vedeu::Views::Composition.new }
|
12
12
|
let(:client) {}
|
13
13
|
|
14
14
|
describe '#initialize' do
|
@@ -24,11 +24,11 @@ module Vedeu
|
|
24
24
|
end
|
25
25
|
}
|
26
26
|
|
27
|
-
it { subject.must_be_instance_of(Vedeu::
|
28
|
-
it { subject.first.must_be_instance_of(Vedeu::
|
27
|
+
it { subject.must_be_instance_of(Vedeu::Views::ViewCollection) }
|
28
|
+
it { subject.first.must_be_instance_of(Vedeu::Views::View) }
|
29
29
|
|
30
30
|
context 'when the block is not given' do
|
31
|
-
it { proc { instance.view }.must_raise(InvalidSyntax) }
|
31
|
+
it { proc { instance.view }.must_raise(Vedeu::InvalidSyntax) }
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -44,13 +44,13 @@ module Vedeu
|
|
44
44
|
context 'when the name of the view is not given' do
|
45
45
|
let(:filename) { 'my_interface.erb' }
|
46
46
|
|
47
|
-
it { proc { subject }.must_raise(MissingRequired) }
|
47
|
+
it { proc { subject }.must_raise(Vedeu::MissingRequired) }
|
48
48
|
end
|
49
49
|
|
50
50
|
context 'when the filename of the template is not given' do
|
51
51
|
let(:_name) { 'my_interface' }
|
52
52
|
|
53
|
-
it { proc { subject }.must_raise(MissingRequired) }
|
53
|
+
it { proc { subject }.must_raise(Vedeu::MissingRequired) }
|
54
54
|
end
|
55
55
|
|
56
56
|
context 'when the name and filename are given' do
|
@@ -62,7 +62,7 @@ module Vedeu
|
|
62
62
|
with(object, filename, options).returns(content)
|
63
63
|
}
|
64
64
|
|
65
|
-
it { subject.must_be_instance_of(Vedeu::
|
65
|
+
it { subject.must_be_instance_of(Vedeu::Views::ViewCollection) }
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -31,7 +31,7 @@ module Vedeu
|
|
31
31
|
context 'when the block is not given' do
|
32
32
|
subject { described.group(group_name) }
|
33
33
|
|
34
|
-
it { proc { subject }.must_raise(InvalidSyntax) }
|
34
|
+
it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -58,7 +58,7 @@ module Vedeu
|
|
58
58
|
end
|
59
59
|
}
|
60
60
|
|
61
|
-
it { proc { subject }.must_raise(MissingRequired) }
|
61
|
+
it { proc { subject }.must_raise(Vedeu::MissingRequired) }
|
62
62
|
end
|
63
63
|
|
64
64
|
context 'it adds interface names to the group' do
|
@@ -7,7 +7,7 @@ module Vedeu
|
|
7
7
|
describe Interface do
|
8
8
|
|
9
9
|
let(:described) { Vedeu::DSL::Interface }
|
10
|
-
let(:instance) { described.new(model) }
|
10
|
+
let(:instance) { described.new(model, client) }
|
11
11
|
let(:model) {
|
12
12
|
Vedeu::Interface.new(name: 'actinium')
|
13
13
|
}
|
@@ -19,13 +19,41 @@ module Vedeu
|
|
19
19
|
it { instance.instance_variable_get('@client').must_equal(client) }
|
20
20
|
end
|
21
21
|
|
22
|
+
describe '.interface' do
|
23
|
+
after { Vedeu.interfaces.reset }
|
24
|
+
|
25
|
+
subject {
|
26
|
+
described.interface('flourine') do
|
27
|
+
# ...
|
28
|
+
end
|
29
|
+
}
|
30
|
+
|
31
|
+
it { subject.must_be_instance_of(Vedeu::Interface) }
|
32
|
+
|
33
|
+
context 'when the block is not given' do
|
34
|
+
subject { described.interface('flourine') }
|
35
|
+
|
36
|
+
it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when the name is not given' do
|
40
|
+
subject {
|
41
|
+
described.interface('') do
|
42
|
+
# ...
|
43
|
+
end
|
44
|
+
}
|
45
|
+
|
46
|
+
it { proc { subject }.must_raise(Vedeu::MissingRequired) }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
22
50
|
describe '#border' do
|
23
51
|
after { Vedeu.borders.reset }
|
24
52
|
|
25
53
|
context 'when the block is not given' do
|
26
54
|
subject { instance.border }
|
27
55
|
|
28
|
-
it { proc { subject }.must_raise(InvalidSyntax) }
|
56
|
+
it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
|
29
57
|
end
|
30
58
|
|
31
59
|
context 'when the block is given' do
|
@@ -159,7 +187,7 @@ module Vedeu
|
|
159
187
|
context 'when the required block is not provided' do
|
160
188
|
subject { instance.geometry }
|
161
189
|
|
162
|
-
it { proc { subject }.must_raise(InvalidSyntax) }
|
190
|
+
it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
|
163
191
|
end
|
164
192
|
|
165
193
|
context 'when the block is given' do
|
@@ -230,24 +258,6 @@ module Vedeu
|
|
230
258
|
it { instance.must_respond_to(:keys) }
|
231
259
|
end
|
232
260
|
|
233
|
-
describe '#lines' do
|
234
|
-
subject {
|
235
|
-
instance.lines do
|
236
|
-
# ...
|
237
|
-
end
|
238
|
-
}
|
239
|
-
|
240
|
-
it { subject.must_be_instance_of(Vedeu::Lines) }
|
241
|
-
|
242
|
-
context 'when the required block is not provided' do
|
243
|
-
subject { instance.lines }
|
244
|
-
|
245
|
-
it { proc { subject }.must_raise(InvalidSyntax) }
|
246
|
-
end
|
247
|
-
|
248
|
-
it { instance.must_respond_to(:line) }
|
249
|
-
end
|
250
|
-
|
251
261
|
describe '#name' do
|
252
262
|
subject { instance.name('nickel') }
|
253
263
|
|
@@ -23,25 +23,25 @@ module Vedeu
|
|
23
23
|
context 'when a block was not given' do
|
24
24
|
subject { instance.key(value_or_values) }
|
25
25
|
|
26
|
-
it { proc { subject }.must_raise(InvalidSyntax) }
|
26
|
+
it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
|
27
27
|
end
|
28
28
|
|
29
29
|
context 'when a key was not given' do
|
30
30
|
let(:value_or_values) {}
|
31
31
|
|
32
|
-
it { proc { subject }.must_raise(InvalidSyntax) }
|
32
|
+
it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
|
33
33
|
end
|
34
34
|
|
35
35
|
context 'when an invalid key was given (nil)' do
|
36
36
|
let(:value_or_values) { ['v', nil] }
|
37
37
|
|
38
|
-
it { proc { subject }.must_raise(InvalidSyntax) }
|
38
|
+
it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
|
39
39
|
end
|
40
40
|
|
41
41
|
context 'when an invalid key was given (empty)' do
|
42
42
|
let(:value_or_values) { ['v', ''] }
|
43
43
|
|
44
|
-
it { proc { subject }.must_raise(InvalidSyntax) }
|
44
|
+
it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
|
45
45
|
end
|
46
46
|
|
47
47
|
context 'when the key is valid (not already defined)' do
|
@@ -8,7 +8,7 @@ module Vedeu
|
|
8
8
|
|
9
9
|
let(:described) { Vedeu::DSL::Line }
|
10
10
|
let(:instance) { described.new(model) }
|
11
|
-
let(:model) { Vedeu::Line.new(attributes) }
|
11
|
+
let(:model) { Vedeu::Views::Line.new(attributes) }
|
12
12
|
let(:attributes){
|
13
13
|
{
|
14
14
|
streams: streams,
|
@@ -19,7 +19,7 @@ module Vedeu
|
|
19
19
|
}
|
20
20
|
let(:client) {}
|
21
21
|
let(:streams) { [] }
|
22
|
-
let(:parent) { Vedeu::
|
22
|
+
let(:parent) { Vedeu::Views::View.new }
|
23
23
|
let(:colour) { Vedeu::Colour.new }
|
24
24
|
let(:style) { Vedeu::Style.new }
|
25
25
|
|
@@ -38,8 +38,8 @@ module Vedeu
|
|
38
38
|
end
|
39
39
|
}
|
40
40
|
|
41
|
-
it { subject.must_be_instance_of(Vedeu::Lines) }
|
42
|
-
it { subject.first.must_be_instance_of(Vedeu::Line) }
|
41
|
+
it { subject.must_be_instance_of(Vedeu::Views::Lines) }
|
42
|
+
it { subject.first.must_be_instance_of(Vedeu::Views::Line) }
|
43
43
|
|
44
44
|
context 'when the block is given' do
|
45
45
|
end
|
@@ -54,7 +54,7 @@ module Vedeu
|
|
54
54
|
|
55
55
|
subject { instance.line(_value) }
|
56
56
|
|
57
|
-
it { proc { subject }.must_raise(InvalidSyntax) }
|
57
|
+
it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
@@ -67,12 +67,12 @@ module Vedeu
|
|
67
67
|
end
|
68
68
|
}
|
69
69
|
|
70
|
-
it { subject.must_be_instance_of(Vedeu::Streams) }
|
71
|
-
it { subject.first.must_be_instance_of(Vedeu::Stream) }
|
70
|
+
it { subject.must_be_instance_of(Vedeu::Views::Streams) }
|
71
|
+
it { subject.first.must_be_instance_of(Vedeu::Views::Stream) }
|
72
72
|
end
|
73
73
|
|
74
74
|
context 'when the block is not given' do
|
75
|
-
it { proc { instance.streams }.must_raise(InvalidSyntax) }
|
75
|
+
it { proc { instance.streams }.must_raise(Vedeu::InvalidSyntax) }
|
76
76
|
end
|
77
77
|
|
78
78
|
it { instance.must_respond_to(:stream) }
|
@@ -8,9 +8,9 @@ module Vedeu
|
|
8
8
|
|
9
9
|
let(:described) { Vedeu::DSL::Stream }
|
10
10
|
let(:instance) { described.new(model) }
|
11
|
-
let(:model) { Vedeu::Stream.new(parent: parent) }
|
11
|
+
let(:model) { Vedeu::Views::Stream.new(parent: parent) }
|
12
12
|
let(:client) {}
|
13
|
-
let(:parent) { Vedeu::Line.new }
|
13
|
+
let(:parent) { Vedeu::Views::Line.new }
|
14
14
|
|
15
15
|
describe '#initialize' do
|
16
16
|
it { instance.must_be_instance_of(described) }
|
@@ -21,12 +21,12 @@ module Vedeu
|
|
21
21
|
describe '#stream' do
|
22
22
|
subject { instance.stream { } }
|
23
23
|
|
24
|
-
it { subject.must_be_instance_of(Vedeu::Streams) }
|
24
|
+
it { subject.must_be_instance_of(Vedeu::Views::Streams) }
|
25
25
|
|
26
26
|
context 'when the block is not given' do
|
27
27
|
subject { instance.stream }
|
28
28
|
|
29
|
-
it { proc { subject }.must_raise(InvalidSyntax) }
|
29
|
+
it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -16,16 +16,16 @@ module Vedeu
|
|
16
16
|
}
|
17
17
|
}
|
18
18
|
let(:anchor) { :text }
|
19
|
-
let(:model) { Vedeu::Line.new }
|
19
|
+
let(:model) { Vedeu::Views::Line.new }
|
20
20
|
let(:instance) { Vedeu::DSL::Line.new(model) }
|
21
21
|
|
22
22
|
subject { instance.text(_value, options) }
|
23
23
|
|
24
|
-
context 'when the model is a Vedeu::
|
25
|
-
let(:model) { Vedeu::
|
24
|
+
context 'when the model is a Vedeu::Views::View' do
|
25
|
+
let(:model) { Vedeu::Views::View.new }
|
26
26
|
let(:instance) { Vedeu::DSL::Interface.new(model) }
|
27
27
|
|
28
|
-
it { subject.must_be_instance_of(Vedeu::Lines) }
|
28
|
+
it { subject.must_be_instance_of(Vedeu::Views::Lines) }
|
29
29
|
|
30
30
|
it 'adds the text to the model' do
|
31
31
|
Vedeu::Text.expects(:add).with(_value, modified_options)
|
@@ -33,11 +33,11 @@ module Vedeu
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
context 'when the model is a Vedeu::Line' do
|
37
|
-
let(:model) { Vedeu::Line.new }
|
36
|
+
context 'when the model is a Vedeu::Views::Line' do
|
37
|
+
let(:model) { Vedeu::Views::Line.new }
|
38
38
|
let(:instance) { Vedeu::DSL::Line.new(model) }
|
39
39
|
|
40
|
-
it { subject.must_be_instance_of(Vedeu::Streams) }
|
40
|
+
it { subject.must_be_instance_of(Vedeu::Views::Streams) }
|
41
41
|
|
42
42
|
it 'adds the text to the model' do
|
43
43
|
Vedeu::Text.expects(:add).with(_value, modified_options)
|
@@ -45,12 +45,12 @@ module Vedeu
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
context 'when the model is a Vedeu::Stream' do
|
49
|
-
let(:parent) { Vedeu::Line.new }
|
50
|
-
let(:model) { Vedeu::Stream.new(parent: parent) }
|
48
|
+
context 'when the model is a Vedeu::Views::Stream' do
|
49
|
+
let(:parent) { Vedeu::Views::Line.new }
|
50
|
+
let(:model) { Vedeu::Views::Stream.new(parent: parent) }
|
51
51
|
let(:instance) { Vedeu::DSL::Stream.new(model) }
|
52
52
|
|
53
|
-
it { subject.must_be_instance_of(Vedeu::Streams) }
|
53
|
+
it { subject.must_be_instance_of(Vedeu::Views::Streams) }
|
54
54
|
|
55
55
|
it 'adds the text to the model' do
|
56
56
|
Vedeu::Text.expects(:add).with(_value, modified_options)
|
@@ -7,49 +7,46 @@ module Vedeu
|
|
7
7
|
describe View do
|
8
8
|
|
9
9
|
let(:described) { Vedeu::DSL::View }
|
10
|
+
let(:instance) { described.new(model, client) }
|
11
|
+
let(:model) {
|
12
|
+
Vedeu::Views::View.new(name: 'actinium')
|
13
|
+
}
|
14
|
+
let(:client) {}
|
10
15
|
|
11
|
-
describe '.
|
12
|
-
after { Vedeu.interfaces.reset }
|
13
|
-
|
16
|
+
describe '.renders' do
|
14
17
|
subject {
|
15
|
-
described.
|
18
|
+
described.renders do
|
16
19
|
# ...
|
17
20
|
end
|
18
21
|
}
|
19
22
|
|
20
|
-
it {
|
23
|
+
it { described.must_respond_to(:render) }
|
24
|
+
it { subject.must_be_instance_of(Array) }
|
21
25
|
|
22
26
|
context 'when the block is not given' do
|
23
|
-
subject { described.
|
27
|
+
subject { described.renders }
|
24
28
|
|
25
|
-
it { proc { subject }.must_raise(InvalidSyntax) }
|
29
|
+
it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
|
26
30
|
end
|
27
31
|
|
28
|
-
context 'when the
|
29
|
-
subject
|
30
|
-
described.interface('') do
|
31
|
-
# ...
|
32
|
-
end
|
33
|
-
}
|
34
|
-
|
35
|
-
it { proc { subject }.must_raise(MissingRequired) }
|
32
|
+
context 'when the block is given' do
|
33
|
+
it { subject.must_equal([]) }
|
36
34
|
end
|
37
35
|
end
|
38
36
|
|
39
|
-
describe '.
|
37
|
+
describe '.views' do
|
40
38
|
subject {
|
41
|
-
described.
|
39
|
+
described.views do
|
42
40
|
# ...
|
43
41
|
end
|
44
42
|
}
|
45
43
|
|
46
|
-
it { described.must_respond_to(:render) }
|
47
44
|
it { subject.must_be_instance_of(Array) }
|
48
45
|
|
49
46
|
context 'when the block is not given' do
|
50
|
-
subject { described.
|
47
|
+
subject { described.views }
|
51
48
|
|
52
|
-
it { proc { subject }.must_raise(InvalidSyntax) }
|
49
|
+
it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
|
53
50
|
end
|
54
51
|
|
55
52
|
context 'when the block is given' do
|
@@ -57,24 +54,22 @@ module Vedeu
|
|
57
54
|
end
|
58
55
|
end
|
59
56
|
|
60
|
-
describe '
|
57
|
+
describe '#lines' do
|
61
58
|
subject {
|
62
|
-
|
59
|
+
instance.lines do
|
63
60
|
# ...
|
64
61
|
end
|
65
62
|
}
|
66
63
|
|
67
|
-
it { subject.must_be_instance_of(
|
64
|
+
it { subject.must_be_instance_of(Vedeu::Views::Lines) }
|
68
65
|
|
69
|
-
context 'when the block is not
|
70
|
-
subject {
|
66
|
+
context 'when the required block is not provided' do
|
67
|
+
subject { instance.lines }
|
71
68
|
|
72
|
-
it { proc { subject }.must_raise(InvalidSyntax) }
|
69
|
+
it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
|
73
70
|
end
|
74
71
|
|
75
|
-
|
76
|
-
it { subject.must_equal([]) }
|
77
|
-
end
|
72
|
+
it { instance.must_respond_to(:line) }
|
78
73
|
end
|
79
74
|
|
80
75
|
end # View
|
@@ -17,11 +17,11 @@ module Vedeu
|
|
17
17
|
|
18
18
|
describe '.columns' do
|
19
19
|
context 'when the value is less than 1' do
|
20
|
-
it { proc { Grid.columns(0) }.must_raise(OutOfRange) }
|
20
|
+
it { proc { Grid.columns(0) }.must_raise(Vedeu::OutOfRange) }
|
21
21
|
end
|
22
22
|
|
23
23
|
context 'when the value is greater than 12' do
|
24
|
-
it { proc { Grid.columns(13) }.must_raise(OutOfRange) }
|
24
|
+
it { proc { Grid.columns(13) }.must_raise(Vedeu::OutOfRange) }
|
25
25
|
end
|
26
26
|
|
27
27
|
context 'when the value is in range' do
|
@@ -33,11 +33,11 @@ module Vedeu
|
|
33
33
|
|
34
34
|
describe '.rows' do
|
35
35
|
context 'when the value is less than 1' do
|
36
|
-
it { proc { Grid.rows(0) }.must_raise(OutOfRange) }
|
36
|
+
it { proc { Grid.rows(0) }.must_raise(Vedeu::OutOfRange) }
|
37
37
|
end
|
38
38
|
|
39
39
|
context 'when the value is greater than 12' do
|
40
|
-
it { proc { Grid.rows(13) }.must_raise(OutOfRange) }
|
40
|
+
it { proc { Grid.rows(13) }.must_raise(Vedeu::OutOfRange) }
|
41
41
|
end
|
42
42
|
|
43
43
|
context 'when the value is in range' do
|