vedeu 0.4.29 → 0.4.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +57 -38
- data/README.md +10 -110
- data/docs/getting_started.md +9 -0
- data/lib/vedeu/all.rb +1 -1
- data/lib/vedeu/api.rb +6 -5
- data/lib/vedeu/buffers/display_buffer.rb +1 -1
- data/lib/vedeu/configuration/api.rb +1 -1
- data/lib/vedeu/cursor/move.rb +2 -2
- data/lib/vedeu/debug.rb +3 -1
- data/lib/vedeu/dsl/all.rb +15 -9
- data/lib/vedeu/dsl/{components/border.rb → border.rb} +0 -3
- data/lib/vedeu/dsl/composition.rb +33 -0
- data/lib/vedeu/dsl/{components/geometry.rb → geometry.rb} +18 -0
- data/lib/vedeu/dsl/interface.rb +2 -2
- data/lib/vedeu/dsl/{components/keymap.rb → keymap.rb} +2 -4
- data/lib/vedeu/dsl/{components/menu.rb → menu.rb} +0 -0
- data/lib/vedeu/dsl/{shared/presentation.rb → presentation.rb} +0 -0
- data/lib/vedeu/dsl/{shared/text.rb → text.rb} +0 -0
- data/lib/vedeu/dsl/{shared/use.rb → use.rb} +0 -0
- data/lib/vedeu/events/event.rb +11 -53
- data/lib/vedeu/geometry/area.rb +1 -2
- data/lib/vedeu/geometry/coordinate.rb +1 -1
- data/lib/vedeu/geometry/geometry.rb +0 -12
- data/lib/vedeu/geometry/position_validator.rb +1 -1
- data/lib/vedeu/input/keymap.rb +1 -1
- data/lib/vedeu/models/interface.rb +1 -0
- data/lib/vedeu/models/panel.rb +2 -0
- data/lib/vedeu/null/geometry.rb +3 -2
- data/lib/vedeu/output/border.rb +6 -6
- data/lib/vedeu/output/clear.rb +4 -4
- data/lib/vedeu/output/compressor.rb +10 -4
- data/lib/vedeu/output/html_char.rb +4 -4
- data/lib/vedeu/output/refresh.rb +3 -3
- data/lib/vedeu/output/renderers/file.rb +1 -1
- data/lib/vedeu/output/renderers/terminal.rb +2 -2
- data/lib/vedeu/output/renderers/text.rb +1 -1
- data/lib/vedeu/output/style.rb +1 -1
- data/lib/vedeu/output/translator.rb +0 -8
- data/lib/vedeu/output/viewport.rb +1 -1
- data/lib/vedeu/repositories/all.rb +1 -1
- data/lib/vedeu/repositories/repository.rb +1 -1
- data/lib/vedeu/support/common.rb +1 -1
- data/lib/vedeu/support/template.rb +1 -1
- data/lib/vedeu/support/timer.rb +11 -14
- data/lib/vedeu/templating/all.rb +9 -0
- data/lib/vedeu/templating/helpers.rb +9 -3
- data/lib/vedeu/templating/preprocessor.rb +4 -1
- data/lib/vedeu/version.rb +3 -0
- data/test/lib/vedeu/api_test.rb +38 -297
- data/test/lib/vedeu/buffers/display_buffer_test.rb +1 -0
- data/test/lib/vedeu/dsl/{components/border_test.rb → border_test.rb} +0 -0
- data/test/lib/vedeu/dsl/{components/geometry_test.rb → geometry_test.rb} +0 -0
- data/test/lib/vedeu/dsl/{components/keymap_test.rb → keymap_test.rb} +0 -0
- data/test/lib/vedeu/dsl/{components/menu_test.rb → menu_test.rb} +0 -0
- data/test/lib/vedeu/dsl/{shared/presentation_test.rb → presentation_test.rb} +0 -0
- data/test/lib/vedeu/dsl/{shared/text_test.rb → text_test.rb} +0 -0
- data/test/lib/vedeu/dsl/{shared/use_test.rb → use_test.rb} +0 -0
- data/test/lib/vedeu/dsl/view_test.rb +2 -0
- data/test/lib/vedeu/main_loop_test.rb +0 -3
- data/test/lib/vedeu/output/background_test.rb +18 -22
- data/test/lib/vedeu/output/compressor_test.rb +4 -0
- data/test/lib/vedeu/output/foreground_test.rb +13 -17
- data/test/lib/vedeu/repositories/repositories/borders_test.rb +2 -1
- data/test/lib/vedeu/repositories/repositories/buffers_test.rb +5 -1
- data/test/lib/vedeu/repositories/repositories/geometries_test.rb +2 -0
- data/test/lib/vedeu/support/common_test.rb +2 -2
- data/test/lib/vedeu/support/timer_test.rb +4 -6
- data/test/test_helper.rb +22 -0
- data/vedeu.gemspec +3 -1
- metadata +24 -25
- data/lib/vedeu/dsl/components/all.rb +0 -4
- data/lib/vedeu/dsl/shared/all.rb +0 -3
data/test/lib/vedeu/api_test.rb
CHANGED
@@ -4,303 +4,44 @@ module Vedeu
|
|
4
4
|
|
5
5
|
describe API do
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
describe 'Vedeu::Cursors' do
|
48
|
-
describe '.cursor' do
|
49
|
-
subject { Vedeu.cursor }
|
50
|
-
|
51
|
-
# when all tests run
|
52
|
-
# it { subject.must_be_instance_of(Vedeu::Cursor) }
|
53
|
-
|
54
|
-
# when just this test runs
|
55
|
-
# it { subject.must_be_instance_of(NilClass) }
|
56
|
-
end
|
57
|
-
|
58
|
-
describe '.cursors' do
|
59
|
-
subject { Vedeu.cursors }
|
60
|
-
|
61
|
-
it { subject.must_be_instance_of(Vedeu::Cursors) }
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe 'Vedeu::DSL::Border' do
|
66
|
-
describe '.border' do
|
67
|
-
let(:arg) {}
|
68
|
-
|
69
|
-
subject { Vedeu.border(arg) {} }
|
70
|
-
|
71
|
-
# it { subject.must_be_instance_of(NilClass) }
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe 'Vedeu::DSL::Geometry' do
|
76
|
-
describe '.geometry' do
|
77
|
-
let(:arg) {}
|
78
|
-
|
79
|
-
subject { Vedeu.geometry(arg) { } }
|
80
|
-
|
81
|
-
# it { subject.must_be_instance_of(NilClass) }
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe 'Vedeu::DSL::Group' do
|
86
|
-
describe '.group' do
|
87
|
-
let(:arg) {}
|
88
|
-
|
89
|
-
subject { Vedeu.group(arg) { } }
|
90
|
-
|
91
|
-
# it { subject.must_be_instance_of(NilClass) }
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe 'Vedeu::DSL::Keymap' do
|
96
|
-
describe '.keymap' do
|
97
|
-
let(:arg) {}
|
98
|
-
|
99
|
-
subject { Vedeu.keymap(arg) }
|
100
|
-
|
101
|
-
# it { subject.must_be_instance_of(NilClass) }
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
describe 'Vedeu::DSL::View' do
|
106
|
-
describe '.interface' do
|
107
|
-
subject { Vedeu.interface { } }
|
108
|
-
|
109
|
-
# it { subject.must_be_instance_of(NilClass) }
|
110
|
-
end
|
111
|
-
|
112
|
-
describe '.renders' do
|
113
|
-
subject { Vedeu.renders { } }
|
114
|
-
|
115
|
-
# it { subject.must_be_instance_of(Array) }
|
116
|
-
end
|
117
|
-
|
118
|
-
describe '.views' do
|
119
|
-
subject { Vedeu.views { } }
|
120
|
-
|
121
|
-
# it { subject.must_be_instance_of(Array) }
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
describe 'Vedeu::Event' do
|
126
|
-
describe '.bind' do
|
127
|
-
let(:args) {}
|
128
|
-
|
129
|
-
subject { Vedeu.bind(args) }
|
130
|
-
|
131
|
-
# it { subject.must_be_instance_of(NilClass) }
|
132
|
-
end
|
133
|
-
|
134
|
-
describe '.unbind' do
|
135
|
-
let(:args) {}
|
136
|
-
|
137
|
-
subject { Vedeu.unbind(args) }
|
138
|
-
|
139
|
-
# it { subject.must_be_instance_of(FalseClass) }
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe 'Vedeu::EventsRepository' do
|
144
|
-
describe '.events' do
|
145
|
-
subject { Vedeu.events }
|
146
|
-
|
147
|
-
it { subject.must_be_instance_of(Vedeu::EventsRepository) }
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
describe 'Vedeu::Focus' do
|
152
|
-
describe '.focus' do
|
153
|
-
subject { Vedeu.focus }
|
154
|
-
|
155
|
-
# it { subject.must_be_instance_of(NilClass) }
|
156
|
-
end
|
157
|
-
|
158
|
-
describe '.focus_by_name' do
|
159
|
-
let(:_name) {}
|
160
|
-
|
161
|
-
subject { Vedeu.focus_by_name(_name) }
|
162
|
-
|
163
|
-
# it { subject.must_be_instance_of(NilClass) }
|
164
|
-
end
|
165
|
-
|
166
|
-
describe '.focussed?' do
|
167
|
-
let(:arg) {}
|
168
|
-
|
169
|
-
subject { Vedeu.focussed?(arg) }
|
170
|
-
|
171
|
-
# it { subject.must_be_instance_of(TrueClass) }
|
172
|
-
end
|
173
|
-
|
174
|
-
describe '.focus_next' do
|
175
|
-
subject { Vedeu.focus_next }
|
176
|
-
|
177
|
-
# it { subject.must_be_instance_of(FalseClass) }
|
178
|
-
end
|
179
|
-
|
180
|
-
describe '.focus_previous' do
|
181
|
-
subject { Vedeu.focus_previous }
|
182
|
-
|
183
|
-
# it { subject.must_be_instance_of(FalseClass) }
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
describe 'Vedeu::ForegroundColours' do
|
188
|
-
describe '.foreground_colours' do
|
189
|
-
subject { Vedeu.foreground_colours }
|
190
|
-
|
191
|
-
# it { subject.must_be_instance_of(Vedeu::ForegroundColours) }
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
describe 'Vedeu::Geometries' do
|
196
|
-
describe '.geometries' do
|
197
|
-
subject { Vedeu.geometries }
|
198
|
-
|
199
|
-
it { subject.must_be_instance_of(Vedeu::Geometries) }
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
describe 'Vedeu::Groups' do
|
204
|
-
describe '.groups' do
|
205
|
-
subject { Vedeu.groups }
|
206
|
-
|
207
|
-
it { subject.must_be_instance_of(Vedeu::Groups) }
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
describe 'Vedeu::InterfacesRepository' do
|
212
|
-
describe '.interfaces' do
|
213
|
-
subject { Vedeu.interfaces }
|
214
|
-
|
215
|
-
it { subject.must_be_instance_of(Vedeu::InterfacesRepository) }
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
describe 'Vedeu::Keymaps' do
|
220
|
-
describe '.keymaps' do
|
221
|
-
subject { Vedeu.keymaps }
|
222
|
-
|
223
|
-
it { subject.must_be_instance_of(Vedeu::Keymaps) }
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
describe 'Vedeu::Log' do
|
228
|
-
describe '.log' do
|
229
|
-
subject { Vedeu.log(message: '') }
|
230
|
-
|
231
|
-
# it { subject.must_be_instance_of(NilClass) }
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
describe 'Vedeu::Mapper' do
|
236
|
-
describe '.keypress' do
|
237
|
-
subject { Vedeu.keypress }
|
238
|
-
|
239
|
-
# it { subject.must_be_instance_of(FalseClass) }
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
describe 'Vedeu::Menu' do
|
244
|
-
describe '.menu' do
|
245
|
-
subject { Vedeu.menu { } }
|
246
|
-
|
247
|
-
# it { subject.must_be_instance_of(NilClass) }
|
248
|
-
end
|
249
|
-
end
|
250
|
-
|
251
|
-
describe 'Vedeu::Menus' do
|
252
|
-
describe '.menus' do
|
253
|
-
subject { Vedeu.menus }
|
254
|
-
|
255
|
-
it { subject.must_be_instance_of(Vedeu::Menus) }
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
describe 'Vedeu::Renderers' do
|
260
|
-
describe '.renderer' do
|
261
|
-
subject { Vedeu.renderer }
|
262
|
-
|
263
|
-
# it { subject.must_be_instance_of(Set) }
|
264
|
-
end
|
265
|
-
|
266
|
-
describe '.renderers' do
|
267
|
-
subject { Vedeu.renderers }
|
268
|
-
|
269
|
-
# it { subject.must_be_instance_of(Module) }
|
270
|
-
end
|
271
|
-
end
|
272
|
-
|
273
|
-
describe 'Vedeu::Terminal' do
|
274
|
-
describe '.height' do
|
275
|
-
subject { Vedeu.height }
|
276
|
-
|
277
|
-
# it { subject.must_be_instance_of(Fixnum) }
|
278
|
-
end
|
279
|
-
|
280
|
-
describe '.width' do
|
281
|
-
subject { Vedeu.width }
|
282
|
-
|
283
|
-
# it { subject.must_be_instance_of(Fixnum) }
|
284
|
-
end
|
285
|
-
|
286
|
-
describe '.resize' do
|
287
|
-
subject { Vedeu.resize }
|
288
|
-
|
289
|
-
# it { subject.must_be_instance_of(TrueClass) }
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
|
-
describe 'Vedeu::Trigger' do
|
294
|
-
describe '.trigger' do
|
295
|
-
let(:args) {}
|
296
|
-
|
297
|
-
subject { Vedeu.trigger(args) }
|
298
|
-
|
299
|
-
# it { subject.must_be_instance_of(Array) }
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
|
-
end
|
7
|
+
it { Vedeu.must_respond_to(:background_colours) }
|
8
|
+
it { Vedeu.must_respond_to(:borders) }
|
9
|
+
it { Vedeu.must_respond_to(:buffers) }
|
10
|
+
it { Vedeu.must_respond_to(:configure) }
|
11
|
+
it { Vedeu.must_respond_to(:configuration) }
|
12
|
+
it { Vedeu.must_respond_to(:cursor) }
|
13
|
+
it { Vedeu.must_respond_to(:cursors) }
|
14
|
+
it { Vedeu.must_respond_to(:border) }
|
15
|
+
it { Vedeu.must_respond_to(:geometry) }
|
16
|
+
it { Vedeu.must_respond_to(:group) }
|
17
|
+
it { Vedeu.must_respond_to(:keymap) }
|
18
|
+
it { Vedeu.must_respond_to(:interface) }
|
19
|
+
it { Vedeu.must_respond_to(:renders) }
|
20
|
+
it { Vedeu.must_respond_to(:views) }
|
21
|
+
it { Vedeu.must_respond_to(:bind) }
|
22
|
+
it { Vedeu.must_respond_to(:unbind) }
|
23
|
+
it { Vedeu.must_respond_to(:events) }
|
24
|
+
it { Vedeu.must_respond_to(:focus) }
|
25
|
+
it { Vedeu.must_respond_to(:focus_by_name) }
|
26
|
+
it { Vedeu.must_respond_to(:focussed?) }
|
27
|
+
it { Vedeu.must_respond_to(:focus_next) }
|
28
|
+
it { Vedeu.must_respond_to(:focus_previous) }
|
29
|
+
it { Vedeu.must_respond_to(:foreground_colours) }
|
30
|
+
it { Vedeu.must_respond_to(:geometries) }
|
31
|
+
it { Vedeu.must_respond_to(:groups) }
|
32
|
+
it { Vedeu.must_respond_to(:interfaces) }
|
33
|
+
it { Vedeu.must_respond_to(:keymaps) }
|
34
|
+
it { Vedeu.must_respond_to(:log) }
|
35
|
+
it { Vedeu.must_respond_to(:keypress) }
|
36
|
+
it { Vedeu.must_respond_to(:menu) }
|
37
|
+
it { Vedeu.must_respond_to(:menus) }
|
38
|
+
it { Vedeu.must_respond_to(:renderer) }
|
39
|
+
it { Vedeu.must_respond_to(:renderers) }
|
40
|
+
it { Vedeu.must_respond_to(:height) }
|
41
|
+
it { Vedeu.must_respond_to(:width) }
|
42
|
+
it { Vedeu.must_respond_to(:resize) }
|
43
|
+
it { Vedeu.must_respond_to(:timer) }
|
44
|
+
it { Vedeu.must_respond_to(:trigger) }
|
304
45
|
|
305
46
|
end # API
|
306
47
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -10,14 +10,16 @@ module Vedeu
|
|
10
10
|
|
11
11
|
before { Vedeu.background_colours.reset! }
|
12
12
|
|
13
|
-
describe '
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
describe '#escape_sequence' do
|
14
|
+
subject { instance.escape_sequence }
|
15
|
+
|
16
|
+
context 'when the colour is empty' do
|
17
|
+
let(:colour) { '' }
|
18
|
+
|
19
|
+
it { subject.must_equal('') }
|
18
20
|
end
|
19
21
|
|
20
|
-
|
22
|
+
context 'when the colour is named (3-bit / 8 colours)' do
|
21
23
|
{
|
22
24
|
red: "\e[41m",
|
23
25
|
yellow: "\e[43m",
|
@@ -27,12 +29,12 @@ module Vedeu
|
|
27
29
|
unknown: '',
|
28
30
|
}.map do |colour, result|
|
29
31
|
it "returns the correct escape sequence for #{colour}" do
|
30
|
-
|
32
|
+
described.new(colour).escape_sequence.must_equal(result)
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
35
|
-
|
37
|
+
context 'when the colour is numbered (8-bit / 256 colours)' do
|
36
38
|
{
|
37
39
|
24 => "\e[48;5;24m",
|
38
40
|
56 => "\e[48;5;56m",
|
@@ -44,12 +46,12 @@ module Vedeu
|
|
44
46
|
442 => ''
|
45
47
|
}.map do |colour, result|
|
46
48
|
it "returns the correct escape sequence for #{colour}" do
|
47
|
-
|
49
|
+
described.new(colour).escape_sequence.must_equal(result)
|
48
50
|
end
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
52
|
-
|
54
|
+
context 'when the colour is a CSS value (8-bit / 256 colours)' do
|
53
55
|
before { Configuration.stubs(:colour_mode).returns(8) }
|
54
56
|
|
55
57
|
{
|
@@ -64,12 +66,12 @@ module Vedeu
|
|
64
66
|
'#h11111' => '',
|
65
67
|
}.map do |colour, result|
|
66
68
|
it "returns the correct escape sequence for #{colour}" do
|
67
|
-
|
69
|
+
described.new(colour).escape_sequence.must_equal(result)
|
68
70
|
end
|
69
71
|
end
|
70
72
|
end
|
71
73
|
|
72
|
-
|
74
|
+
context 'when the colour is a CSS value (24-bit / 16.8mil colours)' do
|
73
75
|
{
|
74
76
|
'#5f0000' => "\e[48;2;95;0;0m",
|
75
77
|
'#008700' => "\e[48;2;0;135;0m",
|
@@ -82,7 +84,7 @@ module Vedeu
|
|
82
84
|
'#h11111' => '',
|
83
85
|
}.map do |colour, result|
|
84
86
|
it "returns the correct escape sequence for #{colour}" do
|
85
|
-
|
87
|
+
described.new(colour).escape_sequence.must_equal(result)
|
86
88
|
end
|
87
89
|
end
|
88
90
|
end
|
@@ -94,25 +96,19 @@ module Vedeu
|
|
94
96
|
context 'when the colour is empty' do
|
95
97
|
let(:colour) {}
|
96
98
|
|
97
|
-
it
|
98
|
-
subject.must_equal('')
|
99
|
-
end
|
99
|
+
it { subject.must_equal('') }
|
100
100
|
end
|
101
101
|
|
102
102
|
context 'when the colour is named (3-bit / 8 colours)' do
|
103
103
|
let(:colour) { :red }
|
104
104
|
|
105
|
-
it
|
106
|
-
subject.must_equal('')
|
107
|
-
end
|
105
|
+
it { subject.must_equal('') }
|
108
106
|
end
|
109
107
|
|
110
108
|
context 'when the colour is numbered (8-bit / 256 colours)' do
|
111
109
|
let(:colour) { 118 }
|
112
110
|
|
113
|
-
it
|
114
|
-
subject.must_equal('')
|
115
|
-
end
|
111
|
+
it { subject.must_equal('') }
|
116
112
|
end
|
117
113
|
|
118
114
|
context 'when the colour is a CSS value' do
|
@@ -10,11 +10,13 @@ module Vedeu
|
|
10
10
|
|
11
11
|
before { Vedeu.foreground_colours.reset! }
|
12
12
|
|
13
|
-
describe '
|
13
|
+
describe '#escape_sequence' do
|
14
|
+
subject { instance.escape_sequence }
|
15
|
+
|
14
16
|
context 'when the colour is empty' do
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
let(:colour) { '' }
|
18
|
+
|
19
|
+
it { subject.must_equal('') }
|
18
20
|
end
|
19
21
|
|
20
22
|
context 'when the colour is named (3-bit / 8 colours)' do
|
@@ -27,7 +29,7 @@ module Vedeu
|
|
27
29
|
unknown: '',
|
28
30
|
}.map do |colour, result|
|
29
31
|
it "returns the correct escape sequence for #{colour}" do
|
30
|
-
|
32
|
+
described.new(colour).escape_sequence.must_equal(result)
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
@@ -44,7 +46,7 @@ module Vedeu
|
|
44
46
|
442 => ''
|
45
47
|
}.map do |colour, result|
|
46
48
|
it "returns the correct escape sequence for #{colour}" do
|
47
|
-
|
49
|
+
described.new(colour).escape_sequence.must_equal(result)
|
48
50
|
end
|
49
51
|
end
|
50
52
|
end
|
@@ -64,7 +66,7 @@ module Vedeu
|
|
64
66
|
'#h11111' => '',
|
65
67
|
}.map do |colour, result|
|
66
68
|
it "returns the correct escape sequence for #{colour}" do
|
67
|
-
|
69
|
+
described.new(colour).escape_sequence.must_equal(result)
|
68
70
|
end
|
69
71
|
end
|
70
72
|
end
|
@@ -82,7 +84,7 @@ module Vedeu
|
|
82
84
|
'#h11111' => '',
|
83
85
|
}.map do |colour, result|
|
84
86
|
it "returns the correct escape sequence for #{colour}" do
|
85
|
-
|
87
|
+
described.new(colour).escape_sequence.must_equal(result)
|
86
88
|
end
|
87
89
|
end
|
88
90
|
end
|
@@ -94,25 +96,19 @@ module Vedeu
|
|
94
96
|
context 'when the colour is empty' do
|
95
97
|
let(:colour) {}
|
96
98
|
|
97
|
-
it
|
98
|
-
subject.must_equal('')
|
99
|
-
end
|
99
|
+
it { subject.must_equal('') }
|
100
100
|
end
|
101
101
|
|
102
102
|
context 'when the colour is named (3-bit / 8 colours)' do
|
103
103
|
let(:colour) { :red }
|
104
104
|
|
105
|
-
it
|
106
|
-
subject.must_equal('')
|
107
|
-
end
|
105
|
+
it { subject.must_equal('') }
|
108
106
|
end
|
109
107
|
|
110
108
|
context 'when the colour is numbered (8-bit / 256 colours)' do
|
111
109
|
let(:colour) { 118 }
|
112
110
|
|
113
|
-
it
|
114
|
-
subject.must_equal('')
|
115
|
-
end
|
111
|
+
it { subject.must_equal('') }
|
116
112
|
end
|
117
113
|
|
118
114
|
context 'when the colour is a CSS value' do
|
@@ -6,6 +6,8 @@ module Vedeu
|
|
6
6
|
|
7
7
|
let(:described) { Vedeu::Borders }
|
8
8
|
|
9
|
+
after { Vedeu.borders.reset }
|
10
|
+
|
9
11
|
describe '#by_name' do
|
10
12
|
let(:_name) { 'carbon' }
|
11
13
|
|
@@ -16,7 +18,6 @@ module Vedeu
|
|
16
18
|
Vedeu.border 'carbon' do
|
17
19
|
end
|
18
20
|
end
|
19
|
-
after { Vedeu.borders.reset }
|
20
21
|
|
21
22
|
it { subject.must_be_instance_of(Vedeu::Border) }
|
22
23
|
end
|
@@ -7,6 +7,11 @@ module Vedeu
|
|
7
7
|
let(:described) { Vedeu::Buffers }
|
8
8
|
let(:instance) { described.buffers }
|
9
9
|
|
10
|
+
after do
|
11
|
+
Vedeu.buffers.reset
|
12
|
+
Vedeu.interfaces.reset
|
13
|
+
end
|
14
|
+
|
10
15
|
describe '#by_name' do
|
11
16
|
let(:_name) { 'carbon' }
|
12
17
|
|
@@ -17,7 +22,6 @@ module Vedeu
|
|
17
22
|
Vedeu.interface 'carbon' do
|
18
23
|
end
|
19
24
|
end
|
20
|
-
after { Vedeu.buffers.reset }
|
21
25
|
|
22
26
|
it { subject.must_be_instance_of(Vedeu::Buffer) }
|
23
27
|
end
|
@@ -7,7 +7,7 @@ module Vedeu
|
|
7
7
|
include Vedeu::Common
|
8
8
|
|
9
9
|
def defined_value_test(variable)
|
10
|
-
|
10
|
+
present?(variable)
|
11
11
|
end
|
12
12
|
|
13
13
|
end # VedeuCommonClass
|
@@ -16,7 +16,7 @@ module Vedeu
|
|
16
16
|
|
17
17
|
let(:described) { Vedeu::VedeuCommonClass.new }
|
18
18
|
|
19
|
-
describe '#
|
19
|
+
describe '#present?' do
|
20
20
|
subject { described.defined_value_test(_value) }
|
21
21
|
|
22
22
|
context 'when the variable is a Fixnum' do
|
@@ -5,8 +5,7 @@ module Vedeu
|
|
5
5
|
describe Timer do
|
6
6
|
|
7
7
|
let(:described) { Vedeu::Timer }
|
8
|
-
let(:instance) { described.new(
|
9
|
-
let(:type) { :debug }
|
8
|
+
let(:instance) { described.new(_message) }
|
10
9
|
let(:_message) { 'Testing' }
|
11
10
|
let(:_time) { mock('Time') }
|
12
11
|
let(:started) { 1434492219.5238185 }
|
@@ -18,20 +17,19 @@ module Vedeu
|
|
18
17
|
|
19
18
|
describe '#initialize' do
|
20
19
|
it { instance.must_be_instance_of(described) }
|
21
|
-
it { instance.instance_variable_get('@type').must_equal(type) }
|
22
20
|
it { instance.instance_variable_get('@message').must_equal(_message) }
|
23
21
|
it { instance.instance_variable_get('@started').must_equal(started) }
|
24
22
|
end
|
25
23
|
|
26
|
-
describe '.
|
27
|
-
it { described.must_respond_to(:
|
24
|
+
describe '.timer' do
|
25
|
+
it { described.must_respond_to(:timer) }
|
28
26
|
end
|
29
27
|
|
30
28
|
describe '#measure' do
|
31
29
|
subject { instance.measure { } }
|
32
30
|
|
33
31
|
it {
|
34
|
-
Vedeu.expects(:log).with(type:
|
32
|
+
Vedeu.expects(:log).with(type: :timer,
|
35
33
|
message: "Testing took 0ms.")
|
36
34
|
subject
|
37
35
|
}
|