vedeu 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/docs/dsl.md +3 -3
  3. data/examples/borders_app.rb +2 -0
  4. data/examples/colours_app.rb +2 -0
  5. data/examples/configuration_app.rb +2 -0
  6. data/examples/drb_app.rb +2 -0
  7. data/examples/focus_app.rb +2 -0
  8. data/examples/hello_world.rb +2 -0
  9. data/examples/material_colours_app.rb +2 -0
  10. data/lib/vedeu.rb +2 -0
  11. data/lib/vedeu/all.rb +4 -13
  12. data/lib/vedeu/api.rb +7 -6
  13. data/lib/vedeu/borders/border.rb +1 -1
  14. data/lib/vedeu/borders/render_border.rb +18 -18
  15. data/lib/vedeu/buffers/buffer.rb +18 -28
  16. data/lib/vedeu/colours/colour.rb +1 -1
  17. data/lib/vedeu/colours/colour_translator.rb +1 -1
  18. data/lib/vedeu/cursor/cursor.rb +9 -6
  19. data/lib/vedeu/dsl/border.rb +1 -1
  20. data/lib/vedeu/dsl/composition.rb +5 -5
  21. data/lib/vedeu/dsl/geometry.rb +1 -1
  22. data/lib/vedeu/dsl/group.rb +1 -1
  23. data/lib/vedeu/dsl/interface.rb +69 -93
  24. data/lib/vedeu/dsl/keymap.rb +1 -1
  25. data/lib/vedeu/dsl/line.rb +11 -11
  26. data/lib/vedeu/dsl/shared.rb +81 -0
  27. data/lib/vedeu/dsl/stream.rb +3 -3
  28. data/lib/vedeu/dsl/view.rb +76 -64
  29. data/lib/vedeu/models/escape.rb +1 -1
  30. data/lib/vedeu/models/interface.rb +3 -57
  31. data/lib/vedeu/models/menu.rb +1 -1
  32. data/lib/vedeu/models/views/all.rb +22 -0
  33. data/lib/vedeu/models/views/char.rb +175 -0
  34. data/lib/vedeu/models/views/chars.rb +13 -0
  35. data/lib/vedeu/models/views/composition.rb +73 -0
  36. data/lib/vedeu/models/views/line.rb +111 -0
  37. data/lib/vedeu/models/views/lines.rb +13 -0
  38. data/lib/vedeu/models/views/stream.rb +122 -0
  39. data/lib/vedeu/models/views/streams.rb +13 -0
  40. data/lib/vedeu/models/views/view.rb +157 -0
  41. data/lib/vedeu/models/views/view_collection.rb +13 -0
  42. data/lib/vedeu/null/view.rb +67 -0
  43. data/lib/vedeu/output/clear/named_interface.rb +4 -4
  44. data/lib/vedeu/output/compressor.rb +6 -6
  45. data/lib/vedeu/output/html_char.rb +6 -6
  46. data/lib/vedeu/output/output.rb +3 -3
  47. data/lib/vedeu/output/presentation.rb +1 -1
  48. data/lib/vedeu/output/renderers/escape_sequence.rb +1 -1
  49. data/lib/vedeu/output/renderers/file.rb +1 -1
  50. data/lib/vedeu/output/renderers/html.rb +3 -3
  51. data/lib/vedeu/output/renderers/json.rb +4 -4
  52. data/lib/vedeu/output/renderers/null.rb +1 -1
  53. data/lib/vedeu/output/renderers/terminal.rb +5 -5
  54. data/lib/vedeu/output/renderers/text.rb +3 -3
  55. data/lib/vedeu/output/style.rb +1 -1
  56. data/lib/vedeu/output/text.rb +20 -15
  57. data/lib/vedeu/output/viewport.rb +16 -23
  58. data/lib/vedeu/output/virtual_buffer.rb +9 -8
  59. data/lib/vedeu/output/virtual_terminal.rb +11 -11
  60. data/lib/vedeu/output/wordwrap.rb +5 -5
  61. data/lib/vedeu/runtime/application.rb +1 -1
  62. data/lib/vedeu/runtime/main_loop.rb +1 -1
  63. data/lib/vedeu/templating/helpers.rb +11 -10
  64. data/lib/vedeu/templating/template.rb +1 -1
  65. data/lib/vedeu/templating/view_template.rb +6 -6
  66. data/lib/vedeu/version.rb +1 -2
  67. data/test/lib/vedeu/api_test.rb +30 -30
  68. data/test/lib/vedeu/buffers/buffer_test.rb +5 -139
  69. data/test/lib/vedeu/colours/colour_translator_test.rb +3 -3
  70. data/test/lib/vedeu/configuration/api_test.rb +3 -3
  71. data/test/lib/vedeu/cursor/refresh_cursor_test.rb +1 -1
  72. data/test/lib/vedeu/dsl/composition_test.rb +7 -7
  73. data/test/lib/vedeu/dsl/group_test.rb +2 -2
  74. data/test/lib/vedeu/dsl/interface_test.rb +31 -21
  75. data/test/lib/vedeu/dsl/keymap_test.rb +4 -4
  76. data/test/lib/vedeu/dsl/line_test.rb +8 -8
  77. data/test/lib/vedeu/dsl/stream_test.rb +4 -4
  78. data/test/lib/vedeu/dsl/text_test.rb +11 -11
  79. data/test/lib/vedeu/dsl/view_test.rb +24 -29
  80. data/test/lib/vedeu/geometry/grid_test.rb +4 -4
  81. data/test/lib/vedeu/input/key_test.rb +1 -1
  82. data/test/lib/vedeu/internal_api_test.rb +18 -18
  83. data/test/lib/vedeu/models/focus_test.rb +54 -54
  84. data/test/lib/vedeu/models/interface_test.rb +11 -105
  85. data/test/lib/vedeu/models/menu_test.rb +1 -1
  86. data/test/lib/vedeu/models/views/char_test.rb +257 -0
  87. data/test/lib/vedeu/models/views/chars_test.rb +22 -0
  88. data/test/lib/vedeu/models/views/composition_test.rb +61 -0
  89. data/test/lib/vedeu/models/views/line_test.rb +189 -0
  90. data/test/lib/vedeu/models/views/lines_test.rb +22 -0
  91. data/test/lib/vedeu/models/views/stream_test.rb +138 -0
  92. data/test/lib/vedeu/models/views/streams_test.rb +22 -0
  93. data/test/lib/vedeu/models/views/view_test.rb +40 -0
  94. data/test/lib/vedeu/null/view_test.rb +12 -0
  95. data/test/lib/vedeu/output/clear/named_interface_test.rb +4 -4
  96. data/test/lib/vedeu/output/compressor_test.rb +28 -28
  97. data/test/lib/vedeu/output/html_char_test.rb +2 -2
  98. data/test/lib/vedeu/output/presentation_test.rb +10 -14
  99. data/test/lib/vedeu/output/renderers/escape_sequence_test.rb +20 -4
  100. data/test/lib/vedeu/output/renderers/html_test.rb +4 -4
  101. data/test/lib/vedeu/output/renderers/json_test.rb +3 -3
  102. data/test/lib/vedeu/output/text_test.rb +10 -10
  103. data/test/lib/vedeu/output/viewport_test.rb +21 -23
  104. data/test/lib/vedeu/output/virtual_buffer_test.rb +1 -1
  105. data/test/lib/vedeu/output/virtual_terminal_test.rb +1 -1
  106. data/test/lib/vedeu/output/wordwrap_test.rb +9 -9
  107. data/test/lib/vedeu/repositories/repository_test.rb +2 -2
  108. data/test/lib/vedeu/templating/helpers_test.rb +6 -39
  109. data/test/lib/vedeu/templating/template_test.rb +2 -2
  110. data/test/lib/vedeu/templating/view_template_test.rb +91 -91
  111. data/test/lib/vedeu/terminal_test.rb +1 -1
  112. metadata +33 -27
  113. data/lib/vedeu/buffers/display_buffer.rb +0 -39
  114. data/lib/vedeu/models/char.rb +0 -170
  115. data/lib/vedeu/models/chars.rb +0 -9
  116. data/lib/vedeu/models/composition.rb +0 -66
  117. data/lib/vedeu/models/line.rb +0 -112
  118. data/lib/vedeu/models/lines.rb +0 -9
  119. data/lib/vedeu/models/stream.rb +0 -122
  120. data/lib/vedeu/models/streams.rb +0 -9
  121. data/test/lib/vedeu/buffers/display_buffer_test.rb +0 -61
  122. data/test/lib/vedeu/models/char_test.rb +0 -253
  123. data/test/lib/vedeu/models/chars_test.rb +0 -18
  124. data/test/lib/vedeu/models/composition_test.rb +0 -57
  125. data/test/lib/vedeu/models/line_test.rb +0 -189
  126. data/test/lib/vedeu/models/lines_test.rb +0 -18
  127. data/test/lib/vedeu/models/stream_test.rb +0 -141
  128. data/test/lib/vedeu/models/streams_test.rb +0 -18
@@ -15,7 +15,7 @@ module Vedeu
15
15
  context 'when the required block is not given' do
16
16
  subject { described.new(input) }
17
17
 
18
- it { proc { subject }.must_raise(InvalidSyntax) }
18
+ it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
19
19
  end
20
20
  end
21
21
 
@@ -4,24 +4,24 @@ module Vedeu
4
4
 
5
5
  describe InternalAPI do
6
6
 
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(:cursors) }
11
- it { Vedeu.must_respond_to(:debug) }
12
- it { Vedeu.must_respond_to(:events) }
13
- it { Vedeu.must_respond_to(:foreground_colours) }
14
- it { Vedeu.must_respond_to(:geometries) }
15
- it { Vedeu.must_respond_to(:groups) }
16
- it { Vedeu.must_respond_to(:interfaces) }
17
- it { Vedeu.must_respond_to(:keymaps) }
18
- it { Vedeu.must_respond_to(:menus) }
19
- it { Vedeu.must_respond_to(:ready!) }
20
- it { Vedeu.must_respond_to(:ready?) }
21
- it { Vedeu.must_respond_to(:renderer) }
22
- it { Vedeu.must_respond_to(:renderers) }
23
- it { Vedeu.must_respond_to(:resize) }
24
- it { Vedeu.must_respond_to(:timer) }
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(:cursors) }
11
+ it { Vedeu.must_respond_to(:debug) }
12
+ it { Vedeu.must_respond_to(:events) }
13
+ it { Vedeu.must_respond_to(:foreground_colours) }
14
+ it { Vedeu.must_respond_to(:geometries) }
15
+ it { Vedeu.must_respond_to(:groups) }
16
+ it { Vedeu.must_respond_to(:interfaces) }
17
+ it { Vedeu.must_respond_to(:keymaps) }
18
+ it { Vedeu.must_respond_to(:menus) }
19
+ it { Vedeu.must_respond_to(:ready!) }
20
+ it { Vedeu.must_respond_to(:ready?) }
21
+ it { Vedeu.must_respond_to(:renderer) }
22
+ it { Vedeu.must_respond_to(:renderers) }
23
+ it { Vedeu.must_respond_to(:resize) }
24
+ it { Vedeu.must_respond_to(:timer) }
25
25
 
26
26
  end # InternalAPI
27
27
 
@@ -7,7 +7,7 @@ module Vedeu
7
7
  let(:described) { Vedeu::Focus }
8
8
 
9
9
  before {
10
- Focus.reset
10
+ Vedeu::Focus.reset
11
11
  Vedeu.interfaces.reset
12
12
 
13
13
  Vedeu.stubs(:trigger)
@@ -20,7 +20,7 @@ module Vedeu
20
20
  describe '#add' do
21
21
  context 'adds an interface to storage' do
22
22
  it {
23
- Focus.add('thallium').must_equal(['thallium'])
23
+ Vedeu::Focus.add('thallium').must_equal(['thallium'])
24
24
  }
25
25
  end
26
26
 
@@ -30,17 +30,17 @@ module Vedeu
30
30
  }
31
31
 
32
32
  it {
33
- Focus.add('thallium')
34
- Focus.registered.must_equal(['thallium'])
33
+ Vedeu::Focus.add('thallium')
34
+ Vedeu::Focus.registered.must_equal(['thallium'])
35
35
  }
36
36
  end
37
37
 
38
38
  it 'does not add it again if already exists' do
39
- Focus.add('thallium')
40
- Focus.add('lead')
41
- Focus.add('bismuth')
42
- Focus.add('bismuth', true)
43
- Focus.registered.must_equal(['bismuth', 'thallium', 'lead'])
39
+ Vedeu::Focus.add('thallium')
40
+ Vedeu::Focus.add('lead')
41
+ Vedeu::Focus.add('bismuth')
42
+ Vedeu::Focus.add('bismuth', true)
43
+ Vedeu::Focus.registered.must_equal(['bismuth', 'thallium', 'lead'])
44
44
  end
45
45
 
46
46
  context 'adds the interface to storage focussed' do
@@ -49,9 +49,9 @@ module Vedeu
49
49
  }
50
50
 
51
51
  it {
52
- Focus.add('thallium')
53
- Focus.add('lead', true)
54
- Focus.registered.must_equal(['lead', 'thallium'])
52
+ Vedeu::Focus.add('thallium')
53
+ Vedeu::Focus.add('lead', true)
54
+ Vedeu::Focus.registered.must_equal(['lead', 'thallium'])
55
55
  }
56
56
  end
57
57
 
@@ -61,48 +61,48 @@ module Vedeu
61
61
  }
62
62
 
63
63
  it {
64
- Focus.add('thallium')
65
- Focus.add('lead')
66
- Focus.registered.must_equal(['thallium', 'lead'])
64
+ Vedeu::Focus.add('thallium')
65
+ Vedeu::Focus.add('lead')
66
+ Vedeu::Focus.registered.must_equal(['thallium', 'lead'])
67
67
  }
68
68
  end
69
69
  end
70
70
 
71
71
  describe '#by_name' do
72
72
  it 'the named interface is focussed when the method is called' do
73
- Focus.add('thallium')
74
- Focus.add('lead')
75
- Focus.add('bismuth')
76
- Focus.by_name('lead').must_equal('lead')
73
+ Vedeu::Focus.add('thallium')
74
+ Vedeu::Focus.add('lead')
75
+ Vedeu::Focus.add('bismuth')
76
+ Vedeu::Focus.by_name('lead').must_equal('lead')
77
77
  end
78
78
 
79
79
  it 'raises an exception if the interface does not exist' do
80
- proc { Focus.by_name('not_found') }.must_raise(ModelNotFound)
80
+ proc { Vedeu::Focus.by_name('not_found') }.must_raise(Vedeu::ModelNotFound)
81
81
  end
82
82
 
83
83
  context 'API methods' do
84
84
  it 'the named interface is focussed when the method is called' do
85
- Focus.add('thallium')
86
- Focus.add('lead')
87
- Focus.add('bismuth')
85
+ Vedeu::Focus.add('thallium')
86
+ Vedeu::Focus.add('lead')
87
+ Vedeu::Focus.add('bismuth')
88
88
  Vedeu.focus_by_name('lead').must_equal('lead')
89
89
  end
90
90
 
91
91
  it 'raises an exception if the interface does not exist' do
92
- proc { Vedeu.focus_by_name('not_found') }.must_raise(ModelNotFound)
92
+ proc { Vedeu.focus_by_name('not_found') }.must_raise(Vedeu::ModelNotFound)
93
93
  end
94
94
  end
95
95
  end
96
96
 
97
97
  describe '#current' do
98
- before { Focus.reset }
98
+ before { Vedeu::Focus.reset }
99
99
 
100
100
  subject { described.current }
101
101
 
102
102
  it 'returns the name of the interface currently in focus' do
103
- Focus.add('thallium')
104
- Focus.add('lead')
105
- Focus.add('bismuth')
103
+ Vedeu::Focus.add('thallium')
104
+ Vedeu::Focus.add('lead')
105
+ Vedeu::Focus.add('bismuth')
106
106
  subject.must_equal('thallium')
107
107
  end
108
108
 
@@ -112,23 +112,23 @@ module Vedeu
112
112
 
113
113
  context 'API methods' do
114
114
  it 'returns the name of the interface currently in focus' do
115
- Focus.add('thallium')
116
- Focus.add('lead')
117
- Focus.add('bismuth')
115
+ Vedeu::Focus.add('thallium')
116
+ Vedeu::Focus.add('lead')
117
+ Vedeu::Focus.add('bismuth')
118
118
  Vedeu.focus.must_equal('thallium')
119
119
  end
120
120
  end
121
121
  end
122
122
 
123
123
  describe '#current?' do
124
- before { Focus.stubs(:current).returns('lead') }
124
+ before { Vedeu::Focus.stubs(:current).returns('lead') }
125
125
 
126
126
  context 'when the interface is currently in focus' do
127
- it { Focus.current?('lead').must_equal(true) }
127
+ it { Vedeu::Focus.current?('lead').must_equal(true) }
128
128
  end
129
129
 
130
130
  context 'when the interface is not currently in focus' do
131
- it { Focus.current?('bismuth').must_equal(false) }
131
+ it { Vedeu::Focus.current?('bismuth').must_equal(false) }
132
132
  end
133
133
 
134
134
  context 'API methods' do
@@ -144,16 +144,16 @@ module Vedeu
144
144
 
145
145
  describe '#next_item' do
146
146
  it 'the next interface is focussed when the method is called' do
147
- Focus.add('thallium')
148
- Focus.add('lead')
149
- Focus.add('bismuth')
150
- Focus.next_item.must_equal('lead')
147
+ Vedeu::Focus.add('thallium')
148
+ Vedeu::Focus.add('lead')
149
+ Vedeu::Focus.add('bismuth')
150
+ Vedeu::Focus.next_item.must_equal('lead')
151
151
  end
152
152
 
153
153
  context 'returns false if storage is empty' do
154
- before { Focus.reset }
154
+ before { Vedeu::Focus.reset }
155
155
 
156
- it { Focus.next_item.must_equal(false) }
156
+ it { Vedeu::Focus.next_item.must_equal(false) }
157
157
  end
158
158
  end
159
159
 
@@ -166,7 +166,7 @@ module Vedeu
166
166
  }
167
167
 
168
168
  it 'the next visible interface is focussed when the method is called' do
169
- Focus.next_visible_item.must_equal('silver')
169
+ Vedeu::Focus.next_visible_item.must_equal('silver')
170
170
  end
171
171
 
172
172
  context 'when there are no visible interfaces' do
@@ -177,29 +177,29 @@ module Vedeu
177
177
  }
178
178
 
179
179
  it 'puts the first interface defined in focus' do
180
- Focus.next_visible_item.must_equal('gold')
180
+ Vedeu::Focus.next_visible_item.must_equal('gold')
181
181
  end
182
182
  end
183
183
 
184
184
  context 'when there are no interfaces' do
185
185
  before { Vedeu::Focus.reset }
186
186
 
187
- it { Focus.next_visible_item.must_equal(false) }
187
+ it { Vedeu::Focus.next_visible_item.must_equal(false) }
188
188
  end
189
189
  end
190
190
 
191
191
  describe '#prev_item' do
192
192
  it 'the previous interface is focussed when the method is called' do
193
- Focus.add('thallium')
194
- Focus.add('lead')
195
- Focus.add('bismuth')
196
- Focus.prev_item.must_equal('bismuth')
193
+ Vedeu::Focus.add('thallium')
194
+ Vedeu::Focus.add('lead')
195
+ Vedeu::Focus.add('bismuth')
196
+ Vedeu::Focus.prev_item.must_equal('bismuth')
197
197
  end
198
198
 
199
199
  context 'returns false if storage is empty' do
200
- before { Focus.reset }
200
+ before { Vedeu::Focus.reset }
201
201
 
202
- it { Focus.prev_item.must_equal(false) }
202
+ it { Vedeu::Focus.prev_item.must_equal(false) }
203
203
  end
204
204
  end
205
205
 
@@ -212,7 +212,7 @@ module Vedeu
212
212
  }
213
213
 
214
214
  it 'the previous visible interface is focussed when the method is called' do
215
- Focus.prev_visible_item.must_equal('silver')
215
+ Vedeu::Focus.prev_visible_item.must_equal('silver')
216
216
  end
217
217
 
218
218
  context 'when there are no visible interfaces' do
@@ -223,25 +223,25 @@ module Vedeu
223
223
  }
224
224
 
225
225
  it 'puts the first interface defined in focus' do
226
- Focus.prev_visible_item.must_equal('gold')
226
+ Vedeu::Focus.prev_visible_item.must_equal('gold')
227
227
  end
228
228
  end
229
229
 
230
230
  context 'when there are no interfaces' do
231
231
  before { Vedeu::Focus.reset }
232
232
 
233
- it { Focus.prev_visible_item.must_equal(false) }
233
+ it { Vedeu::Focus.prev_visible_item.must_equal(false) }
234
234
  end
235
235
  end
236
236
 
237
237
  describe '#refresh' do
238
238
  before {
239
- Focus.add('thallium')
239
+ Vedeu::Focus.add('thallium')
240
240
  Vedeu.stubs(:trigger).returns([])
241
241
  }
242
242
 
243
243
  it 'triggers the event to refresh the interface current in focus' do
244
- Focus.refresh.must_equal([])
244
+ Vedeu::Focus.refresh.must_equal([])
245
245
  end
246
246
  end
247
247
 
@@ -12,7 +12,6 @@ module Vedeu
12
12
  colour: colour,
13
13
  delay: delay,
14
14
  group: group,
15
- lines: lines,
16
15
  name: _name,
17
16
  parent: parent,
18
17
  style: style,
@@ -24,7 +23,6 @@ module Vedeu
24
23
  let(:colour) {}
25
24
  let(:delay) { 0.0 }
26
25
  let(:group) { '' }
27
- let(:lines) { [] }
28
26
  let(:_name) { 'hydrogen' }
29
27
  let(:parent) {}
30
28
  let(:repository) { Vedeu.interfaces }
@@ -33,18 +31,17 @@ module Vedeu
33
31
  let(:zindex) { 1 }
34
32
 
35
33
  describe '#initialize' do
36
- it { instance.must_be_instance_of(described) }
37
- it { instance.instance_variable_get('@client').must_equal(client) }
38
- it { instance.instance_variable_get('@delay').must_equal(delay) }
39
- it { instance.instance_variable_get('@group').must_equal(group) }
40
- it { instance.instance_variable_get('@lines').must_equal(lines) }
41
- it { instance.instance_variable_get('@name').must_equal(_name) }
42
- it { instance.instance_variable_get('@parent').must_equal(parent) }
43
- it {
44
- instance.instance_variable_get('@repository').must_equal(repository)
45
- }
46
- it { instance.instance_variable_get('@visible').must_equal(visible) }
47
- it { instance.instance_variable_get('@zindex').must_equal(zindex) }
34
+ subject { instance }
35
+
36
+ it { subject.must_be_instance_of(described) }
37
+ it { subject.instance_variable_get('@client').must_equal(client) }
38
+ it { subject.instance_variable_get('@delay').must_equal(delay) }
39
+ it { subject.instance_variable_get('@group').must_equal(group) }
40
+ it { subject.instance_variable_get('@name').must_equal(_name) }
41
+ it { subject.instance_variable_get('@parent').must_equal(parent) }
42
+ it { subject.instance_variable_get('@repository').must_equal(repository) }
43
+ it { subject.instance_variable_get('@visible').must_equal(visible) }
44
+ it { subject.instance_variable_get('@zindex').must_equal(zindex) }
48
45
  end
49
46
 
50
47
  describe 'accessors' do
@@ -64,15 +61,6 @@ module Vedeu
64
61
  it { instance.must_respond_to(:visible=) }
65
62
  it { instance.must_respond_to(:visible?) }
66
63
  it { instance.must_respond_to(:attributes) }
67
- it { instance.must_respond_to(:lines=) }
68
- end
69
-
70
- describe '#add' do
71
- subject { instance.add(child) }
72
-
73
- it { instance.must_respond_to(:add) }
74
-
75
- it { instance.must_respond_to(:<<) }
76
64
  end
77
65
 
78
66
  describe '#hide' do
@@ -100,78 +88,6 @@ module Vedeu
100
88
  }
101
89
  end
102
90
 
103
- describe '#lines' do
104
- subject { instance.lines }
105
-
106
- it { instance.must_respond_to(:value) }
107
- end
108
-
109
- describe '#lines?' do
110
- subject { instance.lines? }
111
-
112
- context 'when the interface has content' do
113
- let(:lines) { [:line] }
114
-
115
- it { subject.must_equal(true) }
116
- end
117
-
118
- context 'when the interface does not have content' do
119
- it { subject.must_equal(false) }
120
- end
121
- end
122
-
123
- describe '#group?' do
124
- subject { instance.group? }
125
-
126
- context 'when the interface belongs to a group' do
127
- let(:group) { 'interfaces' }
128
-
129
- it { subject.must_equal(true) }
130
- end
131
-
132
- context 'when the interface does not belong to a group' do
133
- it { subject.must_equal(false) }
134
- end
135
- end
136
-
137
- describe '#render' do
138
- let(:clear) { mock('Vedeu::Clear') }
139
- let(:border) { mock('Vedeu::Border') }
140
- let(:view) { mock('Vedeu::Viewport') }
141
-
142
- before {
143
- Vedeu.stubs(:trigger).with(:_hide_cursor_, _name)
144
-
145
- Vedeu::Clear::NamedInterface.stubs(:render).returns(:clear)
146
-
147
- Vedeu::Viewport.stubs(:render).returns(:view)
148
-
149
- Vedeu.borders.stubs(:by_name).returns(border)
150
- border.stubs(:render).returns(:border)
151
-
152
- Vedeu.stubs(:trigger).with(:_show_cursor_, _name)
153
- }
154
-
155
- subject { instance.render }
156
-
157
- it { subject.must_be_instance_of(Array) }
158
-
159
- context 'when the interface is visible' do
160
- it {
161
- Vedeu::Clear::NamedInterface.expects(:render).with(_name)
162
- subject
163
- }
164
-
165
- it { subject.must_equal([nil, :clear, :view, :border, nil]) }
166
- end
167
-
168
- context 'when the interface is not visible' do
169
- let(:visible) { false }
170
-
171
- it { subject.must_equal([]) }
172
- end
173
- end
174
-
175
91
  describe '#show' do
176
92
  let(:buffer) { Vedeu::Buffer.new }
177
93
 
@@ -185,16 +101,6 @@ module Vedeu
185
101
  }
186
102
  end
187
103
 
188
- describe '#store' do
189
- subject { instance.store }
190
-
191
- context 'when the interface has no name' do
192
- let(:_name) {}
193
-
194
- it { proc { subject }.must_raise(MissingRequired) }
195
- end
196
- end
197
-
198
104
  end # Interface
199
105
 
200
106
  end # Vedeu