vedeu 0.5.13 → 0.6.0

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.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +6 -0
  3. data/bin/vedeu_drb_server +1 -0
  4. data/config/rubocop_enabled.yml +2 -2
  5. data/docs/events.md +2 -0
  6. data/docs/getting_started.md +1 -1
  7. data/examples/drb_app.rb +1 -0
  8. data/examples/editor_app.rb +76 -0
  9. data/lib/vedeu/all.rb +13 -7
  10. data/lib/vedeu/{bindings.rb → bindings/bindings.rb} +2 -0
  11. data/lib/vedeu/bindings/focus.rb +66 -0
  12. data/lib/vedeu/bindings/refresh.rb +77 -0
  13. data/lib/vedeu/bindings/system.rb +19 -88
  14. data/lib/vedeu/buffers/buffer.rb +8 -8
  15. data/lib/vedeu/configuration/api.rb +32 -11
  16. data/lib/vedeu/configuration/cli.rb +8 -0
  17. data/lib/vedeu/cursor/move.rb +1 -0
  18. data/lib/vedeu/distributed/templates/default_configuration.vedeu +1 -0
  19. data/lib/vedeu/{dsl.rb → dsl/dsl.rb} +0 -0
  20. data/lib/vedeu/exceptions.rb +1 -1
  21. data/lib/vedeu/geometry/position.rb +28 -0
  22. data/lib/vedeu/input/capture.rb +76 -0
  23. data/lib/vedeu/input/editor/all.rb +19 -0
  24. data/lib/vedeu/input/editor/cropper.rb +74 -0
  25. data/lib/vedeu/input/editor/document.rb +254 -0
  26. data/lib/vedeu/input/editor/documents.rb +18 -0
  27. data/lib/vedeu/input/editor/editor.rb +100 -0
  28. data/lib/vedeu/input/editor/line.rb +143 -0
  29. data/lib/vedeu/input/editor/lines.rb +199 -0
  30. data/lib/vedeu/input/editor/virtual_cursor.rb +167 -0
  31. data/lib/vedeu/input/input.rb +9 -93
  32. data/lib/vedeu/input/input_translator.rb +155 -0
  33. data/lib/vedeu/internal_api.rb +9 -0
  34. data/lib/vedeu/log/lockless_log_device.rb +1 -1
  35. data/lib/vedeu/models/escape.rb +7 -8
  36. data/lib/vedeu/output/direct.rb +59 -0
  37. data/lib/vedeu/output/renderers/terminal.rb +8 -0
  38. data/lib/vedeu/output/viewport.rb +2 -3
  39. data/lib/vedeu/{plugins.rb → plugins/plugins.rb} +0 -0
  40. data/lib/vedeu/refresh/refresh_cursor.rb +1 -0
  41. data/lib/vedeu/{repositories.rb → repositories/repositories.rb} +0 -0
  42. data/lib/vedeu/terminal/content.rb +88 -0
  43. data/lib/vedeu/terminal/mode.rb +79 -0
  44. data/lib/vedeu/{terminal.rb → terminal/terminal.rb} +9 -25
  45. data/lib/vedeu/version.rb +1 -1
  46. data/test/lib/vedeu/{bindings_test.rb → bindings/bindings_test.rb} +0 -0
  47. data/test/lib/vedeu/bindings/focus_test.rb +19 -0
  48. data/test/lib/vedeu/bindings/refresh_test.rb +19 -0
  49. data/test/lib/vedeu/bindings/system_test.rb +1 -6
  50. data/test/lib/vedeu/borders/render_border_test.rb +43 -10
  51. data/test/lib/vedeu/buffers/buffer_test.rb +18 -0
  52. data/test/lib/vedeu/buffers/virtual_buffer_test.rb +15 -0
  53. data/test/lib/vedeu/configuration/api_test.rb +18 -2
  54. data/test/lib/vedeu/configuration/cli_test.rb +5 -0
  55. data/test/lib/vedeu/cursor/move_test.rb +1 -1
  56. data/test/lib/vedeu/dsl/dsl_test.rb +8 -0
  57. data/test/lib/vedeu/dsl/shared_test.rb +12 -0
  58. data/test/lib/vedeu/{output → esc}/esc_test.rb +0 -0
  59. data/test/lib/vedeu/geometry/position_test.rb +56 -0
  60. data/test/lib/vedeu/input/capture_test.rb +63 -0
  61. data/test/lib/vedeu/input/editor/cropper_test.rb +82 -0
  62. data/test/lib/vedeu/input/editor/document_test.rb +190 -0
  63. data/test/lib/vedeu/input/editor/documents_test.rb +17 -0
  64. data/test/lib/vedeu/input/editor/editor_test.rb +170 -0
  65. data/test/lib/vedeu/input/editor/line_test.rb +333 -0
  66. data/test/lib/vedeu/input/editor/lines_test.rb +561 -0
  67. data/test/lib/vedeu/input/editor/virtual_cursor_test.rb +184 -0
  68. data/test/lib/vedeu/input/input_test.rb +20 -4
  69. data/test/lib/vedeu/input/input_translator_test.rb +32 -0
  70. data/test/lib/vedeu/internal_api_test.rb +1 -0
  71. data/test/lib/vedeu/models/escape_test.rb +6 -6
  72. data/test/lib/vedeu/models/views/view_test.rb +15 -2
  73. data/test/lib/vedeu/null/null_test.rb +8 -0
  74. data/test/lib/vedeu/output/direct_test.rb +70 -0
  75. data/test/lib/vedeu/{plugins_test.rb → plugins/plugins_test.rb} +0 -0
  76. data/test/lib/vedeu/{repositories_test.rb → repositories/repositories_test.rb} +0 -0
  77. data/test/lib/vedeu/terminal/content_test.rb +100 -0
  78. data/test/lib/vedeu/terminal/mode_test.rb +95 -0
  79. data/test/lib/vedeu/{terminal_test.rb → terminal/terminal_test.rb} +23 -23
  80. data/test/test_helper.rb +1 -0
  81. metadata +67 -20
  82. data/lib/vedeu/terminal_mode.rb +0 -59
  83. data/test/lib/vedeu/terminal_mode_test.rb +0 -72
@@ -0,0 +1,190 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Editor
6
+
7
+ describe Document do
8
+
9
+ let(:described) { Vedeu::Editor::Document }
10
+ let(:instance) { described.new(attributes) }
11
+ let(:attributes) {
12
+ {
13
+ data: data,
14
+ name: _name,
15
+ }
16
+ }
17
+ let(:data) {
18
+ "Hydrogen\n" \
19
+ "Helium\n" \
20
+ "Lithium\n"
21
+ }
22
+ let(:_name) { 'Vedeu::Editor::Document' }
23
+
24
+ before { Vedeu::Direct.stubs(:write) }
25
+
26
+ describe '#initialize' do
27
+ it { instance.must_be_instance_of(described) }
28
+ it { instance.instance_variable_get('@data').must_equal(data) }
29
+ it { instance.instance_variable_get('@name').must_equal(_name) }
30
+ it {
31
+ instance.instance_variable_get('@repository').
32
+ must_equal(Vedeu.documents)
33
+ }
34
+ end
35
+
36
+ describe 'accessors' do
37
+ it { instance.must_respond_to(:attributes) }
38
+ it { instance.must_respond_to(:data) }
39
+ it { instance.must_respond_to(:data=) }
40
+ it { instance.must_respond_to(:name) }
41
+ it { instance.must_respond_to(:name=) }
42
+ end
43
+
44
+ describe '#clear' do
45
+ subject { instance.clear }
46
+
47
+ end
48
+
49
+ describe '#delete_character' do
50
+ let(:y) { 0 }
51
+ let(:x) { 0 }
52
+
53
+ subject { instance.delete_character }
54
+
55
+ it { subject.must_be_instance_of(described) }
56
+
57
+ # it { skip }
58
+ end
59
+
60
+ describe '#delete_line' do
61
+ let(:y) { 0 }
62
+
63
+ subject { instance.delete_line }
64
+
65
+ it { subject.must_be_instance_of(described) }
66
+
67
+ # it { skip }
68
+ end
69
+
70
+ describe '#insert_character' do
71
+ let(:character) { 'a' }
72
+
73
+ subject { instance.insert_character(character) }
74
+
75
+ it { subject.must_be_instance_of(described) }
76
+
77
+ # it { skip }
78
+
79
+ context 'when the character is a Symbol' do
80
+ let(:character) { :a }
81
+
82
+ it { subject.must_equal(instance) }
83
+ end
84
+ end
85
+
86
+ describe '#insert_line' do
87
+ let(:y) { 2 }
88
+
89
+ subject { instance.insert_line }
90
+
91
+ it { subject.must_be_instance_of(described) }
92
+
93
+ # it { skip }
94
+ end
95
+
96
+ describe '#line' do
97
+ subject { instance.line }
98
+
99
+ context 'when the line is empty' do
100
+ let(:data) {}
101
+
102
+ it { subject.must_equal(Vedeu::Editor::Line.new('')) }
103
+ end
104
+
105
+ context 'when the line is not empty' do
106
+ it { subject.must_equal(Vedeu::Editor::Line.new('Hydrogen')) }
107
+ end
108
+
109
+ # context 'when y is set' do
110
+ # let(:y) { 2 }
111
+
112
+ # it { subject.must_equal(Vedeu::Editor::Line.new('Lithium')) }
113
+ # end
114
+ end
115
+
116
+ describe '#lines' do
117
+ subject { instance.lines }
118
+
119
+ context 'when the data is empty' do
120
+ let(:data) {}
121
+ let(:expected) {
122
+ Vedeu::Editor::Lines.new([Vedeu::Editor::Line.new])
123
+ }
124
+
125
+ it { subject.must_equal(expected) }
126
+ end
127
+
128
+ context 'when the data is not empty' do
129
+ let(:expected) {
130
+ Vedeu::Editor::Lines.new([
131
+ Vedeu::Editor::Line.new('Hydrogen'),
132
+ Vedeu::Editor::Line.new('Helium'),
133
+ Vedeu::Editor::Line.new('Lithium'),
134
+ ])
135
+ }
136
+
137
+ it { subject.must_equal(expected) }
138
+ end
139
+ end
140
+
141
+ describe '#render' do
142
+ let(:data) {
143
+ Vedeu::Editor::Lines.new([
144
+ Vedeu::Editor::Line.new('A'),
145
+ Vedeu::Editor::Line.new('B'),
146
+ Vedeu::Editor::Line.new('C'),
147
+ ])
148
+ }
149
+ let(:output) { "\e[1;1HA\e[2;1HB\e[3;1HC\e[1;1H\e[?25h" }
150
+
151
+ before { Vedeu::Direct.stubs(:write) }
152
+
153
+ subject { instance.render }
154
+
155
+ it {
156
+ Vedeu::Direct.expects(:write).with(value: output, x: 1, y: 1)
157
+ subject
158
+ }
159
+ end
160
+
161
+ describe '#reset!' do
162
+ subject { instance.reset! }
163
+
164
+ it { subject.must_be_instance_of(described) }
165
+ end
166
+
167
+ describe '#retrieve' do
168
+ subject { instance.retrieve }
169
+
170
+ it { subject.must_be_instance_of(String) }
171
+
172
+ it { subject.must_equal("Hydrogen\nHelium\nLithium") }
173
+ end
174
+
175
+ describe '#store' do
176
+ subject { instance.store }
177
+
178
+ it { subject.must_be_instance_of(described) }
179
+
180
+ it {
181
+ instance.expects(:render)
182
+ subject
183
+ }
184
+ end
185
+
186
+ end # Editor
187
+
188
+ end # Editor
189
+
190
+ end # Vedeu
@@ -0,0 +1,17 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Editor
6
+
7
+ describe Documents do
8
+
9
+ let(:described) { Vedeu::Editor::Documents }
10
+
11
+ it { described.must_respond_to(:documents) }
12
+
13
+ end # Documents
14
+
15
+ end # Editor
16
+
17
+ end # Vedeu
@@ -0,0 +1,170 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Editor
6
+
7
+ describe Editor do
8
+
9
+ let(:described) { Vedeu::Editor::Editor }
10
+ let(:instance) {
11
+ described.new(input: input, name: _name)
12
+ }
13
+ let(:input) {}
14
+ let(:_name) { 'Vedeu::Editor::Editor' }
15
+ let(:document) { Vedeu::Editor::Document.new(data: data, name: _name) }
16
+ let(:data) {
17
+ "Hydrogen\n" \
18
+ "Helium\n" \
19
+ "Lithium\n"
20
+ }
21
+
22
+ before do
23
+ Vedeu.documents.stubs(:by_name).returns(document)
24
+ # document.stubs(:clear)
25
+ # document.stubs(:delete_character)
26
+ # document.stubs(:delete_line)
27
+ # document.stubs(:down)
28
+ # document.stubs(:left)
29
+ # document.stubs(:right)
30
+ # document.stubs(:insert_character)
31
+ # document.stubs(:insert_line)
32
+ # document.stubs(:render)
33
+ # document.stubs(:reset!)
34
+ # document.stubs(:retrieve)
35
+ # document.stubs(:up)
36
+ end
37
+
38
+ describe '#initialize' do
39
+ it { instance.must_be_instance_of(described) }
40
+ it { instance.instance_variable_get('@input').must_equal(input) }
41
+ it { instance.instance_variable_get('@name').must_equal(_name) }
42
+ end
43
+
44
+ describe '.keypress' do
45
+ before { Vedeu::Terminal.stubs(:output) }
46
+
47
+ subject { described.keypress(input: input, name: _name) }
48
+
49
+ context 'when no name is given' do
50
+ let(:document) {}
51
+
52
+ it 'returns the input instead of sending to the document' do
53
+ subject.must_equal(input)
54
+ end
55
+ end
56
+
57
+ context 'when a name is given' do
58
+ context 'when the input is :backspace' do
59
+ let(:input) { :backspace }
60
+
61
+ it {
62
+ document.expects(:delete_character)
63
+ subject
64
+ }
65
+ end
66
+
67
+ context 'when the input is :ctrl_c' do
68
+ let(:input) { :ctrl_c }
69
+
70
+ it {
71
+ Vedeu.expects(:trigger).with(:_exit_)
72
+ subject
73
+ }
74
+ end
75
+
76
+ context 'when the input is :down' do
77
+ let(:input) { :down }
78
+
79
+ it {
80
+ document.expects(:down)
81
+ subject
82
+ }
83
+ end
84
+
85
+ context 'when the input is :enter' do
86
+ let(:input) { :enter }
87
+
88
+ it {
89
+ document.expects(:insert_line)
90
+ subject
91
+ }
92
+ end
93
+
94
+ context 'when the input is :escape' do
95
+ let(:input) { :escape }
96
+
97
+ it {
98
+ Vedeu.expects(:trigger).with(:_mode_switch_)
99
+ subject
100
+ }
101
+ end
102
+
103
+ context 'when the input is :left' do
104
+ let(:input) { :left }
105
+
106
+ it {
107
+ document.expects(:left)
108
+ subject
109
+ }
110
+ end
111
+
112
+ context 'when the input is :right' do
113
+ let(:input) { :right }
114
+
115
+ it {
116
+ document.expects(:right)
117
+ subject
118
+ }
119
+ end
120
+
121
+ context 'when the input is :tab' do
122
+ let(:input) { :tab }
123
+ let(:data) { mock(:empty? => false) }
124
+
125
+ # it {
126
+ # document.expects(:retrieve).returns(data)
127
+ # document.expects(:reset!)
128
+ # document.expects(:clear)
129
+ # Vedeu.expects(:trigger).with(:_command_, data)
130
+ # subject
131
+ # }
132
+ end
133
+
134
+ context 'when the input is :up' do
135
+ let(:input) { :up }
136
+
137
+ it {
138
+ document.expects(:up)
139
+ subject
140
+ }
141
+ end
142
+
143
+ context 'when the input is something else' do
144
+ context 'when the input is a symbol' do
145
+ let(:input) { :ctrl_p }
146
+
147
+ it { subject.must_be_instance_of(String) }
148
+ end
149
+
150
+ context 'when the input is not a symbol' do
151
+ let(:input) { 'a' }
152
+
153
+ it {
154
+ document.expects(:insert_character).with(input)
155
+ subject
156
+ }
157
+ end
158
+ end
159
+ end
160
+ end
161
+
162
+ describe '#keypress' do
163
+ it { instance.must_respond_to(:keypress) }
164
+ end
165
+
166
+ end # Editor
167
+
168
+ end # Editor
169
+
170
+ end # Vedeu
@@ -0,0 +1,333 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Editor
6
+
7
+ describe Line do
8
+
9
+ let(:described) { Vedeu::Editor::Line }
10
+ let(:instance) { described.new(line) }
11
+ let(:line) { 'Some text...' }
12
+
13
+ describe '#initialize' do
14
+ it { instance.must_be_instance_of(described) }
15
+ it { instance.instance_variable_get('@line').must_equal(line) }
16
+
17
+ context 'when a line is not given' do
18
+ let(:line) {}
19
+
20
+ it { instance.instance_variable_get('@line').must_equal('') }
21
+ end
22
+ end
23
+
24
+ describe 'accessors' do
25
+ it { instance.must_respond_to(:line) }
26
+ it { instance.must_respond_to(:line=) }
27
+ end
28
+
29
+ describe '.coerce' do
30
+ let(:_value) {}
31
+
32
+ subject { described.coerce(_value) }
33
+
34
+ it { subject.must_be_instance_of(Vedeu::Editor::Line) }
35
+
36
+ context 'when the value is already a Vedeu::Editor::Line object' do
37
+ let(:_value) { Vedeu::Editor::Line.new(line) }
38
+
39
+ it { subject.must_equal(_value) }
40
+ it { subject.line.must_equal(line) }
41
+ end
42
+
43
+ context 'when the value is an empty String' do
44
+ let(:_value) { '' }
45
+
46
+ it { subject.line.must_equal('') }
47
+ end
48
+
49
+ context 'when the value is an String' do
50
+ let(:_value) { line }
51
+
52
+ it { subject.line.must_equal(line) }
53
+ end
54
+ end
55
+
56
+ describe '#[]' do
57
+ subject { instance.[](index) }
58
+
59
+ context 'when index is a Fixnum' do
60
+ let(:index) { 2 }
61
+
62
+ it { subject.must_equal('m') }
63
+ end
64
+
65
+ context 'when index is a Range' do
66
+ let(:index) { (3..6) }
67
+
68
+ it { subject.must_equal('e te') }
69
+ end
70
+ end
71
+
72
+ describe '#character' do
73
+ let(:index) { 5 }
74
+
75
+ subject { instance.character(index) }
76
+
77
+ it { subject.must_be_instance_of(String) }
78
+
79
+ context 'when the line is empty' do
80
+ let(:line) { '' }
81
+
82
+ context 'and an index is not given' do
83
+ let(:index) {}
84
+
85
+ it { subject.must_equal('') }
86
+ end
87
+ end
88
+
89
+ context 'when the line is not empty' do
90
+ context 'when an index is not given' do
91
+ let(:index) {}
92
+
93
+ it { subject.must_equal('.') }
94
+ end
95
+
96
+ context 'when a negative index is given' do
97
+ let(:index) { -4 }
98
+
99
+ it { subject.must_equal('S') }
100
+ end
101
+
102
+ context 'when an index is given' do
103
+ it { subject.must_equal('t') }
104
+ end
105
+
106
+ context 'when an index of the last character of the line is given' do
107
+ let(:index) { 11 }
108
+
109
+ it { subject.must_equal('.') }
110
+ end
111
+
112
+ context 'when an index greater than the line length is given' do
113
+ let(:index) { 20 }
114
+
115
+ it { subject.must_equal('.') }
116
+ end
117
+ end
118
+ end
119
+
120
+ describe '#delete_character' do
121
+ let(:index) { 5 }
122
+
123
+ subject { instance.delete_character(index) }
124
+
125
+ it { subject.must_be_instance_of(Vedeu::Editor::Line) }
126
+
127
+ context 'when the line is empty' do
128
+ let(:line) { '' }
129
+
130
+ it { subject.line.must_equal('') }
131
+
132
+ context 'and an index is not given' do
133
+ let(:index) {}
134
+
135
+ it { subject.line.must_equal('') }
136
+ end
137
+ end
138
+
139
+ context 'when the line is not empty' do
140
+ context 'when an index is not given' do
141
+ let(:index) {}
142
+
143
+ it { subject.line.must_equal('Some text..') }
144
+ end
145
+
146
+ context 'when a negative index is given' do
147
+ let(:index) { -4 }
148
+
149
+ it { subject.line.must_equal('Some text...') }
150
+ end
151
+
152
+ context 'when an index is given' do
153
+ it { subject.line.must_equal('Some ext...') }
154
+ end
155
+
156
+ context 'when an index of the last character of the line is given' do
157
+ let(:index) { 11 }
158
+
159
+ it { subject.line.must_equal('Some text..') }
160
+ end
161
+
162
+ context 'when an index greater than the line length is given' do
163
+ let(:index) { 20 }
164
+
165
+ it { subject.line.must_equal('Some text..') }
166
+ end
167
+ end
168
+ end
169
+
170
+ describe '#empty?' do
171
+ subject { instance.empty? }
172
+
173
+ context 'when the line is empty' do
174
+ let(:line) {}
175
+
176
+ it { subject.must_equal(true) }
177
+ end
178
+
179
+ context 'when the line is not empty' do
180
+ it { subject.must_equal(false) }
181
+ end
182
+ end
183
+
184
+ describe '#eql?' do
185
+ let(:other) { instance }
186
+
187
+ subject { instance.eql?(other) }
188
+
189
+ it { subject.must_equal(true) }
190
+
191
+ context 'when different to other' do
192
+ let(:other) { described.new('Other text...') }
193
+
194
+ it { subject.must_equal(false) }
195
+ end
196
+ end
197
+
198
+ describe '#insert_character' do
199
+ let(:character) { 'a' }
200
+ let(:index) { 5 }
201
+
202
+ subject { instance.insert_character(character, index) }
203
+
204
+ it { subject.must_be_instance_of(Vedeu::Editor::Line) }
205
+
206
+ context 'when the line is empty' do
207
+ let(:line) {}
208
+
209
+ it { subject.line.must_equal('a') }
210
+
211
+ context 'and an index is not given' do
212
+ let(:index) {}
213
+
214
+ it { subject.line.must_equal('a') }
215
+ end
216
+
217
+ context 'and a negative index is given' do
218
+ let(:index) { -4 }
219
+
220
+ it { subject.line.must_equal('a') }
221
+ end
222
+
223
+ context 'and an index is given' do
224
+ it { subject.line.must_equal('a') }
225
+ end
226
+
227
+ context 'and an index of the last character of the line is given' do
228
+ let(:index) { 0 }
229
+
230
+ it { subject.line.must_equal('a') }
231
+ end
232
+
233
+ context 'and an index greater than the line length is given' do
234
+ let(:index) { 20 }
235
+
236
+ it { subject.line.must_equal('a') }
237
+ end
238
+ end
239
+
240
+ context 'when the line is not empty' do
241
+ context 'and an index is not given' do
242
+ let(:index) {}
243
+
244
+ it { subject.line.must_equal('Some text...a') }
245
+ end
246
+
247
+ context 'and a negative index is given' do
248
+ let(:index) { -4 }
249
+
250
+ it { subject.line.must_equal('aSome text...') }
251
+ end
252
+
253
+ context 'and an index is given' do
254
+ it { subject.line.must_equal('Some atext...') }
255
+ end
256
+
257
+ context 'and an index of the last character of the line is given' do
258
+ let(:index) { 12 }
259
+
260
+ it { subject.line.must_equal('Some text...a') }
261
+ end
262
+
263
+ context 'and an index greater than the line length is given' do
264
+ let(:index) { 20 }
265
+
266
+ it { subject.line.must_equal('Some text...a') }
267
+ end
268
+ end
269
+ end
270
+
271
+ describe '#size' do
272
+ subject { instance.size }
273
+
274
+ context 'when the line is empty' do
275
+ let(:line) {}
276
+
277
+ it { subject.must_equal(0) }
278
+ end
279
+
280
+ context 'when the line is not empty' do
281
+ it { subject.must_equal(12) }
282
+ end
283
+ end
284
+
285
+ describe '#to_chars' do
286
+ subject { instance.to_chars }
287
+
288
+ context 'when the line is empty' do
289
+ let(:line) {}
290
+
291
+ it { subject.must_equal([]) }
292
+ end
293
+
294
+ context 'when the line is not empty' do
295
+ let(:expected) {
296
+ [
297
+ Vedeu::Views::Char.new(value: 'S'),
298
+ Vedeu::Views::Char.new(value: 'o'),
299
+ Vedeu::Views::Char.new(value: 'm'),
300
+ Vedeu::Views::Char.new(value: 'e'),
301
+ Vedeu::Views::Char.new(value: ' '),
302
+ Vedeu::Views::Char.new(value: 't'),
303
+ Vedeu::Views::Char.new(value: 'e'),
304
+ Vedeu::Views::Char.new(value: 'x'),
305
+ Vedeu::Views::Char.new(value: 't'),
306
+ Vedeu::Views::Char.new(value: '.'),
307
+ Vedeu::Views::Char.new(value: '.'),
308
+ Vedeu::Views::Char.new(value: '.'),
309
+ ]
310
+ }
311
+ it { subject.must_equal(expected) }
312
+ end
313
+ end
314
+
315
+ describe '#to_s' do
316
+ subject { instance.to_s }
317
+
318
+ context 'when the line is empty' do
319
+ let(:line) {}
320
+
321
+ it { subject.must_equal('') }
322
+ end
323
+
324
+ context 'when the line is not empty' do
325
+ it { subject.must_equal('Some text...') }
326
+ end
327
+ end
328
+
329
+ end # Line
330
+
331
+ end # Editor
332
+
333
+ end # Vedeu