vedeu 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/views/_interfaces.rb +127 -0
- data/examples/views/empty_template.rb +10 -0
- data/examples/views/expected/vedeu_full_screen.html +140 -0
- data/examples/views/expected/vedeu_full_screen.json +96050 -0
- data/examples/views/expected/vedeu_full_screen.out +1 -0
- data/examples/views/expected/vedeu_full_screen.txt +50 -0
- data/examples/views/expected/vedeu_line.html +140 -0
- data/examples/views/expected/vedeu_line.json +96050 -0
- data/examples/views/expected/vedeu_line.out +1 -0
- data/examples/views/expected/vedeu_line.txt +58 -0
- data/examples/views/expected/vedeu_lines.html +140 -0
- data/examples/views/expected/vedeu_lines.json +96050 -0
- data/examples/views/expected/{lines.out → vedeu_lines.out} +1 -1
- data/examples/views/expected/vedeu_lines_alignment.html +80 -0
- data/examples/views/expected/vedeu_lines_alignment.json +46370 -0
- data/examples/views/expected/vedeu_lines_alignment.out +1 -0
- data/examples/views/full_screen.rb +10 -0
- data/examples/views/line.rb +11 -106
- data/examples/views/lines.rb +8 -127
- data/examples/views/lines_alignment.rb +17 -125
- data/examples/views/runner.sh +65 -19
- data/lib/vedeu/borders/border.rb +6 -6
- data/lib/vedeu/borders/refresh.rb +4 -6
- data/lib/vedeu/buffers/buffer.rb +1 -1
- data/lib/vedeu/buffers/terminal.rb +4 -4
- data/lib/vedeu/buffers/view.rb +2 -2
- data/lib/vedeu/cells/all.rb +2 -2
- data/lib/vedeu/cells/border.rb +5 -0
- data/lib/vedeu/cells/borders/all.rb +2 -8
- data/lib/vedeu/cells/borders/edges/all.rb +6 -0
- data/lib/vedeu/cells/borders/{bottom_horizontal.rb → edges/bottom_horizontal.rb} +0 -0
- data/lib/vedeu/cells/borders/{left_vertical.rb → edges/left_vertical.rb} +0 -0
- data/lib/vedeu/cells/borders/{right_vertical.rb → edges/right_vertical.rb} +0 -0
- data/lib/vedeu/cells/borders/{top_horizontal.rb → edges/top_horizontal.rb} +0 -0
- data/lib/vedeu/cells/borders/horizontal.rb +5 -0
- data/lib/vedeu/cells/borders/vertical.rb +5 -0
- data/lib/vedeu/cells/borders/vertices/all.rb +6 -0
- data/lib/vedeu/cells/borders/{bottom_left.rb → vertices/bottom_left.rb} +5 -0
- data/lib/vedeu/cells/borders/{bottom_right.rb → vertices/bottom_right.rb} +5 -0
- data/lib/vedeu/cells/borders/{top_left.rb → vertices/top_left.rb} +5 -0
- data/lib/vedeu/cells/borders/{top_right.rb → vertices/top_right.rb} +5 -0
- data/lib/vedeu/cells/char.rb +16 -0
- data/lib/vedeu/cells/clear.rb +5 -0
- data/lib/vedeu/cells/cursor.rb +70 -0
- data/lib/vedeu/cells/empty.rb +24 -14
- data/lib/vedeu/cells/escape.rb +8 -7
- data/lib/vedeu/cells/support/all.rb +3 -0
- data/lib/vedeu/cells/support/html.rb +98 -0
- data/lib/vedeu/colours/background.rb +21 -1
- data/lib/vedeu/colours/colour.rb +10 -2
- data/lib/vedeu/colours/foreground.rb +21 -1
- data/lib/vedeu/colours/translator.rb +17 -24
- data/lib/vedeu/colours/validator.rb +9 -9
- data/lib/vedeu/configuration/api.rb +1 -1
- data/lib/vedeu/cursors/cursor.rb +5 -5
- data/lib/vedeu/dsl/elements.rb +22 -79
- data/lib/vedeu/dsl/string/text.rb +3 -3
- data/lib/vedeu/editor/cropper.rb +2 -2
- data/lib/vedeu/editor/cursor.rb +1 -1
- data/lib/vedeu/editor/document.rb +1 -1
- data/lib/vedeu/geometries/area/dimension.rb +1 -1
- data/lib/vedeu/geometries/position.rb +5 -2
- data/lib/vedeu/interfaces/clear.rb +5 -5
- data/lib/vedeu/models/row.rb +4 -3
- data/lib/vedeu/output/compressor.rb +7 -7
- data/lib/vedeu/output/output.rb +8 -13
- data/lib/vedeu/output/viewport.rb +1 -1
- data/lib/vedeu/presentation/background.rb +2 -2
- data/lib/vedeu/presentation/colour.rb +0 -4
- data/lib/vedeu/presentation/foreground.rb +2 -2
- data/lib/vedeu/presentation/style.rb +1 -1
- data/lib/vedeu/presentation/styles.rb +0 -3
- data/lib/vedeu/renderers/file.rb +10 -68
- data/lib/vedeu/renderers/html.rb +28 -96
- data/lib/vedeu/renderers/json.rb +15 -31
- data/lib/vedeu/renderers/options.rb +160 -14
- data/lib/vedeu/renderers/templates/html_renderer.vedeu +1 -0
- data/lib/vedeu/renderers/terminal.rb +16 -17
- data/lib/vedeu/renderers/text.rb +32 -41
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/all.rb +0 -2
- data/lib/vedeu/views/chars.rb +6 -3
- data/lib/vedeu/views/stream.rb +3 -2
- data/test/lib/vedeu/borders/caption_test.rb +17 -17
- data/test/lib/vedeu/borders/title_test.rb +12 -12
- data/test/lib/vedeu/cells/border_test.rb +6 -0
- data/test/lib/vedeu/cells/borders/{bottom_horizontal_test.rb → edges/bottom_horizontal_test.rb} +0 -0
- data/test/lib/vedeu/cells/borders/{left_vertical_test.rb → edges/left_vertical_test.rb} +0 -0
- data/test/lib/vedeu/cells/borders/{right_vertical_test.rb → edges/right_vertical_test.rb} +0 -0
- data/test/lib/vedeu/cells/borders/{top_horizontal_test.rb → edges/top_horizontal_test.rb} +0 -0
- data/test/lib/vedeu/cells/borders/horizontal_test.rb +6 -0
- data/test/lib/vedeu/cells/borders/vertical_test.rb +6 -0
- data/test/lib/vedeu/cells/borders/{bottom_left_test.rb → vertices/bottom_left_test.rb} +6 -0
- data/test/lib/vedeu/cells/borders/{bottom_right_test.rb → vertices/bottom_right_test.rb} +6 -0
- data/test/lib/vedeu/cells/borders/{top_left_test.rb → vertices/top_left_test.rb} +6 -0
- data/test/lib/vedeu/cells/borders/{top_right_test.rb → vertices/top_right_test.rb} +6 -0
- data/test/lib/vedeu/cells/char_test.rb +18 -0
- data/test/lib/vedeu/cells/clear_test.rb +6 -0
- data/test/lib/vedeu/cells/cursor_test.rb +113 -0
- data/test/lib/vedeu/cells/empty_test.rb +100 -7
- data/test/lib/vedeu/cells/escape_test.rb +29 -13
- data/test/lib/vedeu/cells/support/html_test.rb +100 -0
- data/test/lib/vedeu/colours/background_test.rb +35 -3
- data/test/lib/vedeu/colours/colour_test.rb +66 -0
- data/test/lib/vedeu/colours/foreground_test.rb +35 -3
- data/test/lib/vedeu/colours/translator_test.rb +0 -34
- data/test/lib/vedeu/colours/validator_test.rb +84 -6
- data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
- data/test/lib/vedeu/cursors/refresh_test.rb +4 -1
- data/test/lib/vedeu/dsl/string/text_test.rb +36 -36
- data/test/lib/vedeu/editor/cropper_test.rb +15 -15
- data/test/lib/vedeu/geometries/position_test.rb +14 -1
- data/test/lib/vedeu/models/page_test.rb +10 -10
- data/test/lib/vedeu/models/row_test.rb +7 -7
- data/test/lib/vedeu/output/compressor_test.rb +63 -50
- data/test/lib/vedeu/renderers/file_test.rb +64 -35
- data/test/lib/vedeu/renderers/html_test.rb +15 -12
- data/test/lib/vedeu/renderers/json_test.rb +79 -56
- data/test/lib/vedeu/renderers/options_test.rb +74 -26
- data/test/lib/vedeu/renderers/terminal_test.rb +34 -4
- data/test/lib/vedeu/renderers/text_test.rb +35 -3
- data/test/lib/vedeu/views/chars_test.rb +6 -0
- metadata +50 -41
- data/examples/views/expected/line.out +0 -1
- data/examples/views/expected/lines_alignment.out +0 -1
- data/lib/vedeu/cells/html.rb +0 -21
- data/lib/vedeu/cells/json.rb +0 -21
- data/lib/vedeu/views/char.rb +0 -180
- data/lib/vedeu/views/html_char.rb +0 -133
- data/test/lib/vedeu/cells/html_test.rb +0 -15
- data/test/lib/vedeu/cells/json_test.rb +0 -15
- data/test/lib/vedeu/views/char_test.rb +0 -283
- data/test/lib/vedeu/views/html_char_test.rb +0 -125
@@ -86,21 +86,21 @@ module Vedeu
|
|
86
86
|
}
|
87
87
|
let(:expected) {
|
88
88
|
[
|
89
|
-
"\e[1;
|
90
|
-
"\e[1;
|
91
|
-
"\e[1;
|
92
|
-
"\e[1;
|
93
|
-
"\e[1;
|
94
|
-
"\e[2;
|
95
|
-
"\e[2;
|
96
|
-
"\e[2;
|
97
|
-
"\e[2;
|
98
|
-
"\e[2;
|
99
|
-
"\e[3;
|
100
|
-
"\e[3;
|
101
|
-
"\e[3;
|
102
|
-
"\e[3;
|
103
|
-
"\e[3;
|
89
|
+
"\e[1;1He",
|
90
|
+
"\e[1;2Hl",
|
91
|
+
"\e[1;3Hi",
|
92
|
+
"\e[1;4Hu",
|
93
|
+
"\e[1;5Hm",
|
94
|
+
"\e[2;1Hi",
|
95
|
+
"\e[2;2Ht",
|
96
|
+
"\e[2;3Hh",
|
97
|
+
"\e[2;4Hi",
|
98
|
+
"\e[2;5Hu",
|
99
|
+
"\e[3;1He",
|
100
|
+
"\e[3;2Hr",
|
101
|
+
"\e[3;3Hy",
|
102
|
+
"\e[3;4Hl",
|
103
|
+
"\e[3;5Hl"
|
104
104
|
]
|
105
105
|
}
|
106
106
|
|
@@ -155,9 +155,22 @@ module Vedeu
|
|
155
155
|
end
|
156
156
|
|
157
157
|
describe '#to_h' do
|
158
|
+
let(:expected) {
|
159
|
+
{
|
160
|
+
position: {
|
161
|
+
y: 12,
|
162
|
+
x: 19,
|
163
|
+
}
|
164
|
+
}
|
165
|
+
}
|
166
|
+
|
158
167
|
subject { instance.to_h }
|
159
168
|
|
160
|
-
it { subject.must_equal(
|
169
|
+
it { subject.must_equal(expected) }
|
170
|
+
end
|
171
|
+
|
172
|
+
describe '#to_hash' do
|
173
|
+
it { instance.must_respond_to(:to_h) }
|
161
174
|
end
|
162
175
|
|
163
176
|
describe '#to_s' do
|
@@ -116,11 +116,11 @@ module Vedeu
|
|
116
116
|
[:lithium],
|
117
117
|
Vedeu::Models::Row.new([:beryllium]),
|
118
118
|
[
|
119
|
-
Vedeu::
|
120
|
-
Vedeu::
|
121
|
-
Vedeu::
|
122
|
-
Vedeu::
|
123
|
-
Vedeu::
|
119
|
+
Vedeu::Cells::Char.new(value: 'b'),
|
120
|
+
Vedeu::Cells::Char.new(value: 'o'),
|
121
|
+
Vedeu::Cells::Char.new(value: 'r'),
|
122
|
+
Vedeu::Cells::Char.new(value: 'o'),
|
123
|
+
Vedeu::Cells::Char.new(value: 'n'),
|
124
124
|
],
|
125
125
|
[nil, :carbon],
|
126
126
|
:nitrogen,
|
@@ -133,11 +133,11 @@ module Vedeu
|
|
133
133
|
Vedeu::Models::Row.new([:lithium]),
|
134
134
|
Vedeu::Models::Row.new([:beryllium]),
|
135
135
|
Vedeu::Models::Row.new([
|
136
|
-
Vedeu::
|
137
|
-
Vedeu::
|
138
|
-
Vedeu::
|
139
|
-
Vedeu::
|
140
|
-
Vedeu::
|
136
|
+
Vedeu::Cells::Char.new(value: 'b'),
|
137
|
+
Vedeu::Cells::Char.new(value: 'o'),
|
138
|
+
Vedeu::Cells::Char.new(value: 'r'),
|
139
|
+
Vedeu::Cells::Char.new(value: 'o'),
|
140
|
+
Vedeu::Cells::Char.new(value: 'n'),
|
141
141
|
]),
|
142
142
|
Vedeu::Models::Row.new([:carbon]),
|
143
143
|
Vedeu::Models::Row.new([:nitrogen]),
|
@@ -12,9 +12,9 @@ module Vedeu
|
|
12
12
|
let(:instance) { described.new(cells) }
|
13
13
|
let(:cells) {
|
14
14
|
[
|
15
|
-
Vedeu::
|
15
|
+
Vedeu::Cells::Char.new(value: 'A'),
|
16
16
|
Vedeu::Cells::Empty.new(value: 'B'),
|
17
|
-
Vedeu::
|
17
|
+
Vedeu::Cells::Char.new(value: 'C'),
|
18
18
|
]
|
19
19
|
}
|
20
20
|
|
@@ -77,7 +77,7 @@ module Vedeu
|
|
77
77
|
|
78
78
|
context 'when the index is not nil' do
|
79
79
|
context 'and the index is in range' do
|
80
|
-
let(:expected) { Vedeu::
|
80
|
+
let(:expected) { Vedeu::Cells::Char.new(value: 'C') }
|
81
81
|
|
82
82
|
let(:index) { 2 }
|
83
83
|
|
@@ -101,10 +101,10 @@ module Vedeu
|
|
101
101
|
describe '#content' do
|
102
102
|
let(:expected) {
|
103
103
|
[
|
104
|
-
Vedeu::
|
104
|
+
Vedeu::Cells::Char.new(value: 'A'),
|
105
105
|
Vedeu::Cells::Empty.new(value: 'B'),
|
106
|
-
Vedeu::
|
107
|
-
Vedeu::
|
106
|
+
Vedeu::Cells::Char.new(value: 'C'),
|
107
|
+
Vedeu::Cells::Escape.new(value: "\e[0m"),
|
108
108
|
]
|
109
109
|
}
|
110
110
|
|
@@ -154,7 +154,7 @@ module Vedeu
|
|
154
154
|
describe '#reset_character' do
|
155
155
|
subject { instance.reset_character }
|
156
156
|
|
157
|
-
it { subject.must_be_instance_of(Vedeu::
|
157
|
+
it { subject.must_be_instance_of(Vedeu::Cells::Escape) }
|
158
158
|
end
|
159
159
|
|
160
160
|
describe '#size' do
|
@@ -21,6 +21,17 @@ module Vedeu
|
|
21
21
|
end
|
22
22
|
|
23
23
|
describe '.render' do
|
24
|
+
let(:colour_1) {
|
25
|
+
{
|
26
|
+
foreground: '#ff0000'
|
27
|
+
}
|
28
|
+
}
|
29
|
+
let(:colour_2) {
|
30
|
+
{
|
31
|
+
foreground: '#0000ff'
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
24
35
|
subject { described.render(output) }
|
25
36
|
|
26
37
|
it { subject.must_be_instance_of(String) }
|
@@ -28,20 +39,21 @@ module Vedeu
|
|
28
39
|
context 'when compression is enabled' do
|
29
40
|
before { Vedeu.configure { compression(true) } }
|
30
41
|
|
31
|
-
context 'when the output is all Vedeu::
|
42
|
+
context 'when the output is all Vedeu::Cells::Char elements' do
|
43
|
+
|
32
44
|
let(:output) {
|
33
45
|
Vedeu::Models::Page.coerce([
|
34
|
-
Vedeu::
|
46
|
+
Vedeu::Cells::Char.new(value: 'Y',
|
35
47
|
name: _name,
|
36
|
-
colour:
|
48
|
+
colour: colour_1,
|
37
49
|
position: [1, 1]),
|
38
|
-
Vedeu::
|
50
|
+
Vedeu::Cells::Char.new(value: 'e',
|
39
51
|
name: _name,
|
40
|
-
colour:
|
52
|
+
colour: colour_1,
|
41
53
|
position: [1, 2]),
|
42
|
-
Vedeu::
|
54
|
+
Vedeu::Cells::Char.new(value: 's',
|
43
55
|
name: _name,
|
44
|
-
colour:
|
56
|
+
colour: colour_1,
|
45
57
|
position: [1, 3])
|
46
58
|
])
|
47
59
|
}
|
@@ -50,30 +62,30 @@ module Vedeu
|
|
50
62
|
"\e[1;2H\e[38;2;255;0;0me\e[0m" \
|
51
63
|
"\e[1;3H\e[38;2;255;0;0ms\e[0m"
|
52
64
|
}
|
53
|
-
it 'converts the non-Vedeu::
|
65
|
+
it 'converts the non-Vedeu::Cells::Char elements into String ' \
|
54
66
|
'elements' do
|
55
67
|
subject.must_equal(expected)
|
56
68
|
end
|
57
69
|
end
|
58
70
|
|
59
|
-
context 'when the output is all Vedeu::
|
71
|
+
context 'when the output is all Vedeu::Cells::Char elements' do
|
60
72
|
let(:output) {
|
61
73
|
Vedeu::Models::Page.coerce([
|
62
|
-
Vedeu::
|
74
|
+
Vedeu::Cells::Char.new(value: 'a',
|
63
75
|
name: _name,
|
64
|
-
colour:
|
76
|
+
colour: colour_1,
|
65
77
|
position: [1, 1]),
|
66
|
-
Vedeu::
|
78
|
+
Vedeu::Cells::Char.new(value: 'b',
|
67
79
|
name: _name,
|
68
|
-
colour:
|
80
|
+
colour: colour_1,
|
69
81
|
position: [1, 2]),
|
70
|
-
Vedeu::
|
82
|
+
Vedeu::Cells::Char.new(value: 'c',
|
71
83
|
name: _name,
|
72
|
-
colour:
|
84
|
+
colour: colour_2,
|
73
85
|
position: [1, 3]),
|
74
|
-
Vedeu::
|
86
|
+
Vedeu::Cells::Char.new(value: 'd',
|
75
87
|
name: _name,
|
76
|
-
colour:
|
88
|
+
colour: colour_2,
|
77
89
|
position: [1, 4]),
|
78
90
|
])
|
79
91
|
}
|
@@ -88,18 +100,17 @@ module Vedeu
|
|
88
100
|
end
|
89
101
|
end
|
90
102
|
|
91
|
-
context 'when the output is not all Vedeu::
|
92
|
-
'elements' do
|
103
|
+
context 'when the output is not all Vedeu::Cells::Char elements' do
|
93
104
|
let(:output) {
|
94
|
-
Vedeu::Models::Page.coerce([
|
95
|
-
Vedeu::
|
105
|
+
Vedeu::Models::Page.coerce(Vedeu::Models::Row.coerce([
|
106
|
+
Vedeu::Cells::Char.new(name: _name, value: 'A', position: [1, 1]),
|
96
107
|
Vedeu::Cells::Escape.new(value: "\e[?25l"),
|
97
|
-
Vedeu::
|
98
|
-
])
|
108
|
+
Vedeu::Cells::Char.new(name: _name, value: 'B', position: [1, 3]),
|
109
|
+
]))
|
99
110
|
}
|
100
|
-
let(:expected) { "\e[1;
|
111
|
+
let(:expected) { "\e[1;1HA\e[?25l\e[1;3HB\e[0m" }
|
101
112
|
|
102
|
-
it 'converts the non-Vedeu::
|
113
|
+
it 'converts the non-Vedeu::Cells::Char elements into String ' \
|
103
114
|
'elements' do
|
104
115
|
subject.must_equal(expected)
|
105
116
|
end
|
@@ -109,18 +120,18 @@ module Vedeu
|
|
109
120
|
context 'when compression is not enabled' do
|
110
121
|
before { Vedeu.configure { compression(false) } }
|
111
122
|
|
112
|
-
context 'when the output is all Vedeu::
|
123
|
+
context 'when the output is all Vedeu::Cells::Char elements' do
|
113
124
|
let(:output) {
|
114
125
|
Vedeu::Models::Page.coerce([
|
115
|
-
Vedeu::
|
126
|
+
Vedeu::Cells::Char.new(value: 'Y',
|
116
127
|
name: _name,
|
117
|
-
colour:
|
118
|
-
Vedeu::
|
128
|
+
colour: colour_1),
|
129
|
+
Vedeu::Cells::Char.new(value: 'e',
|
119
130
|
name: _name,
|
120
|
-
colour:
|
121
|
-
Vedeu::
|
131
|
+
colour: colour_1),
|
132
|
+
Vedeu::Cells::Char.new(value: 's',
|
122
133
|
name: _name,
|
123
|
-
colour:
|
134
|
+
colour: colour_1),
|
124
135
|
])
|
125
136
|
}
|
126
137
|
let(:expected) {
|
@@ -128,27 +139,27 @@ module Vedeu
|
|
128
139
|
"\e[38;2;255;0;0me\e[0m" \
|
129
140
|
"\e[38;2;255;0;0ms\e[0m"
|
130
141
|
}
|
131
|
-
it 'converts the non-Vedeu::
|
142
|
+
it 'converts the non-Vedeu::Cells::Char elements into String ' \
|
132
143
|
'elements' do
|
133
144
|
subject.must_equal(expected)
|
134
145
|
end
|
135
146
|
end
|
136
147
|
|
137
|
-
context 'when the output is all Vedeu::
|
148
|
+
context 'when the output is all Vedeu::Cells::Char elements' do
|
138
149
|
let(:output) {
|
139
150
|
Vedeu::Models::Page.coerce([
|
140
|
-
Vedeu::
|
151
|
+
Vedeu::Cells::Char.new(value: 'a',
|
141
152
|
name: _name,
|
142
|
-
colour:
|
143
|
-
Vedeu::
|
153
|
+
colour: colour_1),
|
154
|
+
Vedeu::Cells::Char.new(value: 'b',
|
144
155
|
name: _name,
|
145
|
-
colour:
|
146
|
-
Vedeu::
|
156
|
+
colour: colour_1),
|
157
|
+
Vedeu::Cells::Char.new(value: 'c',
|
147
158
|
name: _name,
|
148
|
-
colour:
|
149
|
-
Vedeu::
|
159
|
+
colour: colour_2),
|
160
|
+
Vedeu::Cells::Char.new(value: 'd',
|
150
161
|
name: _name,
|
151
|
-
colour:
|
162
|
+
colour: colour_2),
|
152
163
|
])
|
153
164
|
}
|
154
165
|
let(:expected) {
|
@@ -162,17 +173,19 @@ module Vedeu
|
|
162
173
|
end
|
163
174
|
end
|
164
175
|
|
165
|
-
context 'when the output is not all Vedeu::
|
176
|
+
context 'when the output is not all Vedeu::Cells::Char elements' do
|
166
177
|
let(:output) {
|
167
|
-
Vedeu::Models::Page.coerce(
|
168
|
-
Vedeu::
|
169
|
-
|
170
|
-
|
171
|
-
|
178
|
+
Vedeu::Models::Page.coerce(
|
179
|
+
Vedeu::Models::Row.coerce([
|
180
|
+
Vedeu::Cells::Char.new(name: _name, value: 'A'),
|
181
|
+
Vedeu::Cells::Escape.new(value: "\e[?25l"),
|
182
|
+
Vedeu::Cells::Char.new(name: _name, value: 'B'),
|
183
|
+
])
|
184
|
+
)
|
172
185
|
}
|
173
|
-
it 'converts the non-Vedeu::
|
186
|
+
it 'converts the non-Vedeu::Cells::Char elements into String ' \
|
174
187
|
'elements' do
|
175
|
-
subject.must_equal("
|
188
|
+
subject.must_equal("A\e[?25lB\e[0m")
|
176
189
|
end
|
177
190
|
end
|
178
191
|
end
|
@@ -13,14 +13,30 @@ module Vedeu
|
|
13
13
|
let(:output) { 'Some content...' }
|
14
14
|
let(:options) {
|
15
15
|
{
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
compression: compression,
|
17
|
+
end_tag: end_tag,
|
18
|
+
end_row_tag: end_row_tag,
|
19
|
+
filename: filename,
|
20
|
+
output: output,
|
21
|
+
start_tag: start_tag,
|
22
|
+
start_row_tag: start_row_tag,
|
23
|
+
template: template,
|
24
|
+
timestamp: timestamp,
|
25
|
+
write_file: write_file,
|
19
26
|
}
|
20
27
|
}
|
21
|
-
let(:
|
22
|
-
let(:
|
23
|
-
let(:
|
28
|
+
let(:compression) { false }
|
29
|
+
let(:end_tag) { '</td>' }
|
30
|
+
let(:end_row_tag) { '</tr>' }
|
31
|
+
let(:filename) { 'vedeu_renderers_file' }
|
32
|
+
let(:start_tag) { '<td' }
|
33
|
+
let(:start_row_tag) { '<tr>' }
|
34
|
+
let(:template) {
|
35
|
+
::File.dirname(__FILE__) + '/../../../support/templates/' \
|
36
|
+
'html_renderer.vedeu'
|
37
|
+
}
|
38
|
+
let(:timestamp) { false }
|
39
|
+
let(:write_file) { false }
|
24
40
|
|
25
41
|
before { ::File.stubs(:write) }
|
26
42
|
|
@@ -29,45 +45,58 @@ module Vedeu
|
|
29
45
|
it { instance.instance_variable_get('@options').must_equal(options) }
|
30
46
|
end
|
31
47
|
|
32
|
-
describe '#render' do
|
33
|
-
|
48
|
+
# describe '#render' do
|
49
|
+
# let(:_time) { Time.new(2015, 4, 12, 20, 05, 00, "+01:00") }
|
34
50
|
|
35
|
-
|
51
|
+
# subject { instance.render(output) }
|
36
52
|
|
37
|
-
|
53
|
+
# # it { subject.must_be_instance_of(String) }
|
38
54
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
55
|
+
# context 'when the filename option is not set' do
|
56
|
+
# context 'when the timestamp option is not set' do
|
57
|
+
# # it do
|
58
|
+
# # ::File.expects(:write).with('/tmp/out', nil)
|
59
|
+
# # subject
|
60
|
+
# # end
|
61
|
+
# end
|
46
62
|
|
47
|
-
|
48
|
-
|
63
|
+
# context 'when the timestamp option is set' do
|
64
|
+
# let(:timestamp) { true }
|
49
65
|
|
50
|
-
|
66
|
+
# before { Time.stubs(:now).returns(_time) }
|
51
67
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
68
|
+
# # it do
|
69
|
+
# # ::File.expects(:write).with('/tmp/out_1428865500.0', 'w')
|
70
|
+
# # subject
|
71
|
+
# # end
|
72
|
+
# end
|
73
|
+
# end
|
58
74
|
|
59
|
-
|
60
|
-
|
75
|
+
# context 'when the filename option is set' do
|
76
|
+
# let(:filename) { 'some_name' }
|
61
77
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
78
|
+
# # it do
|
79
|
+
# # ::File.expects(:write).with('/tmp/some_name', 'w')
|
80
|
+
# # subject
|
81
|
+
# # end
|
82
|
+
# end
|
83
|
+
# end
|
68
84
|
|
69
85
|
describe '#clear' do
|
70
|
-
|
86
|
+
subject { instance.clear }
|
87
|
+
|
88
|
+
it { subject.must_equal('') }
|
89
|
+
end
|
90
|
+
|
91
|
+
describe '#write' do
|
92
|
+
subject { instance.write }
|
93
|
+
|
94
|
+
it do
|
95
|
+
::File.expects(:write).with(filename, output)
|
96
|
+
subject
|
97
|
+
end
|
98
|
+
|
99
|
+
it { subject.must_equal(output) }
|
71
100
|
end
|
72
101
|
|
73
102
|
end # File
|