vedeu 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +40 -0
- data/README.md +1 -0
- data/docs/dsl.md +24 -24
- data/lib/vedeu/all.rb +21 -44
- data/lib/vedeu/api.rb +13 -13
- data/lib/vedeu/application/application_controller.rb +2 -0
- data/lib/vedeu/bindings/movement.rb +53 -18
- data/lib/vedeu/bindings/refresh.rb +1 -1
- data/lib/vedeu/bindings/system.rb +2 -2
- data/lib/vedeu/bindings/visibility.rb +3 -3
- data/lib/vedeu/borders/all.rb +13 -0
- data/lib/vedeu/borders/border.rb +209 -202
- data/lib/vedeu/{dsl/border.rb → borders/dsl.rb} +15 -15
- data/lib/vedeu/{null/border.rb → borders/null.rb} +9 -9
- data/lib/vedeu/borders/render.rb +347 -0
- data/lib/vedeu/borders/repository.rb +19 -0
- data/lib/vedeu/buffers/all.rb +13 -0
- data/lib/vedeu/buffers/buffer.rb +182 -176
- data/lib/vedeu/{null/buffer.rb → buffers/null.rb} +8 -8
- data/lib/vedeu/buffers/repository.rb +24 -0
- data/lib/vedeu/buffers/virtual_buffer.rb +2 -2
- data/lib/vedeu/cursors/all.rb +11 -0
- data/lib/vedeu/cursors/cursor.rb +276 -0
- data/lib/vedeu/cursors/refresh.rb +84 -0
- data/lib/vedeu/cursors/repository.rb +34 -0
- data/lib/vedeu/dsl/interface.rb +9 -9
- data/lib/vedeu/dsl/shared.rb +11 -11
- data/lib/vedeu/{exceptions.rb → error.rb} +2 -2
- data/lib/vedeu/esc/esc.rb +1 -1
- data/lib/vedeu/geometry/all.rb +18 -0
- data/lib/vedeu/geometry/area.rb +170 -160
- data/lib/vedeu/geometry/coordinate.rb +61 -39
- data/lib/vedeu/geometry/dimension.rb +139 -132
- data/lib/vedeu/{dsl/geometry.rb → geometry/dsl.rb} +11 -11
- data/lib/vedeu/geometry/generic_coordinate.rb +159 -153
- data/lib/vedeu/geometry/geometry.rb +310 -212
- data/lib/vedeu/geometry/grid.rb +73 -69
- data/lib/vedeu/{null/geometry.rb → geometry/null.rb} +10 -10
- data/lib/vedeu/geometry/position.rb +124 -120
- data/lib/vedeu/geometry/repository.rb +19 -0
- data/lib/vedeu/input/editor/document.rb +2 -2
- data/lib/vedeu/internal_api.rb +8 -8
- data/lib/vedeu/models/escape.rb +2 -2
- data/lib/vedeu/models/interface.rb +1 -1
- data/lib/vedeu/models/page.rb +89 -0
- data/lib/vedeu/models/row.rb +66 -0
- data/lib/vedeu/models/toggleable.rb +1 -1
- data/lib/vedeu/models/views/char.rb +7 -6
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/view.rb +2 -2
- data/lib/vedeu/options.rb +19 -0
- data/lib/vedeu/output/clear/named_interface.rb +1 -1
- data/lib/vedeu/output/direct.rb +1 -1
- data/lib/vedeu/output/presentation.rb +2 -1
- data/lib/vedeu/output/viewport.rb +3 -3
- data/lib/vedeu/repositories/model.rb +9 -1
- data/lib/vedeu/repositories/repository.rb +5 -0
- data/lib/vedeu/terminal/terminal.rb +3 -3
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/border_test.rb +299 -291
- data/test/lib/vedeu/{dsl/border_test.rb → borders/dsl_test.rb} +6 -6
- data/test/lib/vedeu/{null/border_test.rb → borders/null_test.rb} +6 -6
- data/test/lib/vedeu/borders/render_test.rb +125 -0
- data/test/lib/vedeu/borders/repository_test.rb +17 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +116 -112
- data/test/lib/vedeu/{null/buffer_test.rb → buffers/null_test.rb} +5 -5
- data/test/lib/vedeu/buffers/repository_test.rb +18 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +370 -0
- data/test/lib/vedeu/cursors/refresh_test.rb +69 -0
- data/test/lib/vedeu/cursors/repository_test.rb +41 -0
- data/test/lib/vedeu/dsl/interface_test.rb +5 -5
- data/test/lib/vedeu/{exceptions_test.rb → error_test.rb} +0 -0
- data/test/lib/vedeu/geometry/area_test.rb +141 -137
- data/test/lib/vedeu/geometry/coordinate_test.rb +93 -89
- data/test/lib/vedeu/geometry/dimension_test.rb +137 -133
- data/test/lib/vedeu/{dsl/geometry_test.rb → geometry/dsl_test.rb} +17 -17
- data/test/lib/vedeu/geometry/generic_coordinate_test.rb +32 -28
- data/test/lib/vedeu/geometry/geometry_test.rb +282 -157
- data/test/lib/vedeu/geometry/grid_test.rb +35 -31
- data/test/lib/vedeu/{null/geometry_test.rb → geometry/null_test.rb} +5 -5
- data/test/lib/vedeu/geometry/position_test.rb +146 -142
- data/test/lib/vedeu/geometry/repository_test.rb +19 -0
- data/test/lib/vedeu/input/editor/document_test.rb +1 -1
- data/test/lib/vedeu/models/escape_test.rb +1 -1
- data/test/lib/vedeu/models/interface_test.rb +2 -2
- data/test/lib/vedeu/models/page_test.rb +235 -0
- data/test/lib/vedeu/models/row_test.rb +111 -0
- data/test/lib/vedeu/models/views/char_test.rb +3 -3
- data/test/lib/vedeu/options_test.rb +57 -0
- data/test/lib/vedeu/output/clear/named_interface_test.rb +1 -1
- data/test/lib/vedeu/output/renderers/json_test.rb +1 -1
- data/test/lib/vedeu/output/viewport_test.rb +15 -9
- data/test/lib/vedeu/refresh/refresh_buffer_test.rb +12 -12
- data/test/lib/vedeu/repositories/repositories_test.rb +1 -1
- data/test/lib/vedeu/repositories/repository_test.rb +7 -0
- data/test/lib/vedeu/terminal/terminal_test.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/vedeu.gemspec +2 -2
- metadata +57 -63
- data/lib/vedeu/borders/borders.rb +0 -15
- data/lib/vedeu/borders/render_border.rb +0 -331
- data/lib/vedeu/buffers/buffers.rb +0 -20
- data/lib/vedeu/cursor/cursor.rb +0 -174
- data/lib/vedeu/cursor/cursors.rb +0 -30
- data/lib/vedeu/cursor/move.rb +0 -239
- data/lib/vedeu/cursor/reposition.rb +0 -78
- data/lib/vedeu/geometry/geometries.rb +0 -15
- data/lib/vedeu/refresh/refresh_cursor.rb +0 -92
- data/test/lib/vedeu/borders/borders_test.rb +0 -13
- data/test/lib/vedeu/borders/render_border_test.rb +0 -121
- data/test/lib/vedeu/buffers/buffers_test.rb +0 -14
- data/test/lib/vedeu/cursor/cursor_test.rb +0 -246
- data/test/lib/vedeu/cursor/cursors_test.rb +0 -37
- data/test/lib/vedeu/cursor/move_test.rb +0 -301
- data/test/lib/vedeu/cursor/reposition_test.rb +0 -63
- data/test/lib/vedeu/geometry/geometries_test.rb +0 -15
- data/test/lib/vedeu/refresh/refresh_cursor_test.rb +0 -65
data/lib/vedeu/version.rb
CHANGED
@@ -2,273 +2,322 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
let(:described) { Vedeu::Border }
|
8
|
-
let(:instance) { described.new(attributes) }
|
9
|
-
let(:attributes) {
|
10
|
-
{
|
11
|
-
bottom_left: 'm',
|
12
|
-
bottom_right: 'j',
|
13
|
-
caption: '',
|
14
|
-
client: nil,
|
15
|
-
colour: nil,
|
16
|
-
enabled: false,
|
17
|
-
horizontal: 'q',
|
18
|
-
name: 'borders',
|
19
|
-
repository: Vedeu.borders,
|
20
|
-
show_bottom: true,
|
21
|
-
show_left: true,
|
22
|
-
show_right: true,
|
23
|
-
show_top: true,
|
24
|
-
style: nil,
|
25
|
-
title: '',
|
26
|
-
top_left: 'l',
|
27
|
-
top_right: 'k',
|
28
|
-
vertical: 'x',
|
29
|
-
}
|
30
|
-
}
|
31
|
-
let(:geometry) {}
|
5
|
+
module Borders
|
32
6
|
|
33
|
-
|
7
|
+
describe Border do
|
34
8
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
9
|
+
let(:described) { Vedeu::Borders::Border }
|
10
|
+
let(:instance) { described.new(attributes) }
|
11
|
+
let(:attributes) {
|
12
|
+
{
|
13
|
+
bottom_left: 'm',
|
14
|
+
bottom_right: 'j',
|
15
|
+
caption: '',
|
16
|
+
client: nil,
|
17
|
+
colour: nil,
|
18
|
+
enabled: false,
|
19
|
+
horizontal: 'q',
|
20
|
+
name: 'borders',
|
21
|
+
repository: Vedeu.borders,
|
22
|
+
show_bottom: true,
|
23
|
+
show_left: true,
|
24
|
+
show_right: true,
|
25
|
+
show_top: true,
|
26
|
+
style: nil,
|
27
|
+
title: '',
|
28
|
+
top_left: 'l',
|
29
|
+
top_right: 'k',
|
30
|
+
vertical: 'x',
|
31
|
+
}
|
40
32
|
}
|
33
|
+
let(:geometry) {}
|
41
34
|
|
42
|
-
|
43
|
-
end
|
35
|
+
before { Vedeu.geometries.stubs(:by_name).returns(geometry) }
|
44
36
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
37
|
+
describe '.build' do
|
38
|
+
subject {
|
39
|
+
described.build(attributes) do
|
40
|
+
horizontal '~'
|
41
|
+
end
|
42
|
+
}
|
43
|
+
|
44
|
+
it { subject.must_be_instance_of(described) }
|
50
45
|
end
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
{
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
46
|
+
|
47
|
+
describe '#initialize' do
|
48
|
+
it { instance.must_be_instance_of(described) }
|
49
|
+
it do
|
50
|
+
instance.instance_variable_get('@attributes').
|
51
|
+
must_equal(attributes)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe 'accessors' do
|
56
|
+
it { instance.must_respond_to(:attributes) }
|
57
|
+
it { instance.must_respond_to(:attributes=) }
|
58
|
+
it { instance.must_respond_to(:bottom_left) }
|
59
|
+
it { instance.must_respond_to(:bottom_left=) }
|
60
|
+
it { instance.must_respond_to(:bottom_right) }
|
61
|
+
it { instance.must_respond_to(:bottom_right=) }
|
62
|
+
it { instance.must_respond_to(:caption) }
|
63
|
+
it { instance.must_respond_to(:caption=) }
|
64
|
+
it { instance.must_respond_to(:horizontal) }
|
65
|
+
it { instance.must_respond_to(:horizontal=) }
|
66
|
+
it { instance.must_respond_to(:show_bottom) }
|
67
|
+
it { instance.must_respond_to(:bottom?) }
|
68
|
+
it { instance.must_respond_to(:show_bottom=) }
|
69
|
+
it { instance.must_respond_to(:show_left) }
|
70
|
+
it { instance.must_respond_to(:left?) }
|
71
|
+
it { instance.must_respond_to(:show_left=) }
|
72
|
+
it { instance.must_respond_to(:show_right) }
|
73
|
+
it { instance.must_respond_to(:right?) }
|
74
|
+
it { instance.must_respond_to(:show_right=) }
|
75
|
+
it { instance.must_respond_to(:show_top) }
|
76
|
+
it { instance.must_respond_to(:top?) }
|
77
|
+
it { instance.must_respond_to(:show_top=) }
|
78
|
+
it { instance.must_respond_to(:title) }
|
79
|
+
it { instance.must_respond_to(:title=) }
|
80
|
+
it { instance.must_respond_to(:top_left) }
|
81
|
+
it { instance.must_respond_to(:top_left=) }
|
82
|
+
it { instance.must_respond_to(:top_right) }
|
83
|
+
it { instance.must_respond_to(:top_right=) }
|
84
|
+
it { instance.must_respond_to(:vertical) }
|
85
|
+
it { instance.must_respond_to(:vertical=) }
|
86
|
+
it { instance.must_respond_to(:name) }
|
87
|
+
it { instance.must_respond_to(:enabled) }
|
88
|
+
it { instance.must_respond_to(:enabled=) }
|
89
|
+
it { instance.must_respond_to(:enabled?) }
|
90
|
+
end
|
91
|
+
|
92
|
+
describe 'border offset methods; bx, bxn, by, byn' do
|
93
|
+
let(:attributes) {
|
94
|
+
{
|
95
|
+
bottom_left: 'C',
|
96
|
+
bottom_right: 'D',
|
97
|
+
enabled: enabled,
|
98
|
+
horizontal: 'H',
|
99
|
+
name: 'Border#bxbxnbybyn',
|
100
|
+
show_top: top,
|
101
|
+
show_bottom: bottom,
|
102
|
+
show_left: left,
|
103
|
+
show_right: right,
|
104
|
+
top_left: 'A',
|
105
|
+
top_right: 'B',
|
106
|
+
vertical: 'V'
|
107
|
+
}
|
108
|
+
}
|
109
|
+
let(:enabled) { false }
|
110
|
+
let(:top) { false }
|
111
|
+
let(:bottom) { false }
|
112
|
+
let(:left) { false }
|
113
|
+
let(:right) { false }
|
114
|
+
let(:geometry) {
|
115
|
+
Vedeu::Geometry::Geometry.new(name: 'Border#bxbxnbybyn',
|
116
|
+
x: 2,
|
117
|
+
xn: 6,
|
118
|
+
y: 2,
|
119
|
+
yn: 6)
|
105
120
|
}
|
106
|
-
}
|
107
|
-
let(:enabled) { false }
|
108
|
-
let(:top) { false }
|
109
|
-
let(:bottom) { false }
|
110
|
-
let(:left) { false }
|
111
|
-
let(:right) { false }
|
112
|
-
let(:geometry) {
|
113
|
-
Vedeu::Geometry.new(name: 'Border#bxbxnbybyn', x: 2, xn: 6, y: 2, yn: 6)
|
114
|
-
}
|
115
121
|
|
116
|
-
|
117
|
-
|
122
|
+
describe '#bx' do
|
123
|
+
subject { instance.bx }
|
118
124
|
|
119
|
-
|
120
|
-
|
125
|
+
context 'when enabled' do
|
126
|
+
let(:enabled) { true }
|
121
127
|
|
122
|
-
|
123
|
-
|
128
|
+
context 'with left' do
|
129
|
+
let(:left) { true }
|
124
130
|
|
125
|
-
|
131
|
+
it { subject.must_equal(3) }
|
132
|
+
end
|
133
|
+
|
134
|
+
context 'without left' do
|
135
|
+
it { subject.must_equal(2) }
|
136
|
+
end
|
126
137
|
end
|
127
138
|
|
128
|
-
context '
|
139
|
+
context 'when not enabled' do
|
129
140
|
it { subject.must_equal(2) }
|
130
141
|
end
|
131
142
|
end
|
132
143
|
|
133
|
-
|
134
|
-
|
135
|
-
end
|
136
|
-
end
|
144
|
+
describe '#bxn' do
|
145
|
+
subject { instance.bxn }
|
137
146
|
|
138
|
-
|
139
|
-
|
147
|
+
context 'when enabled' do
|
148
|
+
let(:enabled) { true }
|
140
149
|
|
141
|
-
|
142
|
-
|
150
|
+
context 'with right' do
|
151
|
+
let(:right) { true }
|
143
152
|
|
144
|
-
|
145
|
-
|
153
|
+
it { subject.must_equal(5) }
|
154
|
+
end
|
146
155
|
|
147
|
-
|
156
|
+
context 'without right' do
|
157
|
+
it { subject.must_equal(6) }
|
158
|
+
end
|
148
159
|
end
|
149
160
|
|
150
|
-
context '
|
161
|
+
context 'when not enabled' do
|
151
162
|
it { subject.must_equal(6) }
|
152
163
|
end
|
153
164
|
end
|
154
165
|
|
155
|
-
|
156
|
-
|
157
|
-
end
|
158
|
-
end
|
166
|
+
describe '#by' do
|
167
|
+
subject { instance.by }
|
159
168
|
|
160
|
-
|
161
|
-
|
169
|
+
context 'when enabled' do
|
170
|
+
let(:enabled) { true }
|
162
171
|
|
163
|
-
|
164
|
-
|
172
|
+
context 'with top' do
|
173
|
+
let(:top) { true }
|
165
174
|
|
166
|
-
|
167
|
-
|
175
|
+
it { subject.must_equal(3) }
|
176
|
+
end
|
168
177
|
|
169
|
-
|
178
|
+
context 'without top' do
|
179
|
+
it { subject.must_equal(2) }
|
180
|
+
end
|
170
181
|
end
|
171
182
|
|
172
|
-
context '
|
183
|
+
context 'when not enabled' do
|
173
184
|
it { subject.must_equal(2) }
|
174
185
|
end
|
175
186
|
end
|
176
187
|
|
177
|
-
|
178
|
-
|
179
|
-
end
|
180
|
-
end
|
188
|
+
describe '#byn' do
|
189
|
+
subject { instance.byn }
|
181
190
|
|
182
|
-
|
183
|
-
|
191
|
+
context 'when enabled' do
|
192
|
+
let(:enabled) { true }
|
184
193
|
|
185
|
-
|
186
|
-
|
194
|
+
context 'with bottom' do
|
195
|
+
let(:bottom) { true }
|
187
196
|
|
188
|
-
|
189
|
-
|
197
|
+
it { subject.must_equal(5) }
|
198
|
+
end
|
190
199
|
|
191
|
-
|
200
|
+
context 'without bottom' do
|
201
|
+
it { subject.must_equal(6) }
|
202
|
+
end
|
192
203
|
end
|
193
204
|
|
194
|
-
context '
|
205
|
+
context 'when not enabled' do
|
195
206
|
it { subject.must_equal(6) }
|
196
207
|
end
|
197
208
|
end
|
198
|
-
|
199
|
-
context 'when not enabled' do
|
200
|
-
it { subject.must_equal(6) }
|
201
|
-
end
|
202
209
|
end
|
203
|
-
end
|
204
210
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
211
|
+
describe '#width' do
|
212
|
+
let(:geometry) {
|
213
|
+
Vedeu::Geometry::Geometry.new(name: 'borders', width: 8)
|
214
|
+
}
|
209
215
|
|
210
|
-
|
216
|
+
subject { instance.width }
|
211
217
|
|
212
|
-
|
213
|
-
|
214
|
-
|
218
|
+
context 'when the border is not enabled' do
|
219
|
+
it 'returns the interface width' do
|
220
|
+
subject.must_equal(8)
|
221
|
+
end
|
215
222
|
end
|
216
|
-
end
|
217
223
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
+
context 'when the border is enabled' do
|
225
|
+
context 'when both left and right borders are shown' do
|
226
|
+
let(:attributes) {
|
227
|
+
{
|
228
|
+
enabled: true,
|
229
|
+
name: 'borders',
|
230
|
+
}
|
224
231
|
}
|
225
|
-
}
|
226
232
|
|
227
|
-
|
228
|
-
|
233
|
+
it { subject.must_equal(6) }
|
234
|
+
end
|
229
235
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
+
context 'when either the left or right border is shown' do
|
237
|
+
let(:attributes) {
|
238
|
+
{
|
239
|
+
enabled: true,
|
240
|
+
name: 'borders',
|
241
|
+
show_left: false
|
242
|
+
}
|
236
243
|
}
|
237
|
-
}
|
238
244
|
|
239
|
-
|
240
|
-
|
245
|
+
it { subject.must_equal(7) }
|
246
|
+
end
|
241
247
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
248
|
+
context 'when neither left nor right borders are shown' do
|
249
|
+
let(:attributes) {
|
250
|
+
{
|
251
|
+
enabled: true,
|
252
|
+
name: 'borders',
|
253
|
+
show_left: false,
|
254
|
+
show_right: false
|
255
|
+
}
|
249
256
|
}
|
250
|
-
}
|
251
257
|
|
252
|
-
|
258
|
+
it { subject.must_equal(8) }
|
259
|
+
end
|
253
260
|
end
|
254
261
|
end
|
255
|
-
end
|
256
262
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
263
|
+
describe '#height' do
|
264
|
+
let(:geometry) {
|
265
|
+
Vedeu::Geometry::Geometry.new(name: 'borders', height: 5)
|
266
|
+
}
|
261
267
|
|
262
|
-
|
268
|
+
subject { instance.height }
|
263
269
|
|
264
|
-
|
265
|
-
|
266
|
-
|
270
|
+
context 'when the border is not enabled' do
|
271
|
+
it 'returns the interface height' do
|
272
|
+
subject.must_equal(5)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
context 'when the border is enabled' do
|
277
|
+
context 'when both top and bottom borders are shown' do
|
278
|
+
let(:attributes) {
|
279
|
+
{
|
280
|
+
enabled: true,
|
281
|
+
name: 'borders',
|
282
|
+
}
|
283
|
+
}
|
284
|
+
|
285
|
+
it { subject.must_equal(3) }
|
286
|
+
end
|
287
|
+
|
288
|
+
context 'when either the top or bottom border is shown' do
|
289
|
+
let(:attributes) {
|
290
|
+
{
|
291
|
+
enabled: true,
|
292
|
+
name: 'borders',
|
293
|
+
show_top: false
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
it { subject.must_equal(4) }
|
298
|
+
end
|
299
|
+
|
300
|
+
context 'when neither top nor bottom borders are shown' do
|
301
|
+
let(:attributes) {
|
302
|
+
{
|
303
|
+
enabled: true,
|
304
|
+
name: 'borders',
|
305
|
+
show_top: false,
|
306
|
+
show_bottom: false
|
307
|
+
}
|
308
|
+
}
|
309
|
+
|
310
|
+
it { subject.must_equal(5) }
|
311
|
+
end
|
267
312
|
end
|
268
313
|
end
|
269
314
|
|
270
|
-
|
271
|
-
|
315
|
+
describe '#enabled?' do
|
316
|
+
subject { instance.enabled? }
|
317
|
+
|
318
|
+
it { subject.must_be_instance_of(FalseClass) }
|
319
|
+
|
320
|
+
context 'when true' do
|
272
321
|
let(:attributes) {
|
273
322
|
{
|
274
323
|
enabled: true,
|
@@ -276,136 +325,95 @@ module Vedeu
|
|
276
325
|
}
|
277
326
|
}
|
278
327
|
|
279
|
-
it { subject.
|
328
|
+
it { subject.must_be_instance_of(TrueClass) }
|
280
329
|
end
|
330
|
+
end
|
281
331
|
|
282
|
-
|
283
|
-
|
284
|
-
{
|
285
|
-
enabled: true,
|
286
|
-
name: 'borders',
|
287
|
-
show_top: false
|
288
|
-
}
|
289
|
-
}
|
332
|
+
describe '#bottom?' do
|
333
|
+
subject { instance.bottom? }
|
290
334
|
|
291
|
-
|
292
|
-
end
|
335
|
+
it { subject.must_be_instance_of(TrueClass) }
|
293
336
|
|
294
|
-
context 'when
|
337
|
+
context 'when false' do
|
295
338
|
let(:attributes) {
|
296
339
|
{
|
297
340
|
enabled: true,
|
298
341
|
name: 'borders',
|
299
|
-
|
300
|
-
show_bottom: false
|
342
|
+
show_bottom: false,
|
301
343
|
}
|
302
344
|
}
|
303
345
|
|
304
|
-
it { subject.
|
346
|
+
it { subject.must_be_instance_of(FalseClass) }
|
305
347
|
end
|
306
348
|
end
|
307
|
-
end
|
308
|
-
|
309
|
-
describe '#enabled?' do
|
310
|
-
subject { instance.enabled? }
|
311
349
|
|
312
|
-
|
313
|
-
|
314
|
-
context 'when true' do
|
315
|
-
let(:attributes) {
|
316
|
-
{
|
317
|
-
enabled: true,
|
318
|
-
name: 'borders',
|
319
|
-
}
|
320
|
-
}
|
350
|
+
describe '#left?' do
|
351
|
+
subject { instance.left? }
|
321
352
|
|
322
353
|
it { subject.must_be_instance_of(TrueClass) }
|
323
|
-
end
|
324
|
-
end
|
325
354
|
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
{
|
334
|
-
enabled: true,
|
335
|
-
name: 'borders',
|
336
|
-
show_bottom: false,
|
355
|
+
context 'when false' do
|
356
|
+
let(:attributes) {
|
357
|
+
{
|
358
|
+
enabled: true,
|
359
|
+
name: 'borders',
|
360
|
+
show_left: false,
|
361
|
+
}
|
337
362
|
}
|
338
|
-
}
|
339
363
|
|
340
|
-
|
364
|
+
it { subject.must_be_instance_of(FalseClass) }
|
365
|
+
end
|
341
366
|
end
|
342
|
-
end
|
343
367
|
|
344
|
-
|
345
|
-
|
368
|
+
describe '#right?' do
|
369
|
+
subject { instance.right? }
|
346
370
|
|
347
|
-
|
371
|
+
it { subject.must_be_instance_of(TrueClass) }
|
348
372
|
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
373
|
+
context 'when false' do
|
374
|
+
let(:attributes) {
|
375
|
+
{
|
376
|
+
enabled: true,
|
377
|
+
name: 'borders',
|
378
|
+
show_right: false,
|
379
|
+
}
|
355
380
|
}
|
356
|
-
}
|
357
381
|
|
358
|
-
|
382
|
+
it { subject.must_be_instance_of(FalseClass) }
|
383
|
+
end
|
359
384
|
end
|
360
|
-
end
|
361
385
|
|
362
|
-
|
363
|
-
|
386
|
+
describe '#top?' do
|
387
|
+
subject { instance.top? }
|
364
388
|
|
365
|
-
|
389
|
+
it { subject.must_be_instance_of(TrueClass) }
|
366
390
|
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
391
|
+
context 'when false' do
|
392
|
+
let(:attributes) {
|
393
|
+
{
|
394
|
+
enabled: true,
|
395
|
+
name: 'borders',
|
396
|
+
show_top: false,
|
397
|
+
}
|
373
398
|
}
|
374
|
-
}
|
375
399
|
|
376
|
-
|
400
|
+
it { subject.must_be_instance_of(FalseClass) }
|
401
|
+
end
|
377
402
|
end
|
378
|
-
end
|
379
403
|
|
380
|
-
|
381
|
-
|
404
|
+
describe '#render' do
|
405
|
+
before { Vedeu::Borders::Render.stubs(:with) }
|
382
406
|
|
383
|
-
|
407
|
+
subject { instance.render }
|
384
408
|
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
enabled: true,
|
389
|
-
name: 'borders',
|
390
|
-
show_top: false,
|
391
|
-
}
|
409
|
+
it {
|
410
|
+
Vedeu::Borders::Render.expects(:with).with(instance)
|
411
|
+
subject
|
392
412
|
}
|
393
|
-
|
394
|
-
it { subject.must_be_instance_of(FalseClass) }
|
395
413
|
end
|
396
|
-
end
|
397
|
-
|
398
|
-
describe '#render' do
|
399
|
-
before { Vedeu::RenderBorder.stubs(:with) }
|
400
414
|
|
401
|
-
|
402
|
-
|
403
|
-
it {
|
404
|
-
Vedeu::RenderBorder.expects(:with).with(instance)
|
405
|
-
subject
|
406
|
-
}
|
407
|
-
end
|
415
|
+
end # Border
|
408
416
|
|
409
|
-
end #
|
417
|
+
end # Borders
|
410
418
|
|
411
419
|
end # Vedeu
|