vedeu 0.4.9 → 0.4.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu/api.rb +8 -0
- data/lib/vedeu/application.rb +2 -0
- data/lib/vedeu/bindings.rb +3 -0
- data/lib/vedeu/configuration/configuration.rb +1 -1
- data/lib/vedeu/cursor/cursor.rb +1 -1
- data/lib/vedeu/cursor/move.rb +1 -1
- data/lib/vedeu/cursor/refresh_cursor.rb +2 -0
- data/lib/vedeu/cursor/toggle.rb +1 -1
- data/lib/vedeu/debug.rb +36 -1
- data/lib/vedeu/distributed/client.rb +2 -0
- data/lib/vedeu/distributed/subprocess.rb +2 -0
- data/lib/vedeu/distributed/test_application.rb +2 -0
- data/lib/vedeu/distributed/uri.rb +2 -0
- data/lib/vedeu/events/event.rb +1 -1
- data/lib/vedeu/events/trigger.rb +2 -0
- data/lib/vedeu/geometry/all.rb +0 -1
- data/lib/vedeu/geometry/area.rb +22 -0
- data/lib/vedeu/geometry/centre.rb +2 -0
- data/lib/vedeu/geometry/content.rb +2 -0
- data/lib/vedeu/geometry/coordinate.rb +2 -0
- data/lib/vedeu/geometry/dimension.rb +2 -0
- data/lib/vedeu/geometry/geometry.rb +8 -3
- data/lib/vedeu/geometry/grid.rb +2 -0
- data/lib/vedeu/geometry/index_position.rb +21 -0
- data/lib/vedeu/geometry/limit.rb +2 -0
- data/lib/vedeu/geometry/position.rb +1 -1
- data/lib/vedeu/geometry/position_index.rb +2 -0
- data/lib/vedeu/geometry/position_validator.rb +2 -0
- data/lib/vedeu/input/input.rb +1 -1
- data/lib/vedeu/input/key.rb +1 -1
- data/lib/vedeu/input/keymap.rb +2 -0
- data/lib/vedeu/input/mapper.rb +8 -0
- data/lib/vedeu/launcher.rb +2 -0
- data/lib/vedeu/main_loop.rb +1 -3
- data/lib/vedeu/models/cell.rb +2 -0
- data/lib/vedeu/models/composition.rb +1 -1
- data/lib/vedeu/models/group.rb +1 -1
- data/lib/vedeu/models/interface.rb +35 -3
- data/lib/vedeu/models/line.rb +6 -1
- data/lib/vedeu/models/menu.rb +1 -1
- data/lib/vedeu/models/stream.rb +6 -17
- data/lib/vedeu/output/all.rb +3 -2
- data/lib/vedeu/output/background.rb +26 -0
- data/lib/vedeu/output/border.rb +105 -25
- data/lib/vedeu/output/clear.rb +17 -10
- data/lib/vedeu/output/colour.rb +1 -1
- data/lib/vedeu/output/compositor.rb +4 -1
- data/lib/vedeu/output/foreground.rb +26 -0
- data/lib/vedeu/output/html_char.rb +2 -0
- data/lib/vedeu/output/null_border.rb +49 -0
- data/lib/vedeu/output/output.rb +8 -44
- data/lib/vedeu/output/renderers/all.rb +3 -0
- data/lib/vedeu/output/{renderer.rb → renderers/file_renderer.rb} +14 -6
- data/lib/vedeu/output/{html_renderer.rb → renderers/html_renderer.rb} +3 -1
- data/lib/vedeu/output/renderers/terminal_renderer.rb +50 -0
- data/lib/vedeu/output/text.rb +1 -1
- data/lib/vedeu/output/translator.rb +21 -2
- data/lib/vedeu/output/viewport.rb +17 -50
- data/lib/vedeu/output/virtual_terminal.rb +2 -0
- data/lib/vedeu/output/wordwrap.rb +2 -0
- data/lib/vedeu/repositories/all.rb +82 -0
- data/lib/vedeu/repositories/collection.rb +16 -0
- data/lib/vedeu/repositories/repository.rb +2 -0
- data/lib/vedeu/support/log.rb +3 -0
- data/lib/vedeu/support/sentence.rb +2 -0
- data/lib/vedeu/support/template.rb +2 -0
- data/lib/vedeu/support/terminal.rb +6 -1
- data/lib/vedeu/support/trace.rb +2 -0
- data/lib/vedeu/support/visible.rb +6 -0
- data/test/lib/vedeu/dsl/components/border_test.rb +0 -270
- data/test/lib/vedeu/dsl/shared/text_test.rb +19 -0
- data/test/lib/vedeu/geometry/area_test.rb +32 -0
- data/test/lib/vedeu/geometry/index_position_test.rb +36 -0
- data/test/lib/vedeu/models/interface_test.rb +42 -1
- data/test/lib/vedeu/models/line_test.rb +15 -1
- data/test/lib/vedeu/models/stream_test.rb +15 -1
- data/test/lib/vedeu/output/background_test.rb +4 -2
- data/test/lib/vedeu/output/border_test.rb +229 -127
- data/test/lib/vedeu/output/clear_test.rb +14 -0
- data/test/lib/vedeu/output/foreground_test.rb +4 -2
- data/test/lib/vedeu/output/null_border_test.rb +53 -0
- data/test/lib/vedeu/output/output_test.rb +2 -0
- data/test/lib/vedeu/output/{renderer_test.rb → renderers/file_renderer_test.rb} +5 -5
- data/test/lib/vedeu/output/renderers/html_renderer_test.rb +71 -0
- data/test/lib/vedeu/output/renderers/terminal_renderer_test.rb +24 -0
- data/test/lib/vedeu/output/viewport_test.rb +100 -74
- data/vedeu.gemspec +1 -1
- metadata +15 -11
- data/lib/vedeu/geometry/bounding_area.rb +0 -136
- data/test/lib/vedeu/geometry/bounding_area_test.rb +0 -123
- data/test/lib/vedeu/output/html_renderer_test.rb +0 -42
@@ -4,9 +4,28 @@ module Vedeu
|
|
4
4
|
|
5
5
|
module DSL
|
6
6
|
|
7
|
+
class TextTestClass
|
8
|
+
include Vedeu::DSL::Text
|
9
|
+
|
10
|
+
end
|
11
|
+
|
7
12
|
describe Text do
|
8
13
|
|
14
|
+
let(:instance) { Vedeu::DSL::TextTestClass.new }
|
15
|
+
let(:value) {}
|
16
|
+
let(:options) { {} }
|
17
|
+
|
9
18
|
describe '#text' do
|
19
|
+
subject { instance.text(value, options) }
|
20
|
+
|
21
|
+
context 'when the model is a Vedeu::Interface' do
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when the model is a Vedeu::Line' do
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when the model is a Vedeu::Stream' do
|
28
|
+
end
|
10
29
|
end
|
11
30
|
|
12
31
|
end # Text
|
@@ -182,6 +182,38 @@ module Vedeu
|
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
185
|
+
describe '#top_left' do
|
186
|
+
subject { instance.top_left }
|
187
|
+
|
188
|
+
it { subject.must_be_instance_of(Vedeu::Position) }
|
189
|
+
it { subject.y.must_equal(4) }
|
190
|
+
it { subject.x.must_equal(6) }
|
191
|
+
end
|
192
|
+
|
193
|
+
describe '#bottom_left' do
|
194
|
+
subject { instance.bottom_left }
|
195
|
+
|
196
|
+
it { subject.must_be_instance_of(Vedeu::Position) }
|
197
|
+
it { subject.y.must_equal(9) }
|
198
|
+
it { subject.x.must_equal(6) }
|
199
|
+
end
|
200
|
+
|
201
|
+
describe '#top_right' do
|
202
|
+
subject { instance.top_right }
|
203
|
+
|
204
|
+
it { subject.must_be_instance_of(Vedeu::Position) }
|
205
|
+
it { subject.y.must_equal(4) }
|
206
|
+
it { subject.x.must_equal(21) }
|
207
|
+
end
|
208
|
+
|
209
|
+
describe '#bottom_right' do
|
210
|
+
subject { instance.bottom_right }
|
211
|
+
|
212
|
+
it { subject.must_be_instance_of(Vedeu::Position) }
|
213
|
+
it { subject.y.must_equal(9) }
|
214
|
+
it { subject.x.must_equal(21) }
|
215
|
+
end
|
216
|
+
|
185
217
|
end # Area
|
186
218
|
|
187
219
|
end # Vedeu
|
@@ -30,6 +30,42 @@ module Vedeu
|
|
30
30
|
it { subject.must_be_instance_of(Vedeu::Position) }
|
31
31
|
end
|
32
32
|
|
33
|
+
describe '.from_interface' do
|
34
|
+
let(:ix) { 3 }
|
35
|
+
let(:iy) { 3 }
|
36
|
+
let(:_name) { 'IndexPosition.from_interface' }
|
37
|
+
|
38
|
+
before do
|
39
|
+
Vedeu.borders.reset
|
40
|
+
Vedeu.interfaces.reset
|
41
|
+
Vedeu.interface('IndexPosition.from_interface') do
|
42
|
+
geometry do
|
43
|
+
x 4
|
44
|
+
y 6
|
45
|
+
xn 10
|
46
|
+
yn 12
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
after { Vedeu.interfaces.reset }
|
51
|
+
|
52
|
+
subject { described.from_interface(_name, iy, ix) }
|
53
|
+
|
54
|
+
it { subject.must_be_instance_of(Vedeu::Position) }
|
55
|
+
|
56
|
+
context 'when the interface has a border' do
|
57
|
+
before { Vedeu.border('IndexPosition.from_interface') {} }
|
58
|
+
|
59
|
+
it { subject.x.must_equal(8) }
|
60
|
+
it { subject.y.must_equal(10) }
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'when the interface does not have a border' do
|
64
|
+
it { subject.x.must_equal(7) }
|
65
|
+
it { subject.y.must_equal(9) }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
33
69
|
describe '#[]' do
|
34
70
|
subject { instance.[] }
|
35
71
|
|
@@ -51,16 +51,45 @@ module Vedeu
|
|
51
51
|
subject { instance.border? }
|
52
52
|
|
53
53
|
context 'when the interface has a border' do
|
54
|
-
before { Vedeu.
|
54
|
+
before { Vedeu.border('hydrogen') { } }
|
55
|
+
after { Vedeu.borders.reset }
|
55
56
|
|
56
57
|
it { subject.must_equal(true) }
|
57
58
|
end
|
58
59
|
|
59
60
|
context 'when the interface does not have a border' do
|
61
|
+
before { Vedeu.borders.reset }
|
62
|
+
|
60
63
|
it { subject.must_equal(false) }
|
61
64
|
end
|
62
65
|
end
|
63
66
|
|
67
|
+
describe '#border' do
|
68
|
+
subject { instance.border }
|
69
|
+
|
70
|
+
context 'when the interface has a border' do
|
71
|
+
before { Vedeu.border('hydrogen') { } }
|
72
|
+
after { Vedeu.borders.reset }
|
73
|
+
|
74
|
+
it { subject.must_be_instance_of(Vedeu::Border) }
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'when the interface does not have a border' do
|
78
|
+
before { Vedeu.borders.reset }
|
79
|
+
|
80
|
+
it { subject.must_be_instance_of(Vedeu::NullBorder) }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe '#clear' do
|
85
|
+
subject { instance.clear }
|
86
|
+
|
87
|
+
it {
|
88
|
+
Vedeu::Clear.expects(:render).with(instance)
|
89
|
+
subject
|
90
|
+
}
|
91
|
+
end
|
92
|
+
|
64
93
|
describe '#lines?' do
|
65
94
|
subject { instance.lines? }
|
66
95
|
|
@@ -81,6 +110,10 @@ module Vedeu
|
|
81
110
|
it { subject.must_be_instance_of(Vedeu::Cursor) }
|
82
111
|
end
|
83
112
|
|
113
|
+
describe '#render' do
|
114
|
+
subject { instance.render }
|
115
|
+
end
|
116
|
+
|
84
117
|
describe '#store' do
|
85
118
|
subject { instance.store }
|
86
119
|
|
@@ -89,7 +122,15 @@ module Vedeu
|
|
89
122
|
|
90
123
|
it { proc { subject }.must_raise(MissingRequired) }
|
91
124
|
end
|
125
|
+
end
|
92
126
|
|
127
|
+
describe '#viewport' do
|
128
|
+
subject { instance.viewport }
|
129
|
+
|
130
|
+
it {
|
131
|
+
Vedeu::Viewport.expects(:render).with(instance)
|
132
|
+
subject
|
133
|
+
}
|
93
134
|
end
|
94
135
|
|
95
136
|
end # Interface
|
@@ -33,7 +33,7 @@ module Vedeu
|
|
33
33
|
|
34
34
|
let(:streams_parent) { Line.new({ streams: nil, parent: parent, colour: colour, style: style }) }
|
35
35
|
|
36
|
-
let(:parent) { Vedeu::Interface.new }
|
36
|
+
let(:parent) { Vedeu::Interface.new({ name: 'Vedeu::Line' }) }
|
37
37
|
let(:colour) { Colour.new({ foreground: '#ff0000', background: '#000000' }) }
|
38
38
|
let(:style) { Style.new('normal') }
|
39
39
|
|
@@ -80,6 +80,20 @@ module Vedeu
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
+
describe '#name' do
|
84
|
+
subject { instance.name }
|
85
|
+
|
86
|
+
context 'when a parent is defined' do
|
87
|
+
it { subject.must_be_instance_of(String) }
|
88
|
+
end
|
89
|
+
|
90
|
+
context 'when a parent is not defined' do
|
91
|
+
before { instance.stubs(:parent) }
|
92
|
+
|
93
|
+
it { subject.must_be_instance_of(NilClass) }
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
83
97
|
describe '#size' do
|
84
98
|
subject { instance.size }
|
85
99
|
|
@@ -25,7 +25,7 @@ module Vedeu
|
|
25
25
|
}
|
26
26
|
let(:colour) { Colour.new({ background: '#ff0000', foreground: '#000000' }) }
|
27
27
|
let(:style) { Style.new('normal') }
|
28
|
-
let(:line_parent) { Vedeu::Interface.new }
|
28
|
+
let(:line_parent) { Vedeu::Interface.new({ name: 'Vedeu::Stream' }) }
|
29
29
|
|
30
30
|
describe '#initialize' do
|
31
31
|
it { instance.must_be_instance_of(described) }
|
@@ -75,6 +75,20 @@ module Vedeu
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
+
describe '#name' do
|
79
|
+
subject { instance.name }
|
80
|
+
|
81
|
+
context 'when a parent is defined' do
|
82
|
+
it { subject.must_be_instance_of(String) }
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'when a parent is not defined' do
|
86
|
+
before { instance.stubs(:parent) }
|
87
|
+
|
88
|
+
it { subject.must_be_instance_of(NilClass) }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
78
92
|
describe '#size' do
|
79
93
|
subject { instance.size }
|
80
94
|
|
@@ -5,8 +5,10 @@ module Vedeu
|
|
5
5
|
describe Background do
|
6
6
|
|
7
7
|
let(:described) { Vedeu::Background }
|
8
|
-
let(:instance)
|
9
|
-
let(:colour)
|
8
|
+
let(:instance) { described.new(colour) }
|
9
|
+
let(:colour) {}
|
10
|
+
|
11
|
+
before { Vedeu.background_colours.reset! }
|
10
12
|
|
11
13
|
describe '.escape_sequence' do
|
12
14
|
describe 'when the colour is empty' do
|
@@ -68,6 +68,132 @@ module Vedeu
|
|
68
68
|
it { instance.instance_variable_get('@style').must_equal([]) }
|
69
69
|
end
|
70
70
|
|
71
|
+
describe 'border offset methods; bx, bxn, by, byn' do
|
72
|
+
let(:attributes) {
|
73
|
+
{
|
74
|
+
bottom_left: 'C',
|
75
|
+
bottom_right: 'D',
|
76
|
+
enabled: enabled,
|
77
|
+
horizontal: 'H',
|
78
|
+
name: 'Border#bxbxnbybyn',
|
79
|
+
show_top: top,
|
80
|
+
show_bottom: bottom,
|
81
|
+
show_left: left,
|
82
|
+
show_right: right,
|
83
|
+
top_left: 'A',
|
84
|
+
top_right: 'B',
|
85
|
+
vertical: 'V'
|
86
|
+
}
|
87
|
+
}
|
88
|
+
let(:enabled) { false }
|
89
|
+
let(:top) { false }
|
90
|
+
let(:bottom) { false }
|
91
|
+
let(:left) { false }
|
92
|
+
let(:right) { false }
|
93
|
+
|
94
|
+
before do
|
95
|
+
Vedeu.interfaces.reset
|
96
|
+
Vedeu.borders.reset
|
97
|
+
|
98
|
+
Vedeu.interface('Border#bxbxnbybyn') do
|
99
|
+
geometry do
|
100
|
+
x 2
|
101
|
+
xn 6
|
102
|
+
y 2
|
103
|
+
yn 6
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe '#bx' do
|
109
|
+
subject { instance.bx }
|
110
|
+
|
111
|
+
context 'when enabled' do
|
112
|
+
let(:enabled) { true }
|
113
|
+
|
114
|
+
context 'with left' do
|
115
|
+
let(:left) { true }
|
116
|
+
|
117
|
+
it { subject.must_equal(3) }
|
118
|
+
end
|
119
|
+
|
120
|
+
context 'without left' do
|
121
|
+
it { subject.must_equal(2) }
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
context 'when not enabled' do
|
126
|
+
it { subject.must_equal(2) }
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe '#bxn' do
|
131
|
+
subject { instance.bxn }
|
132
|
+
|
133
|
+
context 'when enabled' do
|
134
|
+
let(:enabled) { true }
|
135
|
+
|
136
|
+
context 'with right' do
|
137
|
+
let(:right) { true }
|
138
|
+
|
139
|
+
it { subject.must_equal(5) }
|
140
|
+
end
|
141
|
+
|
142
|
+
context 'without right' do
|
143
|
+
it { subject.must_equal(6) }
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
context 'when not enabled' do
|
148
|
+
it { subject.must_equal(6) }
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe '#by' do
|
153
|
+
subject { instance.by }
|
154
|
+
|
155
|
+
context 'when enabled' do
|
156
|
+
let(:enabled) { true }
|
157
|
+
|
158
|
+
context 'with top' do
|
159
|
+
let(:top) { true }
|
160
|
+
|
161
|
+
it { subject.must_equal(3) }
|
162
|
+
end
|
163
|
+
|
164
|
+
context 'without top' do
|
165
|
+
it { subject.must_equal(2) }
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
context 'when not enabled' do
|
170
|
+
it { subject.must_equal(2) }
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
describe '#byn' do
|
175
|
+
subject { instance.byn }
|
176
|
+
|
177
|
+
context 'when enabled' do
|
178
|
+
let(:enabled) { true }
|
179
|
+
|
180
|
+
context 'with bottom' do
|
181
|
+
let(:bottom) { true }
|
182
|
+
|
183
|
+
it { subject.must_equal(5) }
|
184
|
+
end
|
185
|
+
|
186
|
+
context 'without bottom' do
|
187
|
+
it { subject.must_equal(6) }
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
context 'when not enabled' do
|
192
|
+
it { subject.must_equal(6) }
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
71
197
|
describe '#width' do
|
72
198
|
subject { instance.width }
|
73
199
|
|
@@ -269,163 +395,139 @@ module Vedeu
|
|
269
395
|
end
|
270
396
|
end
|
271
397
|
|
272
|
-
describe '#
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
398
|
+
describe '#render' do
|
399
|
+
let(:attributes) {
|
400
|
+
{
|
401
|
+
bottom_left: 'C',
|
402
|
+
bottom_right: 'D',
|
403
|
+
enabled: enabled,
|
404
|
+
horizontal: 'H',
|
405
|
+
name: 'Border#render',
|
406
|
+
show_top: top,
|
407
|
+
show_bottom: bottom,
|
408
|
+
show_left: left,
|
409
|
+
show_right: right,
|
410
|
+
top_left: 'A',
|
411
|
+
top_right: 'B',
|
412
|
+
vertical: 'V'
|
413
|
+
}
|
414
|
+
}
|
415
|
+
let(:enabled) { false }
|
416
|
+
let(:top) { false }
|
417
|
+
let(:bottom) { false }
|
418
|
+
let(:left) { false }
|
419
|
+
let(:right) { false }
|
420
|
+
|
421
|
+
before do
|
422
|
+
Vedeu.interfaces.reset
|
423
|
+
Vedeu.borders.reset
|
424
|
+
|
425
|
+
Vedeu.interface('Border#render') do
|
426
|
+
geometry do
|
427
|
+
x 1
|
428
|
+
xn 4
|
429
|
+
y 1
|
430
|
+
yn 4
|
279
431
|
end
|
280
432
|
end
|
433
|
+
end
|
281
434
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
\e(0m\e(B\e(0q\e(B\e(0q\e(B\e(0q\e(B\e(0q\e(B\e(0q\e(B\e(0q\e(B\e(0j\e(B"
|
289
|
-
)
|
290
|
-
end
|
435
|
+
subject { instance.render }
|
436
|
+
|
437
|
+
it { subject.must_be_instance_of(Array) }
|
438
|
+
|
439
|
+
context 'when the border is not enabled' do
|
440
|
+
it { subject.must_equal([]) }
|
291
441
|
end
|
292
442
|
|
293
|
-
context 'when
|
294
|
-
|
295
|
-
Vedeu.border 'borders' do
|
296
|
-
show_bottom false
|
297
|
-
show_left false
|
298
|
-
show_right false
|
299
|
-
show_top false
|
300
|
-
end
|
301
|
-
end
|
443
|
+
context 'when the border is enabled' do
|
444
|
+
let(:enabled) { true }
|
302
445
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
"Plutoniu\n" \
|
308
|
-
"Potassiu\n" \
|
309
|
-
"Lanthanu"
|
310
|
-
)
|
446
|
+
context 'top' do
|
447
|
+
let(:top) { true }
|
448
|
+
|
449
|
+
it { subject.size.must_equal(4) }
|
311
450
|
end
|
312
|
-
end
|
313
451
|
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
show_right false
|
319
|
-
end
|
452
|
+
context 'right' do
|
453
|
+
let(:right) { true }
|
454
|
+
|
455
|
+
it { subject.size.must_equal(4) }
|
320
456
|
end
|
321
457
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
"Magnesiu\n" \
|
327
|
-
"Plutoniu\n" \
|
328
|
-
"\e(0q\e(B\e(0q\e(B\e(0q\e(B\e(0q\e(B\e(0q\e(B\e(0q\e(B\e(0q\e(B\e(0q\e(B"
|
329
|
-
)
|
458
|
+
context 'bottom' do
|
459
|
+
let(:bottom) { true }
|
460
|
+
|
461
|
+
it { subject.size.must_equal(4) }
|
330
462
|
end
|
331
|
-
end
|
332
463
|
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
show_top false
|
338
|
-
end
|
464
|
+
context 'left' do
|
465
|
+
let(:left) { true }
|
466
|
+
|
467
|
+
it { subject.size.must_equal(4) }
|
339
468
|
end
|
340
469
|
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
"\e(0x\e(BPotass\e(0x\e(B\n" \
|
347
|
-
"\e(0x\e(BLantha\e(0x\e(B"
|
348
|
-
)
|
470
|
+
context 'top and right' do
|
471
|
+
let(:top) { true }
|
472
|
+
let(:right) { true }
|
473
|
+
|
474
|
+
it { subject.size.must_equal(7) }
|
349
475
|
end
|
350
|
-
end
|
351
476
|
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
end
|
477
|
+
context 'top and right and bottom' do
|
478
|
+
let(:top) { true }
|
479
|
+
let(:right) { true }
|
480
|
+
let(:bottom) { true }
|
481
|
+
|
482
|
+
it { subject.size.must_equal(10) }
|
359
483
|
end
|
360
484
|
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
"\e(0x\e(BPotassi\n" \
|
367
|
-
"\e(0x\e(BLanthan"
|
368
|
-
)
|
485
|
+
context 'top and bottom' do
|
486
|
+
let(:top) { true }
|
487
|
+
let(:bottom) { true }
|
488
|
+
|
489
|
+
it { subject.size.must_equal(8) }
|
369
490
|
end
|
370
|
-
end
|
371
491
|
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
show_top false
|
378
|
-
end
|
492
|
+
context 'top and left' do
|
493
|
+
let(:top) { true }
|
494
|
+
let(:left) { true }
|
495
|
+
|
496
|
+
it { subject.size.must_equal(7) }
|
379
497
|
end
|
380
498
|
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
"Potassi\e(0x\e(B\n" \
|
387
|
-
"Lanthan\e(0x\e(B" \
|
388
|
-
)
|
499
|
+
context 'right and bottom' do
|
500
|
+
let(:right) { true }
|
501
|
+
let(:bottom) { true }
|
502
|
+
|
503
|
+
it { subject.size.must_equal(7) }
|
389
504
|
end
|
390
|
-
end
|
391
505
|
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
show_right false
|
398
|
-
end
|
506
|
+
context 'right and left' do
|
507
|
+
let(:right) { true }
|
508
|
+
let(:left) { true }
|
509
|
+
|
510
|
+
it { subject.size.must_equal(8) }
|
399
511
|
end
|
400
512
|
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
"Plutoniu\n" \
|
407
|
-
"Potassiu"
|
408
|
-
)
|
513
|
+
context 'bottom and left' do
|
514
|
+
let(:bottom) { true }
|
515
|
+
let(:left) { true }
|
516
|
+
|
517
|
+
it { subject.size.must_equal(7) }
|
409
518
|
end
|
410
|
-
end
|
411
519
|
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
520
|
+
context 'all' do
|
521
|
+
let(:top) { true }
|
522
|
+
let(:right) { true }
|
523
|
+
let(:bottom) { true }
|
524
|
+
let(:left) { true }
|
525
|
+
|
526
|
+
it { subject.size.must_equal(12) }
|
419
527
|
end
|
420
528
|
|
421
|
-
|
422
|
-
subject.must_equal(
|
423
|
-
"Berylliu\n" \
|
424
|
-
"Magnesiu\n" \
|
425
|
-
"Plutoniu\n" \
|
426
|
-
"Potassiu\n" \
|
427
|
-
"\e(0q\e(B\e(0q\e(B\e(0q\e(B\e(0q\e(B\e(0q\e(B\e(0q\e(B\e(0q\e(B\e(0q\e(B"
|
428
|
-
)
|
529
|
+
context 'none' do
|
530
|
+
it { subject.size.must_equal(0) }
|
429
531
|
end
|
430
532
|
end
|
431
533
|
end
|