vedeu 0.4.41 → 0.4.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -6
- data/bin/vedeu +1 -50
- data/docs/applications.md +18 -2
- data/lib/vedeu/all.rb +3 -1
- data/lib/vedeu/api.rb +3 -1
- data/lib/vedeu/application/controller.rb +5 -0
- data/lib/vedeu/buffers/buffer.rb +6 -3
- data/lib/vedeu/cli/all.rb +1 -0
- data/lib/vedeu/{generator → cli/generator}/all.rb +3 -3
- data/lib/vedeu/{generator → cli/generator}/application.rb +0 -0
- data/lib/vedeu/{generator → cli/generator}/helpers.rb +4 -11
- data/lib/vedeu/{generator → cli/generator}/templates/application/Gemfile +0 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/app/controllers/application_controller.erb +0 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/app/controllers/name.erb +2 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/app/helpers/application_helper.erb +0 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/app/helpers/name.erb +0 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/app/models/keymaps/_global_.rb +0 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/app/models/keymaps/name.erb +0 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/app/views/interfaces/name.erb +6 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/app/views/name.erb +0 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/app/views/templates/name.erb +0 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/application.erb +0 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/bin/name +0 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/config/app_name.erb +0 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/config/configuration.erb +0 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/lib/.gitkeep +0 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/test/.gitkeep +0 -0
- data/lib/vedeu/{generator → cli/generator}/templates/application/vendor/.gitkeep +0 -0
- data/lib/vedeu/{generator → cli/generator}/view.rb +1 -2
- data/lib/vedeu/cli/main.rb +29 -0
- data/lib/vedeu/dsl/presentation.rb +6 -2
- data/lib/vedeu/dsl/view.rb +2 -1
- data/lib/vedeu/geometry/area.rb +4 -4
- data/lib/vedeu/models/interface.rb +0 -3
- data/lib/vedeu/output/colour.rb +16 -35
- data/lib/vedeu/output/presentation.rb +34 -21
- data/lib/vedeu/output/translator.rb +2 -5
- data/lib/vedeu/repositories/model.rb +4 -13
- data/lib/vedeu/support/common.rb +30 -0
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu.rb +2 -0
- data/test/lib/vedeu/application/application_view_test.rb +2 -4
- data/test/lib/vedeu/application/controller_test.rb +26 -0
- data/test/lib/vedeu/application/helper_test.rb +26 -0
- data/test/lib/vedeu/application/view_test.rb +26 -0
- data/test/lib/vedeu/application_test.rb +2 -4
- data/test/lib/vedeu/bootstrap_test.rb +3 -5
- data/test/lib/vedeu/{generator → cli/generator}/application_test.rb +0 -0
- data/test/lib/vedeu/{generator → cli/generator}/helpers_test.rb +1 -9
- data/test/lib/vedeu/{generator → cli/generator}/view_test.rb +0 -0
- data/test/lib/vedeu/cli/main_test.rb +12 -0
- data/test/lib/vedeu/cursor/reposition_test.rb +0 -2
- data/test/lib/vedeu/distributed/subprocess_test.rb +3 -5
- data/test/lib/vedeu/distributed/uri_test.rb +3 -5
- data/test/lib/vedeu/dsl/border_test.rb +0 -17
- data/test/lib/vedeu/dsl/composition_test.rb +0 -8
- data/test/lib/vedeu/dsl/presentation_test.rb +34 -22
- data/test/lib/vedeu/dsl/view_test.rb +1 -0
- data/test/lib/vedeu/events/trigger_test.rb +4 -6
- data/test/lib/vedeu/geometry/geometry_test.rb +15 -14
- data/test/lib/vedeu/models/composition_test.rb +2 -4
- data/test/lib/vedeu/models/focus_test.rb +5 -2
- data/test/lib/vedeu/models/group_test.rb +5 -7
- data/test/lib/vedeu/models/interface_test.rb +12 -16
- data/test/lib/vedeu/models/menu_test.rb +8 -8
- data/test/lib/vedeu/output/border_test.rb +20 -21
- data/test/lib/vedeu/output/colour_test.rb +41 -122
- data/test/lib/vedeu/output/presentation_test.rb +30 -27
- data/test/lib/vedeu/output/translator_test.rb +12 -1
- data/test/lib/vedeu/support/common_test.rb +17 -2
- data/test/test_helper.rb +3 -1
- data/vedeu.gemspec +2 -1
- metadata +53 -31
- data/lib/vedeu/tasks/application.rake +0 -28
- data/lib/vedeu/tasks/vedeu.rake +0 -5
|
@@ -38,15 +38,15 @@ module Vedeu
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
describe '#initialize' do
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
it {
|
|
46
|
-
it {
|
|
47
|
-
it {
|
|
41
|
+
it { instance.must_be_instance_of(described) }
|
|
42
|
+
it {
|
|
43
|
+
instance.instance_variable_get('@collection').must_equal(collection)
|
|
44
|
+
}
|
|
45
|
+
it { instance.instance_variable_get('@name').must_equal('elements') }
|
|
46
|
+
it { instance.instance_variable_get('@current').must_equal(0) }
|
|
47
|
+
it { instance.instance_variable_get('@selected').must_equal(nil) }
|
|
48
48
|
it do
|
|
49
|
-
|
|
49
|
+
instance.instance_variable_get('@repository').must_equal(Vedeu.menus)
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -12,27 +12,6 @@ module Vedeu
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
before do
|
|
16
|
-
Vedeu.interface 'borders' do
|
|
17
|
-
geometry do
|
|
18
|
-
height 5
|
|
19
|
-
width 8
|
|
20
|
-
end
|
|
21
|
-
lines do
|
|
22
|
-
line 'Beryllium'
|
|
23
|
-
line 'Magnesium'
|
|
24
|
-
line 'Plutonium'
|
|
25
|
-
line 'Potassium'
|
|
26
|
-
line 'Lanthanum'
|
|
27
|
-
line 'Strontium'
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
after do
|
|
32
|
-
Vedeu.interfaces.reset
|
|
33
|
-
Vedeu.borders.reset
|
|
34
|
-
end
|
|
35
|
-
|
|
36
15
|
describe '.build' do
|
|
37
16
|
subject {
|
|
38
17
|
described.build(attributes) do
|
|
@@ -145,6 +124,7 @@ module Vedeu
|
|
|
145
124
|
end
|
|
146
125
|
end
|
|
147
126
|
end
|
|
127
|
+
after { Vedeu.interfaces.reset }
|
|
148
128
|
|
|
149
129
|
describe '#bx' do
|
|
150
130
|
subject { instance.bx }
|
|
@@ -236,6 +216,15 @@ module Vedeu
|
|
|
236
216
|
end
|
|
237
217
|
|
|
238
218
|
describe '#width' do
|
|
219
|
+
before do
|
|
220
|
+
Vedeu.interface 'borders' do
|
|
221
|
+
geometry do
|
|
222
|
+
width 8
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
after { Vedeu.interfaces.reset }
|
|
227
|
+
|
|
239
228
|
subject { instance.width }
|
|
240
229
|
|
|
241
230
|
context 'when the border is not enabled' do
|
|
@@ -284,6 +273,15 @@ module Vedeu
|
|
|
284
273
|
end
|
|
285
274
|
|
|
286
275
|
describe '#height' do
|
|
276
|
+
before do
|
|
277
|
+
Vedeu.interface 'borders' do
|
|
278
|
+
geometry do
|
|
279
|
+
height 5
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
after { Vedeu.interfaces.reset }
|
|
284
|
+
|
|
287
285
|
subject { instance.height }
|
|
288
286
|
|
|
289
287
|
context 'when the border is not enabled' do
|
|
@@ -455,6 +453,7 @@ module Vedeu
|
|
|
455
453
|
visible(visibility)
|
|
456
454
|
end
|
|
457
455
|
end
|
|
456
|
+
after { Vedeu.interfaces.reset }
|
|
458
457
|
|
|
459
458
|
subject { instance.render }
|
|
460
459
|
|
|
@@ -8,16 +8,23 @@ module Vedeu
|
|
|
8
8
|
let(:instance) { described.new(attributes) }
|
|
9
9
|
let(:attributes) {
|
|
10
10
|
{
|
|
11
|
-
background:
|
|
12
|
-
foreground:
|
|
11
|
+
background: background,
|
|
12
|
+
foreground: foreground,
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
let(:background) {}
|
|
16
|
+
let(:foreground) {}
|
|
15
17
|
|
|
16
18
|
describe '#initialize' do
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
it { instance.must_be_instance_of(described) }
|
|
20
|
+
it {
|
|
21
|
+
instance.instance_variable_get('@background').
|
|
22
|
+
must_be_instance_of(Vedeu::Background)
|
|
23
|
+
}
|
|
24
|
+
it {
|
|
25
|
+
instance.instance_variable_get('@foreground').
|
|
26
|
+
must_be_instance_of(Vedeu::Foreground)
|
|
27
|
+
}
|
|
21
28
|
end
|
|
22
29
|
|
|
23
30
|
describe '.coerce' do
|
|
@@ -28,41 +35,33 @@ module Vedeu
|
|
|
28
35
|
it { subject.must_be_instance_of(described) }
|
|
29
36
|
|
|
30
37
|
context 'when the value is nil' do
|
|
31
|
-
it { subject.
|
|
32
|
-
it { subject.
|
|
38
|
+
it { subject.foreground.colour.must_equal('') }
|
|
39
|
+
it { subject.background.colour.must_equal('') }
|
|
33
40
|
end
|
|
34
41
|
|
|
35
42
|
context 'when the value is a Vedeu::Colour' do
|
|
36
|
-
let(:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
let(:_value) { Vedeu::Colour.new(attributes) }
|
|
43
|
-
|
|
44
|
-
it { subject.must_be_instance_of(described) }
|
|
45
|
-
it { subject.attributes.must_equal(attributes) }
|
|
43
|
+
let(:background) { '#ff00ff' }
|
|
44
|
+
let(:foreground) { '#220022' }
|
|
45
|
+
let(:_value) { Vedeu::Colour.new(attributes) }
|
|
46
|
+
|
|
47
|
+
it { subject.foreground.colour.must_equal('#220022') }
|
|
48
|
+
it { subject.background.colour.must_equal('#ff00ff') }
|
|
46
49
|
it { subject.to_s.must_equal("\e[38;2;34;0;34m\e[48;2;255;0;255m") }
|
|
47
50
|
end
|
|
48
51
|
|
|
49
52
|
context 'when the value is a Hash' do
|
|
50
53
|
context 'when the hash has a :colour defined' do
|
|
51
54
|
context 'when the value of :colour is a Vedeu::Colour' do
|
|
52
|
-
let(:
|
|
53
|
-
|
|
54
|
-
background: '#002200',
|
|
55
|
-
foreground: '#00ff00',
|
|
56
|
-
}
|
|
57
|
-
}
|
|
55
|
+
let(:background) { '#002200' }
|
|
56
|
+
let(:foreground) { '#00ff00' }
|
|
58
57
|
let(:_value) {
|
|
59
58
|
{
|
|
60
59
|
colour: Vedeu::Colour.new(attributes),
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
it { subject.
|
|
65
|
-
it { subject.
|
|
63
|
+
it { subject.foreground.colour.must_equal('#00ff00') }
|
|
64
|
+
it { subject.background.colour.must_equal('#002200') }
|
|
66
65
|
it { subject.to_s.must_equal("\e[38;2;0;255;0m\e[48;2;0;34;0m") }
|
|
67
66
|
end
|
|
68
67
|
|
|
@@ -76,11 +75,8 @@ module Vedeu
|
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
|
|
79
|
-
it { subject.
|
|
80
|
-
it { subject.
|
|
81
|
-
background: '#7700ff',
|
|
82
|
-
foreground: '',
|
|
83
|
-
}) }
|
|
78
|
+
it { subject.foreground.colour.must_equal('') }
|
|
79
|
+
it { subject.background.colour.must_equal('#7700ff') }
|
|
84
80
|
it {
|
|
85
81
|
subject.to_s.must_equal("\e[48;2;119;0;255m")
|
|
86
82
|
}
|
|
@@ -95,11 +91,8 @@ module Vedeu
|
|
|
95
91
|
}
|
|
96
92
|
}
|
|
97
93
|
|
|
98
|
-
it { subject.
|
|
99
|
-
it { subject.
|
|
100
|
-
background: '',
|
|
101
|
-
foreground: '#220077',
|
|
102
|
-
}) }
|
|
94
|
+
it { subject.foreground.colour.must_equal('#220077') }
|
|
95
|
+
it { subject.background.colour.must_equal('') }
|
|
103
96
|
it {
|
|
104
97
|
subject.to_s.must_equal("\e[38;2;34;0;119m")
|
|
105
98
|
}
|
|
@@ -112,11 +105,8 @@ module Vedeu
|
|
|
112
105
|
}
|
|
113
106
|
}
|
|
114
107
|
|
|
115
|
-
it { subject.
|
|
116
|
-
it { subject.
|
|
117
|
-
background: '',
|
|
118
|
-
foreground: '',
|
|
119
|
-
}) }
|
|
108
|
+
it { subject.foreground.colour.must_equal('') }
|
|
109
|
+
it { subject.background.colour.must_equal('') }
|
|
120
110
|
it { subject.to_s.must_equal('') }
|
|
121
111
|
end
|
|
122
112
|
end
|
|
@@ -130,11 +120,8 @@ module Vedeu
|
|
|
130
120
|
}
|
|
131
121
|
}
|
|
132
122
|
|
|
133
|
-
it { subject.
|
|
134
|
-
it { subject.
|
|
135
|
-
background: '#000022',
|
|
136
|
-
foreground: '',
|
|
137
|
-
}) }
|
|
123
|
+
it { subject.foreground.colour.must_equal('') }
|
|
124
|
+
it { subject.background.colour.must_equal('#000022') }
|
|
138
125
|
it { subject.to_s.must_equal("\e[48;2;0;0;34m") }
|
|
139
126
|
end
|
|
140
127
|
|
|
@@ -145,11 +132,8 @@ module Vedeu
|
|
|
145
132
|
}
|
|
146
133
|
}
|
|
147
134
|
|
|
148
|
-
it { subject.
|
|
149
|
-
it { subject.
|
|
150
|
-
background: '',
|
|
151
|
-
foreground: '#aadd00',
|
|
152
|
-
}) }
|
|
135
|
+
it { subject.foreground.colour.must_equal('#aadd00') }
|
|
136
|
+
it { subject.background.colour.must_equal('') }
|
|
153
137
|
it { subject.to_s.must_equal("\e[38;2;170;221;0m") }
|
|
154
138
|
end
|
|
155
139
|
|
|
@@ -160,41 +144,14 @@ module Vedeu
|
|
|
160
144
|
}
|
|
161
145
|
}
|
|
162
146
|
|
|
163
|
-
it { subject.
|
|
164
|
-
it { subject.
|
|
165
|
-
background: '',
|
|
166
|
-
foreground: '',
|
|
167
|
-
}) }
|
|
147
|
+
it { subject.foreground.colour.must_equal('') }
|
|
148
|
+
it { subject.background.colour.must_equal('') }
|
|
168
149
|
it { subject.to_s.must_equal('') }
|
|
169
150
|
end
|
|
170
151
|
end
|
|
171
152
|
end
|
|
172
153
|
end
|
|
173
154
|
|
|
174
|
-
describe '#background' do
|
|
175
|
-
subject { instance.background }
|
|
176
|
-
|
|
177
|
-
it { subject.must_be_instance_of(Vedeu::Background) }
|
|
178
|
-
|
|
179
|
-
context 'with a background' do
|
|
180
|
-
let(:attributes) {
|
|
181
|
-
{
|
|
182
|
-
background: '#000000'
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
it { subject.to_s.must_equal("\e[48;2;0;0;0m") }
|
|
187
|
-
it { subject.to_html.must_equal('#000000') }
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
context 'without a background' do
|
|
191
|
-
let(:attributes) { {} }
|
|
192
|
-
|
|
193
|
-
it { subject.to_s.must_equal('') }
|
|
194
|
-
it { subject.to_html.must_equal('') }
|
|
195
|
-
end
|
|
196
|
-
end
|
|
197
|
-
|
|
198
155
|
describe '#background=' do
|
|
199
156
|
let(:_value) { '#000000' }
|
|
200
157
|
|
|
@@ -217,30 +174,6 @@ module Vedeu
|
|
|
217
174
|
end
|
|
218
175
|
end
|
|
219
176
|
|
|
220
|
-
describe '#foreground' do
|
|
221
|
-
subject { instance.foreground }
|
|
222
|
-
|
|
223
|
-
it { subject.must_be_instance_of(Vedeu::Foreground) }
|
|
224
|
-
|
|
225
|
-
context 'with a foreground' do
|
|
226
|
-
let(:attributes) {
|
|
227
|
-
{
|
|
228
|
-
foreground: '#ff0000'
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
it { subject.to_s.must_equal("\e[38;2;255;0;0m") }
|
|
233
|
-
it { subject.to_html.must_equal('#ff0000') }
|
|
234
|
-
end
|
|
235
|
-
|
|
236
|
-
context 'without a foreground' do
|
|
237
|
-
let(:attributes) { {} }
|
|
238
|
-
|
|
239
|
-
it { subject.to_s.must_equal('') }
|
|
240
|
-
it { subject.to_html.must_equal('') }
|
|
241
|
-
end
|
|
242
|
-
end
|
|
243
|
-
|
|
244
177
|
describe '#foreground=' do
|
|
245
178
|
let(:_value) { '#ff0000' }
|
|
246
179
|
|
|
@@ -255,39 +188,25 @@ module Vedeu
|
|
|
255
188
|
it { subject.must_be_instance_of(String) }
|
|
256
189
|
|
|
257
190
|
context 'with both background and foreground' do
|
|
258
|
-
let(:
|
|
259
|
-
|
|
260
|
-
foreground: '#ff0000',
|
|
261
|
-
background: '#000000'
|
|
262
|
-
}
|
|
263
|
-
}
|
|
191
|
+
let(:background) { '#000000' }
|
|
192
|
+
let(:foreground) { '#ff0000' }
|
|
264
193
|
|
|
265
194
|
it { subject.must_equal("\e[38;2;255;0;0m\e[48;2;0;0;0m") }
|
|
266
195
|
end
|
|
267
196
|
|
|
268
197
|
context 'when the foreground is missing' do
|
|
269
|
-
let(:
|
|
270
|
-
{
|
|
271
|
-
background: '#000000'
|
|
272
|
-
}
|
|
273
|
-
}
|
|
198
|
+
let(:background) { '#000000' }
|
|
274
199
|
|
|
275
200
|
it { subject.must_equal("\e[48;2;0;0;0m") }
|
|
276
201
|
end
|
|
277
202
|
|
|
278
203
|
context 'when the background is missing' do
|
|
279
|
-
let(:
|
|
280
|
-
{
|
|
281
|
-
foreground: '#ff0000',
|
|
282
|
-
}
|
|
283
|
-
}
|
|
204
|
+
let(:foreground) { '#ff0000' }
|
|
284
205
|
|
|
285
206
|
it { subject.must_equal("\e[38;2;255;0;0m") }
|
|
286
207
|
end
|
|
287
208
|
|
|
288
209
|
context 'when both are missing' do
|
|
289
|
-
let(:attributes) { {} }
|
|
290
|
-
|
|
291
210
|
it { subject.must_equal('') }
|
|
292
211
|
end
|
|
293
212
|
end
|
|
@@ -3,7 +3,7 @@ require 'test_helper'
|
|
|
3
3
|
module Vedeu
|
|
4
4
|
|
|
5
5
|
class ParentPresentationTestClass
|
|
6
|
-
include Presentation
|
|
6
|
+
include Vedeu::Presentation
|
|
7
7
|
|
|
8
8
|
def parent
|
|
9
9
|
nil
|
|
@@ -18,7 +18,7 @@ module Vedeu
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
class PresentationTestClass
|
|
21
|
-
include Presentation
|
|
21
|
+
include Vedeu::Presentation
|
|
22
22
|
|
|
23
23
|
attr_reader :attributes
|
|
24
24
|
|
|
@@ -27,14 +27,14 @@ module Vedeu
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def parent
|
|
30
|
-
ParentPresentationTestClass.new
|
|
30
|
+
Vedeu::ParentPresentationTestClass.new
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
end # PresentationTestClass
|
|
34
34
|
|
|
35
35
|
describe Presentation do
|
|
36
36
|
|
|
37
|
-
let(:
|
|
37
|
+
let(:includer) { Vedeu::PresentationTestClass.new(attributes) }
|
|
38
38
|
let(:attributes) {
|
|
39
39
|
{
|
|
40
40
|
colour: { background: background, foreground: foreground },
|
|
@@ -45,7 +45,7 @@ module Vedeu
|
|
|
45
45
|
let(:foreground) { '#aadd00' }
|
|
46
46
|
|
|
47
47
|
describe '#background' do
|
|
48
|
-
subject {
|
|
48
|
+
subject { includer.background }
|
|
49
49
|
|
|
50
50
|
it { subject.must_be_instance_of(Vedeu::Background) }
|
|
51
51
|
it { subject.colour.must_equal('#000033') }
|
|
@@ -55,23 +55,24 @@ module Vedeu
|
|
|
55
55
|
let(:background) {}
|
|
56
56
|
|
|
57
57
|
it { subject.must_be_instance_of(Vedeu::Background) }
|
|
58
|
-
|
|
58
|
+
it { subject.colour.must_equal('#330000') }
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
describe '#background=' do
|
|
63
|
-
subject {
|
|
63
|
+
subject { includer.background = '#987654' }
|
|
64
64
|
|
|
65
|
-
it {
|
|
66
|
-
|
|
67
|
-
it do
|
|
65
|
+
it {
|
|
66
|
+
includer.colour.background.colour.must_equal('#000033')
|
|
68
67
|
subject
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
includer.colour.background.colour.must_equal('#987654')
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
it { subject.must_equal('#987654') }
|
|
71
72
|
end
|
|
72
73
|
|
|
73
74
|
describe '#foreground' do
|
|
74
|
-
subject {
|
|
75
|
+
subject { includer.foreground }
|
|
75
76
|
|
|
76
77
|
it { subject.must_be_instance_of(Vedeu::Foreground) }
|
|
77
78
|
it { subject.colour.must_equal('#aadd00') }
|
|
@@ -81,35 +82,37 @@ module Vedeu
|
|
|
81
82
|
let(:foreground) {}
|
|
82
83
|
|
|
83
84
|
it { subject.must_be_instance_of(Vedeu::Foreground) }
|
|
84
|
-
|
|
85
|
+
it { subject.colour.must_equal('#00aadd') }
|
|
85
86
|
end
|
|
86
87
|
end
|
|
87
88
|
|
|
88
89
|
describe '#foreground=' do
|
|
89
|
-
subject {
|
|
90
|
+
subject { includer.foreground = '#123456' }
|
|
90
91
|
|
|
91
|
-
it {
|
|
92
|
-
|
|
93
|
-
it do
|
|
92
|
+
it {
|
|
93
|
+
includer.colour.foreground.colour.must_equal('#aadd00')
|
|
94
94
|
subject
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
includer.colour.foreground.colour.must_equal('#123456')
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
it { subject.must_equal('#123456') }
|
|
97
99
|
end
|
|
98
100
|
|
|
99
101
|
describe '#parent_background' do
|
|
100
|
-
subject {
|
|
102
|
+
subject { includer.parent_background }
|
|
101
103
|
|
|
102
104
|
it { subject.must_be_instance_of(Vedeu::Background) }
|
|
105
|
+
it { subject.colour.must_equal('#330000') }
|
|
103
106
|
end
|
|
104
107
|
|
|
105
108
|
describe '#parent_foreground' do
|
|
106
|
-
subject {
|
|
109
|
+
subject { includer.parent_foreground }
|
|
107
110
|
|
|
108
111
|
it { subject.must_be_instance_of(Vedeu::Foreground) }
|
|
109
112
|
end
|
|
110
113
|
|
|
111
114
|
describe '#colour' do
|
|
112
|
-
subject {
|
|
115
|
+
subject { includer.colour }
|
|
113
116
|
|
|
114
117
|
it { subject.must_be_instance_of(Vedeu::Colour) }
|
|
115
118
|
end
|
|
@@ -117,13 +120,13 @@ module Vedeu
|
|
|
117
120
|
describe '#colour=' do
|
|
118
121
|
let(:colour) { Colour.new(foreground: '#00ff00', background: '#000000') }
|
|
119
122
|
|
|
120
|
-
subject {
|
|
123
|
+
subject { includer.colour = (colour) }
|
|
121
124
|
|
|
122
125
|
it { subject.must_be_instance_of(Colour) }
|
|
123
126
|
end
|
|
124
127
|
|
|
125
128
|
describe '#style' do
|
|
126
|
-
subject {
|
|
129
|
+
subject { includer.style }
|
|
127
130
|
|
|
128
131
|
it { subject.must_be_instance_of(Vedeu::Style) }
|
|
129
132
|
end
|
|
@@ -131,7 +134,7 @@ module Vedeu
|
|
|
131
134
|
describe '#style=' do
|
|
132
135
|
let(:style) { Style.new('normal') }
|
|
133
136
|
|
|
134
|
-
subject {
|
|
137
|
+
subject { includer.style = (style) }
|
|
135
138
|
|
|
136
139
|
it { subject.must_be_instance_of(Style) }
|
|
137
140
|
end
|
|
@@ -158,7 +161,7 @@ module Vedeu
|
|
|
158
161
|
}
|
|
159
162
|
let(:stream_style) { Style.new(:underline) }
|
|
160
163
|
|
|
161
|
-
it {
|
|
164
|
+
it { includer.must_respond_to(:to_str) }
|
|
162
165
|
|
|
163
166
|
it 'returns output' do
|
|
164
167
|
stream.to_s.must_equal(
|
|
@@ -27,7 +27,18 @@ module Vedeu
|
|
|
27
27
|
subject { described.coerce(_value) }
|
|
28
28
|
|
|
29
29
|
context 'when the value is nil' do
|
|
30
|
-
it { subject.must_be_instance_of(
|
|
30
|
+
it { subject.must_be_instance_of(Vedeu::Translator) }
|
|
31
|
+
|
|
32
|
+
it {
|
|
33
|
+
Vedeu::Background.coerce(_value).
|
|
34
|
+
must_be_instance_of(Vedeu::Background)
|
|
35
|
+
}
|
|
36
|
+
it { Vedeu::Background.coerce(_value).colour.must_equal('') }
|
|
37
|
+
it {
|
|
38
|
+
Vedeu::Foreground.coerce(_value).
|
|
39
|
+
must_be_instance_of(Vedeu::Foreground)
|
|
40
|
+
}
|
|
41
|
+
it { Vedeu::Foreground.coerce(_value).colour.must_equal('') }
|
|
31
42
|
end
|
|
32
43
|
|
|
33
44
|
context 'when the value is a Vedeu::Background' do
|
|
@@ -14,10 +14,11 @@ module Vedeu
|
|
|
14
14
|
|
|
15
15
|
describe Common do
|
|
16
16
|
|
|
17
|
-
let(:described) { Vedeu::VedeuCommonClass
|
|
17
|
+
let(:described) { Vedeu::VedeuCommonClass }
|
|
18
|
+
let(:instance) { described.new }
|
|
18
19
|
|
|
19
20
|
describe '#present?' do
|
|
20
|
-
subject {
|
|
21
|
+
subject { instance.defined_value_test(_value) }
|
|
21
22
|
|
|
22
23
|
context 'when the variable is a Fixnum' do
|
|
23
24
|
let(:_value) { 17 }
|
|
@@ -45,6 +46,20 @@ module Vedeu
|
|
|
45
46
|
end
|
|
46
47
|
end
|
|
47
48
|
|
|
49
|
+
describe '#snake_case' do
|
|
50
|
+
let(:_name) { 'MyFirstApp' }
|
|
51
|
+
|
|
52
|
+
subject { instance.snake_case(_name) }
|
|
53
|
+
|
|
54
|
+
it { subject.must_equal('my_first_app') }
|
|
55
|
+
|
|
56
|
+
context 'when namespaced' do
|
|
57
|
+
let(:_name) { 'MyFirstApp::SomeController' }
|
|
58
|
+
|
|
59
|
+
it { subject.must_equal('my_first_app/some_controller') }
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
48
63
|
end # Common
|
|
49
64
|
|
|
50
65
|
end # Vedeu
|
data/test/test_helper.rb
CHANGED
|
@@ -49,6 +49,7 @@ end
|
|
|
49
49
|
module MiniTest
|
|
50
50
|
class Spec
|
|
51
51
|
# parallelize_me! # uncomment to unleash hell
|
|
52
|
+
# i_suck_and_my_tests_are_order_dependent! # just incase
|
|
52
53
|
|
|
53
54
|
# include VedeuMiniTestPlugin
|
|
54
55
|
|
|
@@ -65,7 +66,8 @@ require 'support/helpers/model_test_class'
|
|
|
65
66
|
# require 'minitest/reporters'
|
|
66
67
|
# Minitest::Reporters.use!(
|
|
67
68
|
# # commented out by default (makes tests slower)
|
|
68
|
-
# # Minitest::Reporters::DefaultReporter.new({ color: true,
|
|
69
|
+
# # Minitest::Reporters::DefaultReporter.new({ color: true,
|
|
70
|
+
# # slow_suite_count: 3 }),
|
|
69
71
|
# # Minitest::Reporters::SpecReporter.new
|
|
70
72
|
# )
|
|
71
73
|
|
data/vedeu.gemspec
CHANGED