vedeu 0.6.9 → 0.6.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/lib/vedeu/all.rb +3 -3
  4. data/lib/vedeu/api/external.rb +194 -0
  5. data/lib/vedeu/api/internal.rb +173 -0
  6. data/lib/vedeu/application/controller.rb +3 -2
  7. data/lib/vedeu/bindings/application.rb +1 -1
  8. data/lib/vedeu/bindings/drb.rb +2 -3
  9. data/lib/vedeu/bindings/movement.rb +1 -1
  10. data/lib/vedeu/buffers/all.rb +0 -2
  11. data/lib/vedeu/colours/translator.rb +2 -1
  12. data/lib/vedeu/common.rb +4 -2
  13. data/lib/vedeu/configuration/api.rb +1 -1
  14. data/lib/vedeu/configuration/cli.rb +1 -1
  15. data/lib/vedeu/cursors/repository.rb +1 -1
  16. data/lib/vedeu/editor/insert.rb +12 -13
  17. data/lib/vedeu/geometry/position.rb +1 -1
  18. data/lib/vedeu/models/cell.rb +35 -21
  19. data/lib/vedeu/models/escape.rb +18 -1
  20. data/lib/vedeu/models/page.rb +20 -10
  21. data/lib/vedeu/models/row.rb +18 -8
  22. data/lib/vedeu/models/views/char.rb +9 -7
  23. data/lib/vedeu/models/views/view.rb +1 -1
  24. data/lib/vedeu/output/compressor.rb +22 -14
  25. data/lib/vedeu/output/output.rb +1 -10
  26. data/lib/vedeu/output/renderers/escape_sequence.rb +8 -4
  27. data/lib/vedeu/output/renderers/file.rb +7 -23
  28. data/lib/vedeu/output/renderers/html.rb +47 -26
  29. data/lib/vedeu/output/renderers/json.rb +11 -16
  30. data/lib/vedeu/output/renderers/null.rb +1 -1
  31. data/lib/vedeu/output/renderers/renderer_options.rb +2 -1
  32. data/lib/vedeu/output/renderers/terminal.rb +7 -15
  33. data/lib/vedeu/output/renderers/text.rb +1 -1
  34. data/lib/vedeu/output/viewport.rb +154 -143
  35. data/lib/vedeu/repositories/collection.rb +2 -2
  36. data/lib/vedeu/repositories/model.rb +25 -26
  37. data/lib/vedeu/repositories/registerable.rb +9 -8
  38. data/lib/vedeu/repositories/repository.rb +21 -16
  39. data/lib/vedeu/repositories/store.rb +6 -4
  40. data/lib/vedeu/runtime/bootstrap.rb +7 -5
  41. data/lib/vedeu/runtime/main_loop.rb +2 -0
  42. data/lib/vedeu/runtime/router.rb +155 -149
  43. data/lib/vedeu/templating/decoder.rb +8 -5
  44. data/lib/vedeu/templating/encoder.rb +6 -4
  45. data/lib/vedeu/templating/template.rb +2 -2
  46. data/lib/vedeu/templating/view_template.rb +8 -7
  47. data/lib/vedeu/terminal/buffer.rb +132 -0
  48. data/lib/vedeu/terminal/terminal.rb +0 -5
  49. data/lib/vedeu/version.rb +1 -1
  50. data/lib/vedeu.rb +2 -2
  51. data/out_ +50 -0
  52. data/test/lib/vedeu/api/external_test.rb +62 -0
  53. data/test/lib/vedeu/{internal_api_test.rb → api/internal_test.rb} +6 -2
  54. data/test/lib/vedeu/application/controller_test.rb +3 -3
  55. data/test/lib/vedeu/bindings/application_test.rb +2 -2
  56. data/test/lib/vedeu/models/cell_test.rb +48 -17
  57. data/test/lib/vedeu/models/escape_test.rb +29 -7
  58. data/test/lib/vedeu/models/page_test.rb +70 -50
  59. data/test/lib/vedeu/models/row_test.rb +40 -20
  60. data/test/lib/vedeu/output/compressor_test.rb +12 -12
  61. data/test/lib/vedeu/output/output_test.rb +17 -23
  62. data/test/lib/vedeu/output/renderers/escape_sequence_test.rb +15 -11
  63. data/test/lib/vedeu/output/renderers/html_test.rb +66 -68
  64. data/test/lib/vedeu/output/renderers/json_test.rb +36 -83
  65. data/test/lib/vedeu/output/renderers/terminal_test.rb +22 -2
  66. data/test/lib/vedeu/output/viewport_test.rb +201 -197
  67. data/test/lib/vedeu/runtime/router_test.rb +144 -140
  68. data/test/lib/vedeu/terminal/buffer_test.rb +307 -0
  69. data/test/support/examples/material_colours_app.rb +2 -2
  70. data/test/support/templates/html_renderer.vedeu +24 -0
  71. metadata +14 -17
  72. data/lib/vedeu/api.rb +0 -190
  73. data/lib/vedeu/buffers/virtual_buffer.rb +0 -136
  74. data/lib/vedeu/buffers/virtual_buffers.rb +0 -77
  75. data/lib/vedeu/internal_api.rb +0 -173
  76. data/lib/vedeu/terminal/content.rb +0 -88
  77. data/test/lib/vedeu/api_test.rb +0 -58
  78. data/test/lib/vedeu/buffers/virtual_buffer_test.rb +0 -148
  79. data/test/lib/vedeu/buffers/virtual_buffers_test.rb +0 -73
  80. data/test/lib/vedeu/terminal/content_test.rb +0 -108
@@ -0,0 +1,62 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module API
6
+
7
+ describe External do
8
+
9
+ it { Vedeu.must_respond_to(:bind) }
10
+ it { Vedeu.must_respond_to(:bind_alias) }
11
+ it { Vedeu.must_respond_to(:border) }
12
+ it { Vedeu.must_respond_to(:bound?) }
13
+ it { Vedeu.must_respond_to(:clear) }
14
+ it { Vedeu.must_respond_to(:clear_by_group) }
15
+ it { Vedeu.must_respond_to(:clear_by_name) }
16
+ it { Vedeu.must_respond_to(:configuration) }
17
+ it { Vedeu.must_respond_to(:configure) }
18
+ it { Vedeu.must_respond_to(:cursor) }
19
+ it { Vedeu.must_respond_to(:drb_restart) }
20
+ it { Vedeu.must_respond_to(:drb_start) }
21
+ it { Vedeu.must_respond_to(:drb_status) }
22
+ it { Vedeu.must_respond_to(:drb_stop) }
23
+ it { Vedeu.must_respond_to(:events) }
24
+ it { Vedeu.must_respond_to(:exit) }
25
+ it { Vedeu.must_respond_to(:focus) }
26
+ it { Vedeu.must_respond_to(:focus_by_name) }
27
+ it { Vedeu.must_respond_to(:focus_next) }
28
+ it { Vedeu.must_respond_to(:focus_previous) }
29
+ it { Vedeu.must_respond_to(:focussed?) }
30
+ it { Vedeu.must_respond_to(:geometry) }
31
+ it { Vedeu.must_respond_to(:goto) }
32
+ it { Vedeu.must_respond_to(:group) }
33
+ it { Vedeu.must_respond_to(:height) }
34
+ it { Vedeu.must_respond_to(:hide_cursor) }
35
+ it { Vedeu.must_respond_to(:hide_group) }
36
+ it { Vedeu.must_respond_to(:hide_interface) }
37
+ it { Vedeu.must_respond_to(:interface) }
38
+ it { Vedeu.must_respond_to(:keymap) }
39
+ it { Vedeu.must_respond_to(:keypress) }
40
+ it { Vedeu.must_respond_to(:log) }
41
+ it { Vedeu.must_respond_to(:log_stderr) }
42
+ it { Vedeu.must_respond_to(:log_stdout) }
43
+ it { Vedeu.must_respond_to(:menu) }
44
+ it { Vedeu.must_respond_to(:render) }
45
+ it { Vedeu.must_respond_to(:renders) }
46
+ it { Vedeu.must_respond_to(:show_cursor) }
47
+ it { Vedeu.must_respond_to(:show_group) }
48
+ it { Vedeu.must_respond_to(:show_interface) }
49
+ it { Vedeu.must_respond_to(:toggle_cursor) }
50
+ it { Vedeu.must_respond_to(:toggle_group) }
51
+ it { Vedeu.must_respond_to(:toggle_interface) }
52
+ it { Vedeu.must_respond_to(:trigger) }
53
+ it { Vedeu.must_respond_to(:unbind) }
54
+ it { Vedeu.must_respond_to(:unbind_alias) }
55
+ it { Vedeu.must_respond_to(:views) }
56
+ it { Vedeu.must_respond_to(:width) }
57
+
58
+ end # External
59
+
60
+ end
61
+
62
+ end # Vedeu
@@ -2,7 +2,9 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
- describe InternalAPI do
5
+ module API
6
+
7
+ describe Internal do
6
8
 
7
9
  it { Vedeu.must_respond_to(:background_colours) }
8
10
  it { Vedeu.must_respond_to(:borders) }
@@ -24,6 +26,8 @@ module Vedeu
24
26
  it { Vedeu.must_respond_to(:resize) }
25
27
  it { Vedeu.must_respond_to(:timer) }
26
28
 
27
- end # InternalAPI
29
+ end # Internal
30
+
31
+ end # API
28
32
 
29
33
  end # Vedeu
@@ -30,7 +30,7 @@ module Vedeu
30
30
  subject { described_model.controller(:some_controller) }
31
31
 
32
32
  it {
33
- Vedeu::Router.expects(:add_controller).
33
+ Vedeu::Runtime::Router.expects(:add_controller).
34
34
  with(:some_controller, 'Vedeu::ControllerTestKlass')
35
35
  subject
36
36
  }
@@ -42,9 +42,9 @@ module Vedeu
42
42
  subject { described_model.action(:some_action, :other_action) }
43
43
 
44
44
  it {
45
- Vedeu::Router.expects(:add_action).
45
+ Vedeu::Runtime::Router.expects(:add_action).
46
46
  with(:some_controller, :some_action)
47
- Vedeu::Router.expects(:add_action).
47
+ Vedeu::Runtime::Router.expects(:add_action).
48
48
  with(:some_controller, :other_action)
49
49
  subject
50
50
  }
@@ -20,12 +20,12 @@ module Vedeu
20
20
  }
21
21
  }
22
22
 
23
- before { Vedeu::Router.stubs(:goto) }
23
+ before { Vedeu::Runtime::Router.stubs(:goto) }
24
24
 
25
25
  subject { Vedeu.trigger(:_goto_, controller, action, **args) }
26
26
 
27
27
  it {
28
- Vedeu::Router.expects(:goto)
28
+ Vedeu::Runtime::Router.expects(:goto)
29
29
  .with(:some_controller, :show_basket, args)
30
30
  subject
31
31
  }
@@ -10,38 +10,33 @@ module Vedeu
10
10
  let(:instance) { described.new(attributes) }
11
11
  let(:attributes) {
12
12
  {
13
- colour: colour,
14
- style: style,
15
- value: _value,
16
- x: x,
17
- y: y,
13
+ colour: colour,
14
+ style: style,
15
+ value: _value,
16
+ position: position,
18
17
  }
19
18
  }
20
- let(:colour) { Vedeu::Colours::Colour.new(background: '#000000') }
21
- let(:style) {}
22
- let(:_value) {}
23
- let(:x) {}
24
- let(:y) {}
19
+ let(:colour) { Vedeu::Colours::Colour.new(background: '#000000') }
20
+ let(:style) {}
21
+ let(:_value) {}
22
+ let(:position) {}
25
23
 
26
24
  describe '#initialize' do
27
25
  it { instance.must_be_instance_of(described) }
28
26
  it { instance.instance_variable_get('@colour').must_equal(colour) }
29
27
  it { instance.instance_variable_get('@style').must_equal(style) }
30
- it { instance.instance_variable_get('@value').must_equal(_value) }
31
- it { instance.instance_variable_get('@x').must_equal(x) }
32
- it { instance.instance_variable_get('@y').must_equal(y) }
28
+ it { instance.instance_variable_get('@value').must_equal('') }
29
+ it { instance.instance_variable_get('@position').must_equal([1, 1]) }
33
30
  end
34
31
 
35
32
  describe 'accessors' do
36
33
  it { instance.must_respond_to(:colour) }
37
34
  it { instance.must_respond_to(:style) }
38
35
  it { instance.must_respond_to(:value) }
39
- it { instance.must_respond_to(:x) }
40
- it { instance.must_respond_to(:y) }
41
36
  end
42
37
 
43
38
  describe '#eql?' do
44
- let(:other) { described.new(value: nil) }
39
+ let(:other) { described.new(value: nil, position: nil) }
45
40
 
46
41
  subject { instance.eql?(other) }
47
42
 
@@ -50,12 +45,48 @@ module Vedeu
50
45
  it { subject.must_equal(true) }
51
46
 
52
47
  context 'when different to other' do
53
- let(:other) { described.new(value: 'b') }
48
+ let(:other) { described.new(value: 'b', position: [2, 3]) }
54
49
 
55
50
  it { subject.must_equal(false) }
56
51
  end
57
52
  end
58
53
 
54
+ describe '#position' do
55
+ subject { instance.position }
56
+
57
+ it { subject.must_be_instance_of(Vedeu::Geometry::Position) }
58
+ end
59
+
60
+ describe '#to_hash' do
61
+ let(:expected) {
62
+ {
63
+ colour: "\e[48;2;0;0;0m",
64
+ style: '',
65
+ value: '',
66
+ position: "\e[1;1H",
67
+ }
68
+ }
69
+
70
+ subject { instance.to_hash }
71
+
72
+ it { subject.must_be_instance_of(Hash) }
73
+ it { subject.must_equal(expected) }
74
+ end
75
+
76
+ describe '#to_html' do
77
+ subject { instance.to_html }
78
+
79
+ it { subject.must_be_instance_of(String) }
80
+ it { subject.must_equal('') }
81
+ end
82
+
83
+ describe '#to_s' do
84
+ subject { instance.to_s }
85
+
86
+ it { subject.must_be_instance_of(String) }
87
+ it { subject.must_equal('') }
88
+ end
89
+
59
90
  end # Cell
60
91
 
61
92
  end # Models
@@ -10,22 +10,19 @@ module Vedeu
10
10
  let(:instance) { described.new(attributes) }
11
11
  let(:attributes) {
12
12
  {
13
- value: _value,
14
13
  position: position,
14
+ value: _value,
15
15
  }
16
16
  }
17
- let(:_value) { "\e[?25h" }
18
17
  let(:position) { [2, 6] }
18
+ let(:_value) { "\e[?25h" }
19
19
 
20
20
  describe '#initialize' do
21
21
  it { instance.must_be_instance_of(described) }
22
+ it { instance.instance_variable_get('@position').must_equal(position) }
22
23
  it { instance.instance_variable_get('@value').must_equal(_value) }
23
24
  end
24
25
 
25
- describe 'accessors' do
26
- it { instance.must_respond_to(:value) }
27
- end
28
-
29
26
  describe '#null' do
30
27
  it { instance.null.must_equal(nil) }
31
28
  it { instance.background.must_equal(nil) }
@@ -54,13 +51,38 @@ module Vedeu
54
51
  it { instance.position.must_be_instance_of(Vedeu::Geometry::Position) }
55
52
  end
56
53
 
54
+ describe '#position' do
55
+ subject { instance.position }
56
+
57
+ it { subject.must_be_instance_of(Vedeu::Geometry::Position) }
58
+ end
59
+
57
60
  describe '#value' do
58
- it { instance.value.must_be_instance_of(String) }
61
+ subject { instance.value }
62
+
63
+ it { subject.must_be_instance_of(String) }
64
+ it { subject.must_equal("\e[?25h") }
65
+ end
66
+
67
+ describe '#to_hash' do
68
+ subject { instance.to_hash }
69
+
70
+ it { subject.must_be_instance_of(Hash) }
71
+ it { subject.must_equal({}) }
72
+ end
73
+
74
+ describe '#to_html' do
75
+ subject { instance.to_html }
76
+
77
+ it { subject.must_be_instance_of(String) }
78
+ it { subject.must_equal('') }
59
79
  end
60
80
 
61
81
  describe '#to_s' do
62
82
  subject { instance.to_s }
63
83
 
84
+ it { subject.must_be_instance_of(String) }
85
+ it { subject.must_equal("\e[2;6H\e[?25h") }
64
86
  it { instance.must_respond_to(:to_str) }
65
87
  end
66
88
 
@@ -130,56 +130,6 @@ module Vedeu
130
130
  end
131
131
  end
132
132
 
133
- describe '#each' do
134
- subject { instance.each }
135
-
136
- it { subject.must_be_instance_of(Enumerator) }
137
- end
138
-
139
- describe '#eql?' do
140
- let(:other) { instance }
141
-
142
- subject { instance.eql?(other) }
143
-
144
- it { subject.must_equal(true) }
145
-
146
- context 'when different to other' do
147
- let(:other) { described.new([:hydrogen]) }
148
-
149
- it { subject.must_equal(false) }
150
- end
151
- end
152
-
153
- describe '#row' do
154
- let(:index) {}
155
-
156
- subject { instance.row(index) }
157
-
158
- context 'when the index is nil' do
159
- it { subject.must_equal(nil) }
160
- end
161
-
162
- context 'when the index is not nil' do
163
- context 'and the index is in range' do
164
- let(:index) { 1 }
165
-
166
- it { subject.must_equal([:beryllium, :boron, :carbon]) }
167
- end
168
-
169
- context 'and the index is out of range' do
170
- let(:index) { 4 }
171
-
172
- it { subject.must_equal(nil) }
173
- end
174
-
175
- context 'and the index is out of range' do
176
- let(:index) { -4 }
177
-
178
- it { subject.must_equal(nil) }
179
- end
180
- end
181
- end
182
-
183
133
  describe '#cell' do
184
134
  let(:row_index) {}
185
135
  let(:cell_index) {}
@@ -235,6 +185,76 @@ module Vedeu
235
185
  end
236
186
  end
237
187
 
188
+ # describe '#content' do
189
+ # subject { instance.content }
190
+
191
+ # it { subject.must_equal() }
192
+ # end
193
+
194
+ describe '#each' do
195
+ subject { instance.each }
196
+
197
+ it { subject.must_be_instance_of(Enumerator) }
198
+ end
199
+
200
+ describe '#empty?' do
201
+ subject { instance.empty? }
202
+
203
+ context 'when the page is empty' do
204
+ let(:rows) { [] }
205
+
206
+ it { subject.must_equal(true) }
207
+ end
208
+
209
+ context 'when the pages is not empty' do
210
+ it { subject.must_equal(false) }
211
+ end
212
+ end
213
+
214
+ describe '#eql?' do
215
+ let(:other) { instance }
216
+
217
+ subject { instance.eql?(other) }
218
+
219
+ it { subject.must_equal(true) }
220
+
221
+ context 'when different to other' do
222
+ let(:other) { described.new([:hydrogen]) }
223
+
224
+ it { subject.must_equal(false) }
225
+ end
226
+ end
227
+
228
+ describe '#row' do
229
+ let(:index) {}
230
+
231
+ subject { instance.row(index) }
232
+
233
+ context 'when the index is nil' do
234
+ it { subject.must_equal(nil) }
235
+ end
236
+
237
+ context 'when the index is not nil' do
238
+ context 'and the index is in range' do
239
+ let(:index) { 1 }
240
+
241
+ it { subject.must_equal([:beryllium, :boron, :carbon]) }
242
+ end
243
+
244
+ context 'and the index is out of range' do
245
+ let(:index) { 4 }
246
+
247
+ it { subject.must_equal(nil) }
248
+ end
249
+
250
+ context 'and the index is out of range' do
251
+ let(:index) { -4 }
252
+
253
+ it { subject.must_equal(nil) }
254
+ end
255
+ end
256
+ end
257
+
238
258
  end # Page
239
259
 
240
260
  end # Models
@@ -58,26 +58,6 @@ module Vedeu
58
58
  end
59
59
  end
60
60
 
61
- describe '#each' do
62
- subject { instance.each }
63
-
64
- it { subject.must_be_instance_of(Enumerator) }
65
- end
66
-
67
- describe '#eql?' do
68
- let(:other) { instance }
69
-
70
- subject { instance.eql?(other) }
71
-
72
- it { subject.must_equal(true) }
73
-
74
- context 'when different to other' do
75
- let(:other) { described.new([:hydrogen]) }
76
-
77
- it { subject.must_equal(false) }
78
- end
79
- end
80
-
81
61
  describe '#cell' do
82
62
  let(:index) {}
83
63
 
@@ -108,6 +88,46 @@ module Vedeu
108
88
  end
109
89
  end
110
90
 
91
+ # describe '#content' do
92
+ # subject { instance.content }
93
+
94
+ # it { subject.must_equal() }
95
+ # end
96
+
97
+ describe '#each' do
98
+ subject { instance.each }
99
+
100
+ it { subject.must_be_instance_of(Enumerator) }
101
+ end
102
+
103
+ describe '#empty?' do
104
+ subject { instance.empty? }
105
+
106
+ context 'when the row is empty' do
107
+ let(:cells) { [] }
108
+
109
+ it { subject.must_equal(true) }
110
+ end
111
+
112
+ context 'when the row is not empty' do
113
+ it { subject.must_equal(false) }
114
+ end
115
+ end
116
+
117
+ describe '#eql?' do
118
+ let(:other) { instance }
119
+
120
+ subject { instance.eql?(other) }
121
+
122
+ it { subject.must_equal(true) }
123
+
124
+ context 'when different to other' do
125
+ let(:other) { described.new([:hydrogen]) }
126
+
127
+ it { subject.must_equal(false) }
128
+ end
129
+ end
130
+
111
131
  end # Row
112
132
 
113
133
  end # Models
@@ -27,14 +27,14 @@ module Vedeu
27
27
 
28
28
  context 'when the output is all Vedeu::Views::Char elements' do
29
29
  let(:output) {
30
- [
30
+ Vedeu::Models::Page.coerce([
31
31
  Vedeu::Views::Char.new(value: 'Y',
32
32
  colour: { foreground: '#ff0000' }),
33
33
  Vedeu::Views::Char.new(value: 'e',
34
34
  colour: { foreground: '#ff0000' }),
35
35
  Vedeu::Views::Char.new(value: 's',
36
36
  colour: { foreground: '#ff0000' }),
37
- ]
37
+ ])
38
38
  }
39
39
  it 'converts the non-Vedeu::Views::Char elements into String ' \
40
40
  'elements' do
@@ -44,7 +44,7 @@ module Vedeu
44
44
 
45
45
  context 'when the output is all Vedeu::Views::Char elements' do
46
46
  let(:output) {
47
- [
47
+ Vedeu::Models::Page.coerce([
48
48
  Vedeu::Views::Char.new(value: 'a',
49
49
  colour: { foreground: '#ff0000' }),
50
50
  Vedeu::Views::Char.new(value: 'b',
@@ -53,7 +53,7 @@ module Vedeu
53
53
  colour: { foreground: '#0000ff' }),
54
54
  Vedeu::Views::Char.new(value: 'd',
55
55
  colour: { foreground: '#0000ff' }),
56
- ]
56
+ ])
57
57
  }
58
58
  it 'compresses multiple colours and styles where possible' do
59
59
  subject.must_equal("\e[38;2;255;0;0mab\e[38;2;0;0;255mcd")
@@ -63,11 +63,11 @@ module Vedeu
63
63
  context 'when the output is not all Vedeu::Views::Char ' \
64
64
  'elements' do
65
65
  let(:output) {
66
- [
66
+ Vedeu::Models::Page.coerce([
67
67
  Vedeu::Views::Char.new(value: 'N'),
68
68
  Vedeu::Models::Escape.new(value: "\e[?25l"),
69
69
  Vedeu::Views::Char.new(value: 't'),
70
- ]
70
+ ])
71
71
  }
72
72
  it 'converts the non-Vedeu::Views::Char elements into String ' \
73
73
  'elements' do
@@ -81,14 +81,14 @@ module Vedeu
81
81
 
82
82
  context 'when the output is all Vedeu::Views::Char elements' do
83
83
  let(:output) {
84
- [
84
+ Vedeu::Models::Page.coerce([
85
85
  Vedeu::Views::Char.new(value: 'Y',
86
86
  colour: { foreground: '#ff0000' }),
87
87
  Vedeu::Views::Char.new(value: 'e',
88
88
  colour: { foreground: '#ff0000' }),
89
89
  Vedeu::Views::Char.new(value: 's',
90
90
  colour: { foreground: '#ff0000' }),
91
- ]
91
+ ])
92
92
  }
93
93
  it 'converts the non-Vedeu::Views::Char elements into String ' \
94
94
  'elements' do
@@ -100,7 +100,7 @@ module Vedeu
100
100
 
101
101
  context 'when the output is all Vedeu::Views::Char elements' do
102
102
  let(:output) {
103
- [
103
+ Vedeu::Models::Page.coerce([
104
104
  Vedeu::Views::Char.new(value: 'a',
105
105
  colour: { foreground: '#ff0000' }),
106
106
  Vedeu::Views::Char.new(value: 'b',
@@ -109,7 +109,7 @@ module Vedeu
109
109
  colour: { foreground: '#0000ff' }),
110
110
  Vedeu::Views::Char.new(value: 'd',
111
111
  colour: { foreground: '#0000ff' }),
112
- ]
112
+ ])
113
113
  }
114
114
  it 'compresses multiple colours and styles where possible' do
115
115
  subject.must_equal(
@@ -123,11 +123,11 @@ module Vedeu
123
123
 
124
124
  context 'when the output is not all Vedeu::Views::Char elements' do
125
125
  let(:output) {
126
- [
126
+ Vedeu::Models::Page.coerce([
127
127
  Vedeu::Views::Char.new(value: 'N'),
128
128
  Vedeu::Models::Escape.new(value: "\e[?25l"),
129
129
  Vedeu::Views::Char.new(value: 't'),
130
- ]
130
+ ])
131
131
  }
132
132
  it 'converts the non-Vedeu::Views::Char elements into String ' \
133
133
  'elements' do
@@ -11,40 +11,34 @@ module Vedeu
11
11
  let(:output) {}
12
12
  let(:drb) { false }
13
13
 
14
- before { Vedeu::Configuration.stubs(:drb?).returns(drb) }
15
-
16
14
  describe '#initialize' do
17
15
  it { instance.must_be_instance_of(described) }
18
16
  it { instance.instance_variable_get('@output').must_equal(output) }
19
17
  end
20
18
 
21
19
  describe '.render' do
22
- before { Vedeu.renderers.stubs(:render) }
23
-
24
- subject { described.render(output) }
20
+ # let(:buffer) { mock }
25
21
 
26
- context 'when DRb is enabled' do
27
- let(:drb) { true }
28
- let(:virtual_buffer) { [] }
22
+ # before do
23
+ # Vedeu::Terminal::Buffer.stubs(:write).returns(buffer)
24
+ # buffer.stubs(:render)
25
+ # end
29
26
 
30
- before do
31
- Vedeu::Configuration.stubs(:drb?).returns(drb)
32
- # Vedeu::Renderers::HTML.stubs(:to_file)
33
- # Vedeu::Buffers::VirtualBuffers.stubs(:retrieve).returns(virtual_buffer)
34
- end
27
+ # subject { described.render(output) }
35
28
 
36
- it {
37
- Vedeu.expects(:trigger).with(:_drb_store_output_, output)
38
- subject
39
- }
29
+ # it {
30
+ # Vedeu::Terminal::Buffer.expects(:write).with(output)
31
+ # subject
32
+ # }
40
33
 
41
- # it 'writes the virtual buffer to a file' do
42
- # Vedeu::Renderers::HTML.expects(:to_file).with(virtual_buffer)
43
- # subject
44
- # end
45
- end
34
+ # it {
35
+ # buffer.expects(:render)
36
+ # subject
37
+ # }
38
+ end
46
39
 
47
- it { Vedeu.renderers.expects(:render).with(output); subject }
40
+ describe '#render' do
41
+ it { instance.must_respond_to(:render) }
48
42
  end
49
43
 
50
44
  end # Output