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
@@ -12,10 +12,11 @@ module Vedeu
12
12
  let(:instance) { described.new(options) }
13
13
  let(:options) {
14
14
  {
15
- content: content,
15
+ compression: compression,
16
16
  end_tag: end_tag,
17
17
  end_row_tag: end_row_tag,
18
18
  filename: filename,
19
+ output: output,
19
20
  start_tag: start_tag,
20
21
  start_row_tag: start_row_tag,
21
22
  template: template,
@@ -23,18 +24,19 @@ module Vedeu
23
24
  write_file: write_file,
24
25
  }
25
26
  }
26
- let(:content) { '' }
27
+ let(:compression) { false }
27
28
  let(:end_tag) { '</td>' }
28
29
  let(:end_row_tag) { '</tr>' }
29
- let(:filename) { 'out' }
30
+ let(:filename) { 'vedeu_renderers_html' }
31
+ let(:output) { '' }
30
32
  let(:start_tag) { '<td' }
31
33
  let(:start_row_tag) { '<tr>' }
32
34
  let(:template) {
33
- ::File.dirname(__FILE__) + '/../../../support/templates/html_renderer.vedeu'
35
+ ::File.dirname(__FILE__) + '/../../../support/templates/' \
36
+ 'html_renderer.vedeu'
34
37
  }
35
38
  let(:timestamp) { false }
36
39
  let(:write_file) { false }
37
- let(:buffer) { Vedeu::Buffers::Terminal }
38
40
 
39
41
  before do
40
42
  Vedeu.config.stubs(:compression?).returns(false)
@@ -47,7 +49,6 @@ module Vedeu
47
49
  describe '#initialize' do
48
50
  it { instance.must_be_instance_of(described) }
49
51
  it { instance.instance_variable_get('@options').must_equal(options) }
50
- it { instance.instance_variable_get('@output').must_equal(nil) }
51
52
  end
52
53
 
53
54
  describe '#clear' do
@@ -60,7 +61,7 @@ module Vedeu
60
61
  describe '#render' do
61
62
  let(:output) {
62
63
  Vedeu::Models::Page.coerce([
63
- Vedeu::Views::Char.new(value: 'a',
64
+ Vedeu::Cells::Char.new(value: 'a',
64
65
  colour: {
65
66
  background: '#ff0000',
66
67
  foreground: '#ffffff' }),
@@ -88,8 +89,9 @@ module Vedeu
88
89
  " <body>\n" \
89
90
  " <table>\n" \
90
91
  " <tr>\n" \
91
- "<td style='border:1px #ff0000 solid;" \
92
- "background:#ff0000;color:#ffffff;'>a</td></tr>\n" \
92
+ "<td style='background-color:#ff0000;color:#ffffff;'>" \
93
+ "a" \
94
+ "</td></tr>\n" \
93
95
  " </table>\n" \
94
96
  " </body>\n" \
95
97
  "</html>\n"
@@ -104,7 +106,7 @@ module Vedeu
104
106
  describe '#html_body' do
105
107
  let(:output) {
106
108
  Vedeu::Models::Page.coerce([
107
- Vedeu::Views::Char.new(value: 'a',
109
+ Vedeu::Cells::Char.new(value: 'a',
108
110
  colour: {
109
111
  background: '#ff0000',
110
112
  foreground: '#ffffff' }),
@@ -112,8 +114,9 @@ module Vedeu
112
114
  }
113
115
  let(:expected) {
114
116
  "<tr>\n" \
115
- "<td style='border:1px #ff0000 solid;" \
116
- "background:#ff0000;color:#ffffff;'>a</td></tr>\n" \
117
+ "<td style='background-color:#ff0000;color:#ffffff;'>" \
118
+ "a" \
119
+ "</td></tr>\n" \
117
120
  }
118
121
 
119
122
  before do
@@ -10,17 +10,72 @@ module Vedeu
10
10
 
11
11
  let(:described) { Vedeu::Renderers::JSON }
12
12
  let(:instance) { described.new(options) }
13
- let(:options) { {} }
14
- let(:output) { Vedeu::Models::Page.new }
15
- let(:_name) { 'Vedeu::Renderers::JSON' }
16
-
17
- before do
18
- Vedeu.config.stubs(:compression?).returns(false)
19
- ::File.stubs(:write)
20
- Vedeu.stubs(:height).returns(1)
21
- Vedeu.stubs(:width).returns(1)
22
- Vedeu::Buffers::Terminal.reset!
23
- end
13
+ let(:options) {
14
+ {
15
+ compression: compression,
16
+ end_tag: end_tag,
17
+ end_row_tag: end_row_tag,
18
+ filename: filename,
19
+ output: output,
20
+ start_tag: start_tag,
21
+ start_row_tag: start_row_tag,
22
+ template: template,
23
+ timestamp: timestamp,
24
+ write_file: write_file,
25
+ }
26
+ }
27
+ let(:compression) { false }
28
+ let(:end_tag) { '</td>' }
29
+ let(:end_row_tag) { '</tr>' }
30
+ let(:filename) { 'vedeu_renderers_json' }
31
+ let(:start_tag) { '<td' }
32
+ let(:start_row_tag) { '<tr>' }
33
+ let(:template) {
34
+ ::File.dirname(__FILE__) + '/../../../support/templates/' \
35
+ 'html_renderer.vedeu'
36
+ }
37
+ let(:timestamp) { false }
38
+ let(:write_file) { false }
39
+ let(:output) {
40
+ Vedeu::Models::Page.coerce([
41
+ Vedeu::Cells::Char.new(output_attributes)
42
+ ])
43
+ }
44
+ let(:output_attributes) {
45
+ {
46
+ colour: {
47
+ background: '#ff0000',
48
+ foreground: '#ffffff',
49
+ },
50
+ name: 'Vedeu::Renderers::JSON',
51
+ position: [2, 9],
52
+ value: 'a',
53
+ }
54
+ }
55
+ let(:output_as_hash) {
56
+ [
57
+ {
58
+ name: 'Vedeu::Renderers::JSON',
59
+ style: '',
60
+ type: 'char',
61
+ value: 'a',
62
+ colour: {
63
+ background: '#ff0000',
64
+ foreground: '#ffffff',
65
+ },
66
+ position: {
67
+ y: 2,
68
+ x: 9,
69
+ },
70
+ }, {
71
+ type: :escape,
72
+ value: "\e[0m",
73
+ }
74
+ ]
75
+ }
76
+ let(:output_as_json) { ::JSON.pretty_generate(output_as_hash) }
77
+
78
+ before { ::File.stubs(:write) }
24
79
 
25
80
  describe '#initialize' do
26
81
  it { instance.must_be_instance_of(described) }
@@ -34,53 +89,21 @@ module Vedeu
34
89
  it { subject.must_equal("{\n}") }
35
90
  end
36
91
 
37
- describe '#render' do
38
- let(:output) {
39
- Vedeu::Models::Page.coerce([
40
- Vedeu::Views::Char.new(value: 'a',
41
- name: _name,
42
- colour: {
43
- background: '#ff0000',
44
- foreground: '#ffffff' }),
45
- ])
46
- }
47
- let(:expected) {
48
- "[\n" \
49
- " {\n" \
50
- " \"border\": \"\",\n" \
51
- " \"colour\": {\n" \
52
- " \"background\": \"\\u001b[48;2;255;0;0m\",\n" \
53
- " \"foreground\": \"\\u001b[38;2;255;255;255m\"\n" \
54
- " },\n" \
55
- " \"name\": \"Vedeu::Renderers::JSON\",\n" \
56
- " \"parent\": {\n" \
57
- " },\n" \
58
- " \"position\": {\n" \
59
- " },\n" \
60
- " \"style\": \"\",\n" \
61
- " \"value\": \"a\"\n" \
62
- " },\n" \
63
- " {\n" \
64
- " \"border\": \"\",\n" \
65
- " \"colour\": {\n" \
66
- " \"background\": \"\",\n" \
67
- " \"foreground\": \"\"\n" \
68
- " },\n" \
69
- " \"name\": \"\",\n" \
70
- " \"parent\": {\n" \
71
- " },\n" \
72
- " \"position\": {\n" \
73
- " },\n" \
74
- " \"style\": \"\",\n" \
75
- " \"value\": \"\\u001b[0m\"\n" \
76
- " }\n" \
77
- "]"
78
- }
92
+ describe '#write' do
93
+ subject { instance.write }
79
94
 
80
- subject { instance.render(output) }
95
+ context 'when the :write_file option is true' do
96
+ let(:write_file) { true }
81
97
 
82
- it { subject.must_be_instance_of(String) }
83
- it { subject.must_equal(expected) }
98
+ it do
99
+ ::File.expects(:write).with(filename, output_as_json)
100
+ subject
101
+ end
102
+ end
103
+
104
+ context 'when the :write_file option is false' do
105
+ it { subject.must_equal(output_as_json) }
106
+ end
84
107
  end
85
108
 
86
109
  end # JSON
@@ -7,54 +7,102 @@ module Vedeu
7
7
  module Renderers
8
8
 
9
9
  class RenderersTestClass
10
+
10
11
  include Vedeu::Renderers::Options
11
12
 
12
- def initialize(options = {})
13
- @options = options || {}
14
- end
15
- end
13
+ end # RenderersTestClass
16
14
 
17
15
  describe Options do
18
16
 
19
17
  let(:described) { Vedeu::Renderers::Options }
20
- let(:instance) { RenderersTestClass.new(options) }
18
+ let(:instance) {}
19
+
20
+ let(:including_described) { Vedeu::Renderers::RenderersTestClass }
21
+ let(:including_instance) { including_described.new(options) }
21
22
  let(:options) {
22
23
  {
23
- compression: compression,
24
+ compression: compression,
25
+ end_tag: end_tag,
26
+ end_row_tag: end_row_tag,
27
+ filename: filename,
28
+ output: 'EMPTY',
29
+ start_tag: start_tag,
30
+ start_row_tag: start_row_tag,
31
+ template: template,
32
+ timestamp: timestamp,
33
+ write_file: write_file,
24
34
  }
25
35
  }
26
- let(:compression) { false }
36
+ let(:compression) { false }
37
+ let(:end_tag) { '</td>' }
38
+ let(:end_row_tag) { '</tr>' }
39
+ let(:filename) { 'vedeu_renderers_options' }
40
+ let(:start_tag) { '<td' }
41
+ let(:start_row_tag) { '<tr>' }
42
+ let(:template) {
43
+ ::File.dirname(__FILE__) + '/../../../support/templates/' \
44
+ 'html_renderer.vedeu'
45
+ }
46
+ let(:timestamp) { false }
47
+ let(:write_file) { false }
27
48
 
28
- describe '#options=' do
29
- it { instance.must_respond_to(:options=) }
49
+ describe '#initialize' do
50
+ it { including_instance.must_be_instance_of(including_described) }
51
+ it { including_instance.instance_variable_get('@options').must_equal(options) }
30
52
  end
31
53
 
32
- describe '#compress?' do
33
- subject { instance.compress? }
54
+ describe '#clear' do
55
+ subject { including_instance.clear }
34
56
 
35
- context 'when the option is not set or is set to false' do
36
- before { options.tap { |o| o.delete(:compression) } }
57
+ it { proc { subject }.must_raise(Vedeu::Error::NotImplemented) }
58
+ end
37
59
 
38
- context 'when Vedeu.config.compression? is set to false' do
39
- before { Vedeu.config.stubs(:compression?).returns(false) }
60
+ describe '#options' do
61
+ it { including_instance.must_respond_to(:options) }
62
+ end
40
63
 
41
- it { subject.must_equal(false) }
42
- end
64
+ describe '#options=' do
65
+ it { including_instance.must_respond_to(:options=) }
66
+ end
43
67
 
44
- context 'when Vedeu.config.compression? is set to true' do
45
- before { Vedeu.config.stubs(:compression?).returns(true) }
68
+ describe '#render' do
69
+ subject { including_instance.render }
46
70
 
47
- it { subject.must_equal(true) }
48
- end
49
- end
71
+ it { proc { subject }.must_raise(Vedeu::Error::NotImplemented) }
72
+ end
50
73
 
51
- context 'when the option is set and is true' do
52
- let(:compression) { true }
74
+ describe '#write' do
75
+ subject { including_instance.write }
53
76
 
54
- it { subject.must_equal(true) }
55
- end
77
+ it { proc { subject }.must_raise(Vedeu::Error::NotImplemented) }
56
78
  end
57
79
 
80
+ # describe '#compression?' do
81
+ # subject { including_instance.compression? }
82
+
83
+ # context 'when the option is not set or is set to false' do
84
+ # before { options.tap { |o| o.delete(:compression) } }
85
+
86
+ # context 'when Vedeu.config.compression? is set to false' do
87
+ # before { Vedeu.config.stubs(:compression?).returns(false) }
88
+
89
+ # it { subject.must_equal(false) }
90
+ # end
91
+
92
+ # context 'when Vedeu.config.compression? is set to true' do
93
+ # before { Vedeu.config.stubs(:compression?).returns(true) }
94
+
95
+ # it { subject.must_equal(true) }
96
+ # end
97
+ # end
98
+
99
+ # context 'when the option is set and is true' do
100
+ # let(:compression) { true }
101
+
102
+ # it { subject.must_equal(true) }
103
+ # end
104
+ # end
105
+
58
106
  # @todo Add more tests.
59
107
  # it { skip }
60
108
 
@@ -10,21 +10,47 @@ module Vedeu
10
10
 
11
11
  let(:described) { Vedeu::Renderers::Terminal }
12
12
  let(:instance) { described.new(options) }
13
- let(:options) { {} }
13
+ let(:options) {
14
+ {
15
+ compression: compression,
16
+ end_tag: end_tag,
17
+ end_row_tag: end_row_tag,
18
+ filename: filename,
19
+ output: 'EMPTY',
20
+ start_tag: start_tag,
21
+ start_row_tag: start_row_tag,
22
+ template: template,
23
+ timestamp: timestamp,
24
+ write_file: write_file,
25
+ }
26
+ }
27
+ let(:compression) { false }
28
+ let(:end_tag) { '</td>' }
29
+ let(:end_row_tag) { '</tr>' }
30
+ let(:filename) { 'vedeu_renderers_terminal' }
31
+ let(:start_tag) { '<td' }
32
+ let(:start_row_tag) { '<tr>' }
33
+ let(:template) {
34
+ ::File.dirname(__FILE__) + '/../../../support/templates/' \
35
+ 'html_renderer.vedeu'
36
+ }
37
+ let(:timestamp) { false }
38
+ let(:write_file) { false }
39
+
14
40
  let(:_name) {}
15
41
  let(:output) {
16
42
  Vedeu::Models::Page.coerce([
17
43
  [
18
44
  Vedeu::Cells::Empty.new(position: [1, 1]),
19
- Vedeu::Views::Char.new(name: _name, value: 'a', position: [1, 2]),
45
+ Vedeu::Cells::Char.new(name: _name, value: 'a', position: [1, 2]),
20
46
  Vedeu::Cells::Empty.new(position: [1, 3]),
21
47
  ], [
22
48
  Vedeu::Cells::Empty.new(position: [2, 1]),
23
- Vedeu::Views::Char.new(name: _name, value: 'b', position: [2, 2]),
49
+ Vedeu::Cells::Char.new(name: _name, value: 'b', position: [2, 2]),
24
50
  Vedeu::Cells::Empty.new(position: [2, 3]),
25
51
  ], [
26
52
  Vedeu::Cells::Empty.new(position: [3, 1]),
27
- Vedeu::Views::Char.new(name: _name, value: 'c', position: [3, 2]),
53
+ Vedeu::Cells::Char.new(name: _name, value: 'c', position: [3, 2]),
28
54
  Vedeu::Cells::Empty.new(position: [3, 3]),
29
55
  ],
30
56
  ])
@@ -56,6 +82,10 @@ module Vedeu
56
82
  it { subject.must_be_instance_of(Vedeu::Models::Page) }
57
83
  end
58
84
 
85
+ describe '#write' do
86
+ it { instance.must_respond_to(:write) }
87
+ end
88
+
59
89
  end # Terminal
60
90
 
61
91
  end # Renderers
@@ -10,7 +10,32 @@ module Vedeu
10
10
 
11
11
  let(:described) { Vedeu::Renderers::Text }
12
12
  let(:instance) { described.new(options) }
13
- let(:options) { {} }
13
+ let(:options) {
14
+ {
15
+ compression: compression,
16
+ end_tag: end_tag,
17
+ end_row_tag: end_row_tag,
18
+ filename: filename,
19
+ output: 'EMPTY',
20
+ start_tag: start_tag,
21
+ start_row_tag: start_row_tag,
22
+ template: template,
23
+ timestamp: timestamp,
24
+ write_file: write_file,
25
+ }
26
+ }
27
+ let(:compression) { false }
28
+ let(:end_tag) { '</td>' }
29
+ let(:end_row_tag) { '</tr>' }
30
+ let(:filename) { 'vedeu_renderers_text' }
31
+ let(:start_tag) { '<td' }
32
+ let(:start_row_tag) { '<tr>' }
33
+ let(:template) {
34
+ ::File.dirname(__FILE__) + '/../../../support/templates/' \
35
+ 'html_renderer.vedeu'
36
+ }
37
+ let(:timestamp) { false }
38
+ let(:write_file) { false }
14
39
 
15
40
  let(:geometry) {
16
41
  Vedeu::Geometries::Geometry.new(name: 'Vedeu::Renderers::Text',
@@ -20,8 +45,11 @@ module Vedeu
20
45
  yn: 4)
21
46
  }
22
47
 
48
+ before { ::File.stubs(:write) }
49
+
23
50
  describe '#initialize' do
24
51
  it { instance.must_be_instance_of(described) }
52
+ it { instance.instance_variable_get('@options').must_equal(options) }
25
53
  end
26
54
 
27
55
  describe '#clear' do
@@ -31,8 +59,6 @@ module Vedeu
31
59
  end
32
60
 
33
61
  describe '#render' do
34
- let(:output) {}
35
-
36
62
  before do
37
63
  Vedeu.stubs(:height).returns(5)
38
64
  Vedeu.stubs(:width).returns(5)
@@ -43,6 +69,8 @@ module Vedeu
43
69
  subject { instance.render(output) }
44
70
 
45
71
  context 'when the output is nil' do
72
+ let(:output) {}
73
+
46
74
  it { subject.must_equal('') }
47
75
  end
48
76
 
@@ -79,6 +107,10 @@ module Vedeu
79
107
  end
80
108
  end
81
109
 
110
+ describe '#write' do
111
+ it { instance.must_respond_to(:write) }
112
+ end
113
+
82
114
  end # Text
83
115
 
84
116
  end # Renderers