vedeu 0.8.2 → 0.8.3

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