vedeu 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/TODO.md +4 -0
- data/docs/dsl.md +1 -11
- data/docs/dsl/by_method/geometry/align.md +1 -0
- data/docs/dsl/by_method/geometry/align_bottom.md +40 -0
- data/docs/dsl/by_method/geometry/align_centre.md +40 -0
- data/docs/dsl/by_method/geometry/align_left.md +40 -0
- data/docs/dsl/by_method/geometry/align_middle.md +40 -0
- data/docs/dsl/by_method/geometry/align_right.md +40 -0
- data/docs/dsl/by_method/geometry/align_top.md +40 -0
- data/docs/dsl/by_method/geometry/columns.md +1 -0
- data/docs/dsl/by_method/geometry/height.md +0 -0
- data/docs/dsl/by_method/geometry/horizontal_alignment.md +1 -0
- data/docs/dsl/by_method/geometry/rows.md +1 -0
- data/docs/dsl/by_method/geometry/vertical_alignment.md +1 -0
- data/docs/dsl/by_method/geometry/width.md +0 -0
- data/docs/dsl/by_method/geometry/x.md +1 -0
- data/docs/dsl/by_method/geometry/xn.md +1 -0
- data/docs/dsl/by_method/geometry/y.md +1 -0
- data/docs/dsl/by_method/geometry/yn.md +1 -0
- data/docs/dsl/by_method/render.md +5 -1
- data/docs/dsl/by_method/renders.md +31 -1
- data/docs/dsl/by_method/view.md +26 -0
- data/docs/dsl/by_method/view/stream.md +18 -0
- data/docs/dsl/by_method/views.md +32 -1
- data/docs/events/by_name/set_border_caption.md +2 -4
- data/docs/events/by_name/set_border_title.md +2 -4
- data/examples/views/empty_template.rb +0 -4
- data/examples/views/full_screen.rb +30 -5
- data/examples/views/misc_view.rb +464 -0
- data/examples/views/wordwrap.rb +72 -0
- data/examples/views/wordwrap.txt +8 -0
- data/integrations/dsl_app_021.rb +127 -0
- data/integrations/dsl_app_022.rb +133 -0
- data/integrations/expected/342_streams.out +1 -1
- data/integrations/expected/dsl_app_001.out +1 -1
- data/integrations/expected/dsl_app_002.out +1 -1
- data/integrations/expected/dsl_app_003.out +1 -1
- data/integrations/expected/dsl_app_004.out +1 -1
- data/integrations/expected/dsl_app_005.out +1 -1
- data/integrations/expected/dsl_app_006.out +1 -1
- data/integrations/expected/dsl_app_007.out +1 -1
- data/integrations/expected/dsl_app_008.out +1 -1
- data/integrations/expected/dsl_app_009.out +1 -1
- data/integrations/expected/dsl_app_010.out +1 -1
- data/integrations/expected/dsl_app_011.out +1 -1
- data/integrations/expected/dsl_app_012.out +1 -1
- data/integrations/expected/dsl_app_013.out +1 -1
- data/integrations/expected/dsl_app_014.out +1 -1
- data/integrations/expected/dsl_app_015.out +1 -1
- data/integrations/expected/dsl_app_016.out +1 -1
- data/integrations/expected/dsl_app_021.out +1 -0
- data/integrations/expected/dsl_app_022.out +1 -0
- data/integrations/support/test_interface_021.rb +7 -0
- data/integrations/support/test_interface_022.rb +15 -0
- data/lib/vedeu/all.rb +4 -2
- data/lib/vedeu/borders/border.rb +22 -6
- data/lib/vedeu/borders/repository.rb +4 -8
- data/lib/vedeu/buffers/buffer.rb +9 -6
- data/lib/vedeu/buffers/empty.rb +26 -23
- data/lib/vedeu/buffers/view.rb +44 -41
- data/lib/vedeu/cells/cursor.rb +0 -2
- data/lib/vedeu/cells/empty.rb +0 -1
- data/lib/vedeu/cells/escape.rb +0 -2
- data/lib/vedeu/coercers/alignment.rb +58 -8
- data/lib/vedeu/coercers/horizontal_alignment.rb +13 -9
- data/lib/vedeu/coercers/vertical_alignment.rb +13 -8
- data/lib/vedeu/common.rb +1 -1
- data/lib/vedeu/configuration/configuration.rb +41 -3
- data/lib/vedeu/cursors/coordinate.rb +1 -3
- data/lib/vedeu/cursors/cursor.rb +2 -6
- data/lib/vedeu/dsl/all.rb +1 -2
- data/lib/vedeu/dsl/border.rb +6 -6
- data/lib/vedeu/dsl/elements.rb +2 -2
- data/lib/vedeu/dsl/geometry.rb +7 -7
- data/lib/vedeu/dsl/{string → helpers}/align.rb +0 -0
- data/lib/vedeu/dsl/helpers/all.rb +17 -0
- data/lib/vedeu/dsl/{attributes.rb → helpers/attributes.rb} +0 -0
- data/lib/vedeu/dsl/{string → helpers}/text.rb +0 -0
- data/lib/vedeu/dsl/{string → helpers}/truncate.rb +0 -0
- data/lib/vedeu/dsl/{string → helpers}/wordwrap.rb +0 -0
- data/lib/vedeu/dsl/view.rb +11 -19
- data/lib/vedeu/dsl/views.rb +16 -106
- data/lib/vedeu/geometries/all.rb +0 -1
- data/lib/vedeu/geometries/area/area.rb +6 -12
- data/lib/vedeu/geometries/area/dimension.rb +21 -44
- data/lib/vedeu/geometries/dsl/all.rb +0 -1
- data/lib/vedeu/geometries/dsl/dsl.rb +22 -31
- data/lib/vedeu/geometries/geometry.rb +6 -0
- data/lib/vedeu/geometries/position.rb +6 -3
- data/lib/vedeu/geometries/repository.rb +1 -1
- data/lib/vedeu/input/mouse.rb +1 -0
- data/lib/vedeu/logging/log.rb +3 -6
- data/lib/vedeu/menus/dsl.rb +4 -5
- data/lib/vedeu/output/compressor.rb +11 -1
- data/lib/vedeu/output/viewport.rb +59 -59
- data/lib/vedeu/presentation/all.rb +1 -2
- data/lib/vedeu/presentation/colour.rb +75 -3
- data/lib/vedeu/{geometries/positionable.rb → presentation/position.rb} +4 -4
- data/lib/vedeu/presentation/presentation.rb +1 -3
- data/lib/vedeu/presentation/styles.rb +16 -1
- data/lib/vedeu/repositories/all.rb +0 -1
- data/lib/vedeu/sentence.rb +91 -0
- data/lib/vedeu/support/point.rb +72 -0
- data/lib/vedeu/terminal/terminal.rb +11 -53
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/composition.rb +11 -1
- data/lib/vedeu/views/default_attributes.rb +2 -0
- data/lib/vedeu/views/line.rb +16 -1
- data/lib/vedeu/views/stream.rb +16 -1
- data/lib/vedeu/views/view.rb +25 -17
- data/test/lib/vedeu/borders/border_test.rb +20 -2
- data/test/lib/vedeu/buffers/buffer_test.rb +15 -2
- data/test/lib/vedeu/buffers/empty_test.rb +51 -18
- data/test/lib/vedeu/buffers/view_test.rb +2 -2
- data/test/lib/vedeu/coercers/alignment_test.rb +32 -0
- data/test/lib/vedeu/coercers/horizontal_alignment_test.rb +16 -0
- data/test/lib/vedeu/coercers/vertical_alignment_test.rb +16 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
- data/test/lib/vedeu/cursors/dsl_test.rb +35 -21
- data/test/lib/vedeu/dsl/elements_test.rb +94 -2
- data/test/lib/vedeu/dsl/{string → helpers}/align_test.rb +0 -0
- data/test/lib/vedeu/dsl/{attributes_test.rb → helpers/attributes_test.rb} +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/text_test.rb +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/truncate_test.rb +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/wordwrap_test.rb +0 -0
- data/test/lib/vedeu/dsl/view_test.rb +22 -4
- data/test/lib/vedeu/dsl/views_test.rb +8 -5
- data/test/lib/vedeu/geometries/dsl/dsl_test.rb +2 -159
- data/test/lib/vedeu/geometries/position_test.rb +118 -60
- data/test/lib/vedeu/input/mouse_test.rb +1 -6
- data/test/lib/vedeu/logging/log_test.rb +14 -3
- data/test/lib/vedeu/presentation/colour_test.rb +77 -0
- data/test/lib/vedeu/{geometries/positionable_test.rb → presentation/position_test.rb} +4 -4
- data/test/lib/vedeu/sentence_test.rb +49 -0
- data/test/lib/vedeu/support/point_test.rb +139 -0
- data/test/lib/vedeu/terminal/terminal_test.rb +3 -44
- data/test/lib/vedeu/views/composition_test.rb +24 -4
- data/test/lib/vedeu/views/default_attributes_test.rb +10 -2
- data/test/lib/vedeu/views/view_test.rb +8 -15
- data/test/support/examples/material_colours_app.rb +0 -6
- data/vedeu.gemspec +1 -1
- metadata +58 -38
- data/examples/views/lines_line_stream.rb +0 -95
- data/examples/views/lines_line_streams.rb +0 -75
- data/examples/views/lines_line_streams_stream.rb +0 -78
- data/examples/views/lines_line_streams_stream_stream.rb +0 -50
- data/examples/views/lines_streams.rb +0 -93
- data/lib/vedeu/dsl/string/all.rb +0 -16
- data/lib/vedeu/geometries/dsl/validator.rb +0 -62
- data/lib/vedeu/presentation/background.rb +0 -54
- data/lib/vedeu/presentation/foreground.rb +0 -54
- data/lib/vedeu/repositories/parent.rb +0 -34
- data/test/lib/vedeu/geometries/dsl/validator_test.rb +0 -85
- data/test/lib/vedeu/presentation/background_test.rb +0 -74
- data/test/lib/vedeu/presentation/foreground_test.rb +0 -75
@@ -10,7 +10,7 @@ module Vedeu
|
|
10
10
|
|
11
11
|
let(:described) { Vedeu::Buffers::View }
|
12
12
|
let(:instance) { described.new(attributes) }
|
13
|
-
let(:_name) {
|
13
|
+
let(:_name) { :vedeu_buffers_view }
|
14
14
|
let(:attributes) {
|
15
15
|
{
|
16
16
|
name: _name,
|
@@ -27,7 +27,7 @@ module Vedeu
|
|
27
27
|
context 'when a name is not given' do
|
28
28
|
let(:_name) {}
|
29
29
|
|
30
|
-
it { instance.instance_variable_get('@name').must_equal(
|
30
|
+
it { instance.instance_variable_get('@name').must_equal(nil) }
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -166,6 +166,38 @@ module Vedeu
|
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
169
|
+
describe '#valid_horizontal?' do
|
170
|
+
subject { instance.valid_horizontal? }
|
171
|
+
|
172
|
+
context 'when the value is valid' do
|
173
|
+
let(:_value) { :left }
|
174
|
+
|
175
|
+
it { subject.must_equal(true) }
|
176
|
+
end
|
177
|
+
|
178
|
+
context 'when the value is not valid' do
|
179
|
+
let(:_value) { :top }
|
180
|
+
|
181
|
+
it { subject.must_equal(false) }
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
describe '#valid_vertical?' do
|
186
|
+
subject { instance.valid_vertical? }
|
187
|
+
|
188
|
+
context 'when the value is valid' do
|
189
|
+
let(:_value) { :top }
|
190
|
+
|
191
|
+
it { subject.must_equal(true) }
|
192
|
+
end
|
193
|
+
|
194
|
+
context 'when the value is not valid' do
|
195
|
+
let(:_value) { :left }
|
196
|
+
|
197
|
+
it { subject.must_equal(false) }
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
169
201
|
describe '#value' do
|
170
202
|
subject { instance.value }
|
171
203
|
|
@@ -12,6 +12,22 @@ module Vedeu
|
|
12
12
|
let(:instance) { described.new(_value) }
|
13
13
|
let(:_value) {}
|
14
14
|
|
15
|
+
describe '#validate' do
|
16
|
+
subject { instance.validate }
|
17
|
+
|
18
|
+
context 'when the value is valid' do
|
19
|
+
let(:_value) { :none }
|
20
|
+
|
21
|
+
it { subject.must_equal(instance) }
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when the value is not valid' do
|
25
|
+
let(:_value) { :top }
|
26
|
+
|
27
|
+
it { proc { subject }.must_raise(Vedeu::Error::InvalidSyntax) }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
15
31
|
describe '#value' do
|
16
32
|
subject { described.coerce(_value).value }
|
17
33
|
|
@@ -12,6 +12,22 @@ module Vedeu
|
|
12
12
|
let(:instance) { described.new(_value) }
|
13
13
|
let(:_value) {}
|
14
14
|
|
15
|
+
describe '#validate' do
|
16
|
+
subject { instance.validate }
|
17
|
+
|
18
|
+
context 'when the value is valid' do
|
19
|
+
let(:_value) { :none }
|
20
|
+
|
21
|
+
it { subject.must_equal(instance) }
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when the value is not valid' do
|
25
|
+
let(:_value) { :left }
|
26
|
+
|
27
|
+
it { proc { subject }.must_raise(Vedeu::Error::InvalidSyntax) }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
15
31
|
describe '#value' do
|
16
32
|
subject { described.coerce(_value).value }
|
17
33
|
|
@@ -336,7 +336,7 @@ module Vedeu
|
|
336
336
|
describe '#x' do
|
337
337
|
subject { instance.x }
|
338
338
|
|
339
|
-
context 'when x is less than
|
339
|
+
context 'when x is less than 1' do
|
340
340
|
let(:x) { -2 }
|
341
341
|
|
342
342
|
it { subject.must_equal(6) }
|
@@ -360,7 +360,7 @@ module Vedeu
|
|
360
360
|
end
|
361
361
|
end
|
362
362
|
|
363
|
-
context 'when x is more than
|
363
|
+
context 'when x is more than the terminal width' do
|
364
364
|
let(:x) { 47 }
|
365
365
|
|
366
366
|
it { subject.must_equal(34) }
|
@@ -388,7 +388,7 @@ module Vedeu
|
|
388
388
|
describe '#y' do
|
389
389
|
subject { instance.y }
|
390
390
|
|
391
|
-
context 'when y is less than
|
391
|
+
context 'when y is less than 1' do
|
392
392
|
let(:y) { -2 }
|
393
393
|
|
394
394
|
it { subject.must_equal(6) }
|
@@ -412,7 +412,7 @@ module Vedeu
|
|
412
412
|
end
|
413
413
|
end
|
414
414
|
|
415
|
-
context 'when y is more than
|
415
|
+
context 'when y is more than the terminal height' do
|
416
416
|
let(:y) { 17 }
|
417
417
|
|
418
418
|
it { subject.must_equal(9) }
|
@@ -10,6 +10,16 @@ module Vedeu
|
|
10
10
|
|
11
11
|
include Vedeu::Cursors::DSL
|
12
12
|
|
13
|
+
attr_accessor :cursor_visible
|
14
|
+
|
15
|
+
def model
|
16
|
+
self
|
17
|
+
end
|
18
|
+
|
19
|
+
def name
|
20
|
+
:actinium
|
21
|
+
end
|
22
|
+
|
13
23
|
end # DSLTestClass
|
14
24
|
|
15
25
|
describe DSL do
|
@@ -39,14 +49,18 @@ module Vedeu
|
|
39
49
|
|
40
50
|
# describe '#cursor' do
|
41
51
|
# let(:_value) {}
|
52
|
+
# let(:cursor) { Vedeu::Cursors::Cursor.new(name: :actinium) }
|
42
53
|
|
43
|
-
# before
|
54
|
+
# before do
|
55
|
+
# Vedeu.cursors.reset!
|
56
|
+
# Vedeu.cursors.stubs(:by_name).returns(cursor)
|
57
|
+
# end
|
44
58
|
|
45
59
|
# subject { instance.cursor(_value) }
|
46
60
|
|
47
61
|
# it do
|
48
62
|
# subject
|
49
|
-
# Vedeu.cursors.
|
63
|
+
# Vedeu.cursors.by_name(:actinium).visible?.must_equal(false)
|
50
64
|
# end
|
51
65
|
|
52
66
|
# context 'when the value is false' do
|
@@ -54,7 +68,7 @@ module Vedeu
|
|
54
68
|
|
55
69
|
# it do
|
56
70
|
# subject
|
57
|
-
# Vedeu.cursors.
|
71
|
+
# Vedeu.cursors.by_name(:actinium).visible?.must_equal(false)
|
58
72
|
# end
|
59
73
|
# end
|
60
74
|
|
@@ -63,7 +77,7 @@ module Vedeu
|
|
63
77
|
|
64
78
|
# it do
|
65
79
|
# subject
|
66
|
-
# Vedeu.cursors.
|
80
|
+
# Vedeu.cursors.by_name(:actinium).visible?.must_equal(false)
|
67
81
|
# end
|
68
82
|
# end
|
69
83
|
|
@@ -72,7 +86,7 @@ module Vedeu
|
|
72
86
|
|
73
87
|
# it do
|
74
88
|
# subject
|
75
|
-
# Vedeu.cursors.
|
89
|
+
# Vedeu.cursors.by_name(:actinium).visible?.must_equal(true)
|
76
90
|
# end
|
77
91
|
# end
|
78
92
|
|
@@ -81,7 +95,7 @@ module Vedeu
|
|
81
95
|
|
82
96
|
# it do
|
83
97
|
# subject
|
84
|
-
# Vedeu.cursors.
|
98
|
+
# Vedeu.cursors.by_name(:actinium).visible?.must_equal(true)
|
85
99
|
# end
|
86
100
|
# end
|
87
101
|
|
@@ -90,28 +104,28 @@ module Vedeu
|
|
90
104
|
|
91
105
|
# it do
|
92
106
|
# subject
|
93
|
-
# Vedeu.cursors.
|
107
|
+
# Vedeu.cursors.by_name(:actinium).visible?.must_equal(true)
|
94
108
|
# end
|
95
109
|
# end
|
96
110
|
# end
|
97
111
|
|
98
|
-
|
99
|
-
|
112
|
+
describe '#cursor!' do
|
113
|
+
subject { instance.cursor! }
|
100
114
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
115
|
+
it do
|
116
|
+
subject
|
117
|
+
Vedeu.cursors.by_name(:actinium).visible?.must_equal(true)
|
118
|
+
end
|
119
|
+
end
|
106
120
|
|
107
|
-
|
108
|
-
|
121
|
+
describe '#no_cursor!' do
|
122
|
+
subject { instance.no_cursor! }
|
109
123
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
124
|
+
it do
|
125
|
+
subject
|
126
|
+
Vedeu.cursors.by_name(:actinium).visible?.must_equal(false)
|
127
|
+
end
|
128
|
+
end
|
115
129
|
|
116
130
|
end # DSL
|
117
131
|
|
@@ -27,8 +27,68 @@ module Vedeu
|
|
27
27
|
let(:including_instance) { including_described.new(model) }
|
28
28
|
let(:model) {}
|
29
29
|
|
30
|
+
describe '#centre' do
|
31
|
+
let(:_value) {}
|
32
|
+
let(:opts) {
|
33
|
+
{
|
34
|
+
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
subject { including_instance.centre(_value, opts) }
|
39
|
+
|
40
|
+
context 'when a model exists' do
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'when a model does not exist' do
|
44
|
+
it { proc { subject }.must_raise(Vedeu::Error::Fatal) }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#center' do
|
49
|
+
it { including_instance.must_respond_to(:center) }
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#left' do
|
53
|
+
let(:_value) {}
|
54
|
+
let(:opts) {
|
55
|
+
{
|
56
|
+
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
subject { including_instance.left(_value, opts) }
|
61
|
+
|
62
|
+
context 'when a model exists' do
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'when a model does not exist' do
|
66
|
+
it { proc { subject }.must_raise(Vedeu::Error::Fatal) }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe '#right' do
|
71
|
+
let(:_value) {}
|
72
|
+
let(:opts) {
|
73
|
+
{
|
74
|
+
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
subject { including_instance.right(_value, opts) }
|
79
|
+
|
80
|
+
context 'when a model exists' do
|
81
|
+
end
|
82
|
+
|
83
|
+
context 'when a model does not exist' do
|
84
|
+
it { proc { subject }.must_raise(Vedeu::Error::Fatal) }
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
30
88
|
describe '#lines' do
|
31
|
-
|
89
|
+
let(:opts) { {} }
|
90
|
+
|
91
|
+
subject { including_instance.lines(opts) { } }
|
32
92
|
|
33
93
|
context 'when the block is given' do
|
34
94
|
context 'when a model exists' do
|
@@ -45,6 +105,12 @@ module Vedeu
|
|
45
105
|
|
46
106
|
it { proc { subject }.must_raise(Vedeu::Error::RequiresBlock) }
|
47
107
|
end
|
108
|
+
|
109
|
+
context 'when the opts parameter is not given' do
|
110
|
+
subject { including_instance.lines { } }
|
111
|
+
|
112
|
+
# @todo Add more tests.
|
113
|
+
end
|
48
114
|
end
|
49
115
|
|
50
116
|
describe '#line' do
|
@@ -70,7 +136,9 @@ module Vedeu
|
|
70
136
|
end
|
71
137
|
|
72
138
|
describe '#streams' do
|
73
|
-
|
139
|
+
let(:opts) { {} }
|
140
|
+
|
141
|
+
subject { including_instance.streams(opts) { } }
|
74
142
|
|
75
143
|
context 'when the block is given' do
|
76
144
|
context 'when a model exists' do
|
@@ -89,6 +157,12 @@ module Vedeu
|
|
89
157
|
|
90
158
|
it { proc { subject }.must_raise(Vedeu::Error::RequiresBlock) }
|
91
159
|
end
|
160
|
+
|
161
|
+
context 'when the opts parameter is not given' do
|
162
|
+
subject { including_instance.streams { } }
|
163
|
+
|
164
|
+
# @todo Add more tests.
|
165
|
+
end
|
92
166
|
end
|
93
167
|
|
94
168
|
describe '#stream' do
|
@@ -113,6 +187,24 @@ module Vedeu
|
|
113
187
|
end
|
114
188
|
end
|
115
189
|
|
190
|
+
describe '#text' do
|
191
|
+
let(:_value) {}
|
192
|
+
let(:opts) {
|
193
|
+
{
|
194
|
+
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
subject { including_instance.text(_value, opts) }
|
199
|
+
|
200
|
+
context 'when a model exists' do
|
201
|
+
end
|
202
|
+
|
203
|
+
context 'when a model does not exist' do
|
204
|
+
it { proc { subject }.must_raise(Vedeu::Error::Fatal) }
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
116
208
|
end # Elements
|
117
209
|
|
118
210
|
end # DSL
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -14,17 +14,35 @@ module Vedeu
|
|
14
14
|
let(:client) {}
|
15
15
|
|
16
16
|
describe '#view' do
|
17
|
+
let(:_name) { :dysprosium }
|
18
|
+
|
17
19
|
subject {
|
18
|
-
instance.view(
|
20
|
+
instance.view(_name) do
|
19
21
|
# ...
|
20
22
|
end
|
21
23
|
}
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
+
context 'when the block is given' do
|
26
|
+
context 'when the name is given' do
|
27
|
+
it { subject.must_be_instance_of(Vedeu::Views::Views) }
|
28
|
+
it { subject[0].must_be_instance_of(Vedeu::Views::View) }
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'when the name is not given' do
|
32
|
+
let(:_name) {}
|
33
|
+
|
34
|
+
it do
|
35
|
+
proc { subject }.must_raise(Vedeu::Error::MissingRequired)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
25
39
|
|
26
40
|
context 'when the block is not given' do
|
27
|
-
|
41
|
+
subject { instance.view(_name) }
|
42
|
+
|
43
|
+
it do
|
44
|
+
proc { subject }.must_raise(Vedeu::Error::RequiresBlock)
|
45
|
+
end
|
28
46
|
end
|
29
47
|
end
|
30
48
|
|
@@ -22,8 +22,7 @@ module Vedeu
|
|
22
22
|
end
|
23
23
|
}
|
24
24
|
|
25
|
-
it {
|
26
|
-
it { subject.must_be_instance_of(Array) }
|
25
|
+
it { subject.must_be_instance_of(Vedeu::Views::Composition) }
|
27
26
|
|
28
27
|
context 'when the block is not given' do
|
29
28
|
subject { described.renders }
|
@@ -32,7 +31,9 @@ module Vedeu
|
|
32
31
|
end
|
33
32
|
|
34
33
|
context 'when the block is given' do
|
35
|
-
|
34
|
+
context 'but no views were defined' do
|
35
|
+
it { subject.views?.must_equal(false) }
|
36
|
+
end
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
@@ -43,7 +44,7 @@ module Vedeu
|
|
43
44
|
end
|
44
45
|
}
|
45
46
|
|
46
|
-
it { subject.must_be_instance_of(
|
47
|
+
it { subject.must_be_instance_of(Vedeu::Views::Composition) }
|
47
48
|
|
48
49
|
context 'when the block is not given' do
|
49
50
|
subject { described.views }
|
@@ -52,7 +53,9 @@ module Vedeu
|
|
52
53
|
end
|
53
54
|
|
54
55
|
context 'when the block is given' do
|
55
|
-
|
56
|
+
context 'but no views were defined' do
|
57
|
+
it { subject.views?.must_equal(false) }
|
58
|
+
end
|
56
59
|
end
|
57
60
|
end
|
58
61
|
|