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
@@ -68,10 +68,10 @@ module Vedeu
68
68
  let(:content) {
69
69
  [
70
70
  [
71
- Vedeu::Char.new(value: 't'),
72
- Vedeu::Char.new(value: 'e'),
73
- Vedeu::Char.new(value: 's'),
74
- Vedeu::Char.new(value: 't'),
71
+ Vedeu::Views::Char.new(value: 't'),
72
+ Vedeu::Views::Char.new(value: 'e'),
73
+ Vedeu::Views::Char.new(value: 's'),
74
+ Vedeu::Views::Char.new(value: 't'),
75
75
  ]
76
76
  ]
77
77
  }
@@ -34,9 +34,9 @@ module Vedeu
34
34
  let(:output) {
35
35
  [
36
36
  [
37
- Vedeu::Char.new(value: 'a',
38
- colour: colour,
39
- position: Vedeu::Position[5, 3])
37
+ Vedeu::Views::Char.new(value: 'a',
38
+ colour: colour,
39
+ position: Vedeu::Position[5, 3])
40
40
  ]
41
41
  ]
42
42
  }
@@ -105,23 +105,23 @@ module Vedeu
105
105
  describe '.add' do
106
106
  subject { described.add(value, options) }
107
107
 
108
- context 'when the model is a Vedeu::Interface' do
109
- let(:model) { Vedeu::Interface.new }
108
+ context 'when the model is a Vedeu::Views::View' do
109
+ let(:model) { Vedeu::Views::View.new }
110
110
 
111
- it { subject.must_be_instance_of(Vedeu::Lines) }
111
+ it { subject.must_be_instance_of(Vedeu::Views::Lines) }
112
112
  end
113
113
 
114
- context 'when the model is a Vedeu::Line' do
115
- let(:model) { Vedeu::Line.new }
114
+ context 'when the model is a Vedeu::Views::Line' do
115
+ let(:model) { Vedeu::Views::Line.new }
116
116
 
117
- it { subject.must_be_instance_of(Vedeu::Streams) }
117
+ it { subject.must_be_instance_of(Vedeu::Views::Streams) }
118
118
  end
119
119
 
120
- context 'when the model is a Vedeu::Stream' do
121
- let(:parent) { Vedeu::Line.new }
122
- let(:model) { Vedeu::Stream.new(parent: parent) }
120
+ context 'when the model is a Vedeu::Views::Stream' do
121
+ let(:parent) { Vedeu::Views::Line.new }
122
+ let(:model) { Vedeu::Views::Stream.new(parent: parent) }
123
123
 
124
- it { subject.must_be_instance_of(Vedeu::Streams) }
124
+ it { subject.must_be_instance_of(Vedeu::Views::Streams) }
125
125
  end
126
126
 
127
127
  context 'when the model is not given' do
@@ -4,15 +4,10 @@ module Vedeu
4
4
 
5
5
  describe Viewport do
6
6
 
7
- let(:described) { Vedeu::Viewport }
8
- let(:instance) { described.new(interface) }
9
- let(:interface) { Vedeu.interfaces.by_name('lithium') }
10
- let(:visibility) { true }
11
- let(:geometry) { Vedeu::Geometry.new(height: 3, width: 3) }
12
-
13
- before {
14
- Vedeu.geometries.stubs(:by_name).returns(geometry)
15
- Vedeu.interface 'lithium' do
7
+ let(:described) { Vedeu::Viewport }
8
+ let(:instance) { described.new(view) }
9
+ let(:view) {
10
+ Vedeu::Views::View.build(name: 'lithium', style: nil) do
16
11
  lines do
17
12
  line 'barium'
18
13
  line 'carbon'
@@ -21,26 +16,33 @@ module Vedeu
21
16
  line 'nickel'
22
17
  line 'osmium'
23
18
  end
24
- style nil
25
- visible(visibility)
26
19
  end
27
20
  }
21
+ let(:visible) { true }
22
+ let(:interface) { Vedeu::Interface.new(style: nil, visible: visible) }
23
+ let(:geometry) { Vedeu::Geometry.new(height: 3, width: 3) }
24
+
25
+ before {
26
+ Vedeu.interfaces.stubs(:by_name).returns(interface)
27
+ Vedeu.geometries.stubs(:by_name).returns(geometry)
28
+ }
28
29
  after { Vedeu.interfaces.reset }
29
30
 
30
31
  describe '#initialize' do
31
32
  it { instance.must_be_instance_of(described) }
32
- it { instance.instance_variable_get('@interface').must_equal(interface) }
33
+ it { instance.instance_variable_get('@view').must_equal(view) }
33
34
  end
34
35
 
35
36
  describe '.render' do
36
- subject { described.render(interface) }
37
+ subject { described.render(view) }
37
38
 
38
39
  context 'when the interface is visible' do
39
-
40
+ # @todo Add more tests.
41
+ # it { skip }
40
42
  end
41
43
 
42
44
  context 'when the interface is not visible' do
43
- let(:visibility) { false }
45
+ let(:visible) { false }
44
46
 
45
47
  it { subject.must_be_instance_of(Array) }
46
48
 
@@ -49,7 +51,7 @@ module Vedeu
49
51
  end
50
52
 
51
53
  describe '#render' do
52
- let(:cursor) { Cursor.new(cursor_attributes) }
54
+ let(:cursor) { Vedeu::Cursor.new(cursor_attributes) }
53
55
  let(:cursor_attributes) {
54
56
  { name: 'lithium', ox: ox, oy: oy, visible: true, x: x, y: y }
55
57
  }
@@ -59,23 +61,19 @@ module Vedeu
59
61
  let(:x) { 1 }
60
62
  let(:y) { 1 }
61
63
 
62
- before {
63
- interface.stubs(:cursor).returns(cursor)
64
- }
65
-
66
64
  subject { instance.render }
67
65
 
68
66
  it { subject.must_be_instance_of(Array) }
69
67
 
70
68
  context 'when there is no content' do
71
- before { interface.stubs(:lines).returns([]) }
69
+ before { view.stubs(:lines).returns([]) }
72
70
 
73
71
  it { subject.must_equal([]) }
74
72
  end
75
73
  end
76
74
 
77
75
  describe '#to_s' do
78
- let(:cursor) { Cursor.new(cursor_attributes) }
76
+ let(:cursor) { Vedeu::Cursor.new(cursor_attributes) }
79
77
  let(:cursor_attributes) {
80
78
  { name: 'lithium', ox: ox, oy: oy, visible: true, x: x, y: y }
81
79
  }
@@ -90,7 +88,7 @@ module Vedeu
90
88
  it { subject.must_be_instance_of(String) }
91
89
 
92
90
  context 'when there is no content' do
93
- before { interface.stubs(:lines).returns([]) }
91
+ before { view.stubs(:lines).returns([]) }
94
92
 
95
93
  it { subject.must_equal('') }
96
94
  end
@@ -16,7 +16,7 @@ module Vedeu
16
16
  end
17
17
 
18
18
  context 'when buffers are stored' do
19
- let(:buffer) { [[Vedeu::Char.new]] }
19
+ let(:buffer) { [[Vedeu::Views::Char.new]] }
20
20
 
21
21
  before { described.store(buffer) }
22
22
 
@@ -87,7 +87,7 @@ module Vedeu
87
87
  end
88
88
 
89
89
  describe '#write' do
90
- let(:data) { Vedeu::Char.new(value: 'a') }
90
+ let(:data) { Vedeu::Views::Char.new(value: 'a') }
91
91
 
92
92
  subject { instance.write(y, x, data) }
93
93
 
@@ -39,20 +39,20 @@ module Vedeu
39
39
  }
40
40
  let(:text_line_objects) {
41
41
  [
42
- Vedeu::Line.new(streams: [
43
- Vedeu::Stream.new(
42
+ Vedeu::Views::Line.new(streams: [
43
+ Vedeu::Views::Stream.new(
44
44
  value: 'Krypton is a colorless, odorless, tasteless noble gas.'
45
45
  )]),
46
- Vedeu::Line.new(streams: [
47
- Vedeu::Stream.new(
46
+ Vedeu::Views::Line.new(streams: [
47
+ Vedeu::Views::Stream.new(
48
48
  value: 'It occurs in trace amounts in the atmosphere.'
49
49
  )]),
50
- Vedeu::Line.new(streams: [
51
- Vedeu::Stream.new(
50
+ Vedeu::Views::Line.new(streams: [
51
+ Vedeu::Views::Stream.new(
52
52
  value: 'It is isolated by fractionally distilling liquefied air.'
53
53
  )]),
54
- Vedeu::Line.new(streams: [
55
- Vedeu::Stream.new(
54
+ Vedeu::Views::Line.new(streams: [
55
+ Vedeu::Views::Stream.new(
56
56
  value: 'Krypton is often used with other rare gases in ' \
57
57
  'fluorescent lamps.'
58
58
  )])
@@ -187,7 +187,7 @@ module Vedeu
187
187
  describe '#content' do
188
188
  subject { instance.content }
189
189
 
190
- it { subject.must_be_instance_of(Vedeu::Lines) }
190
+ it { subject.must_be_instance_of(Vedeu::Views::Lines) }
191
191
 
192
192
  context 'with a single line of text' do
193
193
  let(:text) { text_line }
@@ -142,7 +142,7 @@ module Vedeu
142
142
  context 'when the model cannot be found' do
143
143
  let(:model_name) { 'not_found' }
144
144
 
145
- it { proc { subject }.must_raise(ModelNotFound) }
145
+ it { proc { subject }.must_raise(Vedeu::ModelNotFound) }
146
146
  end
147
147
 
148
148
  context 'when the model is found' do
@@ -268,7 +268,7 @@ module Vedeu
268
268
  context 'when a name attribute is empty or nil' do
269
269
  before { model_instance.name = '' }
270
270
 
271
- it { proc { subject }.must_raise(MissingRequired) }
271
+ it { proc { subject }.must_raise(Vedeu::MissingRequired) }
272
272
  end
273
273
 
274
274
  context 'when a name attributes is provided' do
@@ -17,12 +17,7 @@ module Vedeu
17
17
 
18
18
  describe '#background' do
19
19
  let(:expected) {
20
- "{{" \
21
- "eJxdj00LwjAMhj1Ip7aKX3iW+Qd2zi5BUdhZ8d5tUYZzla4VxT9vrTrBXJI34UnetD" \
22
- "sKxnvKyQJsjSZ5FjBEaYwuUmuofnDgWVlQZSJXqFJZ/QNWXgcOSGV2Omplq1zB7DNd" \
23
- "Nj0GAt9sEopF5IMBW+8ceVCa/slN02OxSMIWi/s74BepvY1ebe4lKRg1tp1kwPEqS0" \
24
- "tu7nMSTn+m5oZuxm/pVvJM35XO1fu1WGDg1PcCR38CRTzBPvTwxeDgCdSbXHg=" \
25
- "}}"
20
+ "{{eJxdj00LwjAMhj1Ip7aKXwjeZP4Bz9klKAo7K7t3GmU4V+laP/DPW+tUMJfkTfokb+sNBeOEdmQBkoyuJcDaaJInAV2UxugstYbKBwe+zTMqzMwVKldWK+hX3MLrwAGp3B4PWtlip2BUTeffHgOBbzYOxXTmgwFbbhy5V5r+ydW3xyIRhzUWtTfAz1J7G63S3HNS0Kter1+SAceLzC25uc9xOPyZmhi6Gb+lWcgTfVY6V++vRQIDpz4XOPoTKKIBtqGFLwY7T83nXwE=}}"
26
21
  }
27
22
 
28
23
  subject { instance.background('#000000') { 'background text' } }
@@ -48,13 +43,7 @@ module Vedeu
48
43
  }
49
44
  }
50
45
  let(:expected) {
51
- "{{" \
52
- "eJxdj08LwjAMxT1Ip7aKf8CzzC9QPGaXoCjsrHjvNMpwrlJbUfzy1k4neEpewu/l" \
53
- "pdnSMNzSnhzA2hpSZwF9VNaaPHOWrk8OfFfkVFrpG11oZ37AIujIA5nanY5Gu3Kv" \
54
- "YfzZzusZA4EVm8ZiKuVsJiUDttx48qAN/ZOresYSkcYNlnQ3wC/KhBidq30UpGFQ" \
55
- "x/aSAcebKhz5fahp3K9OTizdbXBol+pMXzufqHorERh59XXnGOxRJCPsQgffDPZe" \
56
- "Rsda7A==" \
57
- "}}"
46
+ "{{eJxdj00LwjAMhj1I/WgVP0DwJvMPFI/ZJSgKOyveq0YZzlW61g/889ZuevCUvEmeN0m9qWG8pQM5gG1K9wJgbQ2pi4AeKmtNunOWihcHvs9Syq30ic60MxoGFbcIuuGBndqfT0a7/KBhVHXnvxoDgSWbRGIq5WwmJQO23HjyqA39k6tfjcUiiWos7myAX5UJZ7QL+8xIQ7+aXn8kA443lTny/RCTqFeunFh62ODQytWFvnb+ovKtWGDDq687x2CPIh5iB9r4YbD7BjXvXXU=}}"
58
47
  }
59
48
 
60
49
  it { subject.must_equal(expected) }
@@ -67,13 +56,7 @@ module Vedeu
67
56
  }
68
57
  }
69
58
  let(:expected) {
70
- "{{" \
71
- "eJxdj08LwjAMxT1I/dMqU8GzzC/gOb0ERWFnh/dOMxHnKrUVxS9v1+kEc2lewu/l" \
72
- "td3VMN7RgRzA1hpSFwERKmvNKXOWbi8OfF+cqLQL3+hCO/MDVkF3PJCp/flotCsP" \
73
- "Gqaf7bKZMRBYs0ncYsDWqUdybegf2TQzJkUSi3meL3wxOUiBX5UJMfo3+yxIw6iJ" \
74
- "7SUDjndVOPL78CZxVJ+cWXrY4NAr1YWqBJXwiepvSYEdr77uHIM9CjnBAfSxYnD4" \
75
- "BqMMW1Q=" \
76
- "}}"
59
+ "{{eJxdj8sKwjAQRV1IqiaKDxDcSf0B19PNoCh0rbiPdirF2kia+MCfN02rC2eTuTOcOzftjoLZgRKyAIeMHiXAzmiSVwFDlMbo7GgNlW8O/JRnVJila1SurFYwbri114EDjvJ0OWtli0TBtNmufjMGAms2DlsM2GbvkFRp+ke2vxmLRByKRZouXbGovwd+k9rH6JXmlZOCUQPtKsmA413mltzev3E4rE/ODT2Nd+gW8kpVgkq4RPW3IoGBU193jt4eRTTBPvSwYnDwAZI0Xd0=}}"
77
60
  }
78
61
 
79
62
  it { subject.must_equal(expected) }
@@ -87,13 +70,7 @@ module Vedeu
87
70
  }
88
71
  }
89
72
  let(:expected) {
90
- "{{" \
91
- "eJxdj0sLwjAQhD1IfCSKD/As+geKF2F7WRQFz4r3VLci1kZiIop/3jXVCuaSzCzf" \
92
- "7KRaN9Db0p48wNpZ0mcFHdTO2WPiHV2fEuQuO1LuIn6YzHj7A+ZB1xhI9O50sMbn" \
93
- "ewODz3RWegIUFuxqpMYRn8lEgFhsmEyNpX9yWXoiVm8kTafTKBJxawPyom1o07y6" \
94
- "R0YGumV7lgIk3nTmiefhXo06xeaho7sLCY1cn9mvBMHFit/FCmusvukSQzyquI8t" \
95
- "aOKbwfYLqERctQ==" \
96
- "}}"
73
+ "{{eJxdj8sKwjAQRV1IfCSKDxDcif5AcSNMN4Oi4FrpPupUirWRNPGBP2+aVhfOJnPvcO5M6k0F44hOZAGihB45wM5oklcBPZTG6ORgDeVvDvyYJpSZwDUqVVYrGFTcyuuGAw7yeDlrZbOTglE1Xf48BgJLdjsVs8DVfM6ArfeOjJWmf3Lz81goCiSOF4sgYGFnD/wmtb+mnZtXSgr6FbQrJAOOd5lacnP/bqe9cvPE0NP4hFYmr86veeEOK38XCmw49U3n6ONRhEPsQBsLBrsfqStfPg==}}"
97
74
  }
98
75
 
99
76
  it { subject.must_equal(expected) }
@@ -102,12 +79,7 @@ module Vedeu
102
79
 
103
80
  describe '#foreground' do
104
81
  let(:expected) {
105
- "{{" \
106
- "eJxdj08PATEQxR2ki3bFvzjL+gLOs5cJIdkzcS87ZKO2Uq0QX163WIm5dN5MfvNemy" \
107
- "0Ngy3l5ADW1pA8C+ihtNYUO2fp+uTA96qg0s58o5V25gcsgo48sJP709FoV+Yaxp/t" \
108
- "vJ4xEPhms6TBgC03HjloQ//Iqp6xVGSJmM5CsTTeAL9IE2J0rvahSEO/ju0lA443qR" \
109
- "z5fXizZPRzmFi623ClXcozVSkq4VO9v5YKjLz6OnAMFijSIcbQwYrB7gsCxlyT" \
110
- "}}"
82
+ "{{eJxdj8sKwjAQRV1IqiaKLwR3Un/A9XQzKApdK+6jHaVYG0kTH/jzprEqOJvMneHMvak3FIy3lJAF2KZ0KwDWRpM8C+iiNEanO2uoeHLg+yyl3MxcozJltYJ+xS28Dhywk/vTUSubJwpG1Xb+nTEQ+GbjsMaALTcOOShN/8jqO2ORiEMxnfliUXsD/CK1j9EqzCMjBb0KWpeSAcerzCy5vX/jcPhzmBi6G3+lmcszlSlK4VK9vxYJDJz6OHD0FiiiAbahhSWDnRf8A18c}}"
111
83
  }
112
84
 
113
85
  subject { instance.foreground('#000000') { 'foreground text' } }
@@ -119,12 +91,7 @@ module Vedeu
119
91
 
120
92
  describe '#style' do
121
93
  let(:expected) {
122
- "{{" \
123
- "eJxdj08LwjAMxT1I59b6HzzLPoHn7BIUBc+K926LItZVaiuKX96u6gRveUl+7yXtjo" \
124
- "bRjkpyABtrSJ4FDFBaa465s3R9cuCFOlJlZ77QSjvzAxZBRx7IZXE6GO2qUsPkM503" \
125
- "PQYC3+w6bTFgy61H9trQP7JqeiwT9W7W3QK/SBPyk6t9KNIwbO71kgHHm1SOIM61Ki" \
126
- "EJYp32w/LU0t0Gl7iSZ/pa+nPeP2UCI6++CRwDhSIbYxcSrBnsvQDMNVrp" \
127
- "}}"
94
+ "{{eJxdj09PAjEQxT2YItuiqAkJN8In8Pz2MtFowhnCvcuOZkPZMd3WP/HL0y0LB2/zZt5v3sz1jWC+5ZojsG34uwPWwbM9GEzJhuCbKgbu/jT0zjXchqdUiJPoBQ8D95L1KAGV3e0/vMS2FsyG6fOlp2DoxK6WVwrqdZOQd/H8H3m79FRpem852UB/Wp/ziy78OhbcD+51LxU0fVkXGeNKXI0ii9XyLpsXgX9C3jJu7YHPK9M5p59KQ6OkzgmaMkWmfKQJCuoZuj0Cs8Jdcg==}}"
128
95
  }
129
96
 
130
97
  subject { instance.style(:bold) { 'style text' } }
@@ -23,7 +23,7 @@ module Vedeu
23
23
  context 'when the path is empty' do
24
24
  let(:path) { '' }
25
25
 
26
- it { proc { subject }.must_raise(MissingRequired) }
26
+ it { proc { subject }.must_raise(Vedeu::MissingRequired) }
27
27
  end
28
28
 
29
29
  context 'when the path is does not exist' do
@@ -31,7 +31,7 @@ module Vedeu
31
31
 
32
32
  before { File.stubs(:exist?).returns(false) }
33
33
 
34
- it { proc { subject }.must_raise(MissingRequired) }
34
+ it { proc { subject }.must_raise(Vedeu::MissingRequired) }
35
35
  end
36
36
 
37
37
  context 'when the path exists' do
@@ -23,13 +23,13 @@ module Vedeu
23
23
  context 'with a plain text file' do
24
24
  let(:content) { "This is a test.\n" }
25
25
  let(:expected) {
26
- Vedeu::Lines.new([
27
- Vedeu::Line.new(streams:
28
- Vedeu::Stream.new(colour: {
29
- background: :default,
30
- foreground: :default },
31
- style: :normal,
32
- value: 'This is a test.'))
26
+ Vedeu::Views::Lines.new([
27
+ Vedeu::Views::Line.new(streams:
28
+ Vedeu::Views::Stream.new(colour: {
29
+ background: :default,
30
+ foreground: :default },
31
+ style: :normal,
32
+ value: 'This is a test.'))
33
33
  ])
34
34
  }
35
35
 
@@ -39,19 +39,19 @@ module Vedeu
39
39
  context 'with a plain text file with multiple lines' do
40
40
  let(:content) { "This is a test.\nAnd so is this.\n" }
41
41
  let(:expected) {
42
- Vedeu::Lines.new([
43
- Vedeu::Line.new(streams:
44
- Vedeu::Stream.new(colour: {
45
- background: :default,
46
- foreground: :default },
47
- style: :normal,
48
- value: 'This is a test.')),
49
- Vedeu::Line.new(streams:
50
- Vedeu::Stream.new(colour: {
51
- background: :default,
52
- foreground: :default },
53
- style: :normal,
54
- value: 'And so is this.')),
42
+ Vedeu::Views::Lines.new([
43
+ Vedeu::Views::Line.new(streams:
44
+ Vedeu::Views::Stream.new(colour: {
45
+ background: :default,
46
+ foreground: :default },
47
+ style: :normal,
48
+ value: 'This is a test.')),
49
+ Vedeu::Views::Line.new(streams:
50
+ Vedeu::Views::Stream.new(colour: {
51
+ background: :default,
52
+ foreground: :default },
53
+ style: :normal,
54
+ value: 'And so is this.')),
55
55
  ])
56
56
  }
57
57
 
@@ -65,19 +65,19 @@ module Vedeu
65
65
  }
66
66
 
67
67
  let(:expected) {
68
- Vedeu::Lines.new([
69
- Vedeu::Line.new(streams: [
70
- Vedeu::Stream.new(colour: {
71
- background: :default,
72
- foreground: :default },
73
- style: :normal,
74
- value: 'This is a '),
75
- Vedeu::Stream.new(value: 'test', colour: colour),
76
- Vedeu::Stream.new(colour: {
77
- background: :default,
78
- foreground: :default },
79
- style: :normal,
80
- value: '.'),
68
+ Vedeu::Views::Lines.new([
69
+ Vedeu::Views::Line.new(streams: [
70
+ Vedeu::Views::Stream.new(colour: {
71
+ background: :default,
72
+ foreground: :default },
73
+ style: :normal,
74
+ value: 'This is a '),
75
+ Vedeu::Views::Stream.new(value: 'test', colour: colour),
76
+ Vedeu::Views::Stream.new(colour: {
77
+ background: :default,
78
+ foreground: :default },
79
+ style: :normal,
80
+ value: '.'),
81
81
  ])
82
82
  ])
83
83
  }
@@ -95,25 +95,25 @@ module Vedeu
95
95
  }
96
96
 
97
97
  let(:expected) {
98
- Vedeu::Lines.new([
99
- Vedeu::Line.new(streams: [
100
- Vedeu::Stream.new(colour: {
101
- background: :default,
102
- foreground: :default },
103
- style: :normal,
104
- value: 'This is a '),
105
- Vedeu::Stream.new(value: 'test', colour: colour),
106
- Vedeu::Stream.new(colour: {
107
- background: :default,
108
- foreground: :default },
109
- style: :normal,
110
- value: '. And so is '),
111
- Vedeu::Stream.new(value: 'this', colour: colour),
112
- Vedeu::Stream.new(colour: {
113
- background: :default,
114
- foreground: :default },
115
- style: :normal,
116
- value: '.'),
98
+ Vedeu::Views::Lines.new([
99
+ Vedeu::Views::Line.new(streams: [
100
+ Vedeu::Views::Stream.new(colour: {
101
+ background: :default,
102
+ foreground: :default },
103
+ style: :normal,
104
+ value: 'This is a '),
105
+ Vedeu::Views::Stream.new(value: 'test', colour: colour),
106
+ Vedeu::Views::Stream.new(colour: {
107
+ background: :default,
108
+ foreground: :default },
109
+ style: :normal,
110
+ value: '. And so is '),
111
+ Vedeu::Views::Stream.new(value: 'this', colour: colour),
112
+ Vedeu::Views::Stream.new(colour: {
113
+ background: :default,
114
+ foreground: :default },
115
+ style: :normal,
116
+ value: '.'),
117
117
  ])
118
118
  ])
119
119
  }
@@ -129,19 +129,19 @@ module Vedeu
129
129
  }
130
130
 
131
131
  let(:expected) {
132
- Vedeu::Lines.new([
133
- Vedeu::Line.new(streams: [
134
- Vedeu::Stream.new(colour: {
135
- background: :default,
136
- foreground: :default },
137
- style: :normal,
138
- value: 'This is a '),
139
- Vedeu::Stream.new(value: 'test', colour: colour),
140
- Vedeu::Stream.new(colour: {
141
- background: :default,
142
- foreground: :default },
143
- style: :normal,
144
- value: '.'),
132
+ Vedeu::Views::Lines.new([
133
+ Vedeu::Views::Line.new(streams: [
134
+ Vedeu::Views::Stream.new(colour: {
135
+ background: :default,
136
+ foreground: :default },
137
+ style: :normal,
138
+ value: 'This is a '),
139
+ Vedeu::Views::Stream.new(value: 'test', colour: colour),
140
+ Vedeu::Views::Stream.new(colour: {
141
+ background: :default,
142
+ foreground: :default },
143
+ style: :normal,
144
+ value: '.'),
145
145
  ])
146
146
  ])
147
147
  }
@@ -156,19 +156,19 @@ module Vedeu
156
156
  }
157
157
 
158
158
  let(:expected) {
159
- Vedeu::Lines.new([
160
- Vedeu::Line.new(streams: [
161
- Vedeu::Stream.new(colour: {
162
- background: :default,
163
- foreground: :default },
164
- style: :normal,
165
- value: 'This is a '),
166
- Vedeu::Stream.new(value: 'test', colour: colour),
167
- Vedeu::Stream.new(colour: {
168
- background: :default,
169
- foreground: :default },
170
- style: :normal,
171
- value: '.'),
159
+ Vedeu::Views::Lines.new([
160
+ Vedeu::Views::Line.new(streams: [
161
+ Vedeu::Views::Stream.new(colour: {
162
+ background: :default,
163
+ foreground: :default },
164
+ style: :normal,
165
+ value: 'This is a '),
166
+ Vedeu::Views::Stream.new(value: 'test', colour: colour),
167
+ Vedeu::Views::Stream.new(colour: {
168
+ background: :default,
169
+ foreground: :default },
170
+ style: :normal,
171
+ value: '.'),
172
172
  ])
173
173
  ])
174
174
  }
@@ -183,19 +183,19 @@ module Vedeu
183
183
  }
184
184
 
185
185
  let(:expected) {
186
- Vedeu::Lines.new([
187
- Vedeu::Line.new(streams: [
188
- Vedeu::Stream.new(colour: {
189
- background: :default,
190
- foreground: :default },
191
- style: :normal,
192
- value: 'This is a '),
193
- Vedeu::Stream.new(value: 'test', style: style),
194
- Vedeu::Stream.new(colour: {
195
- background: :default,
196
- foreground: :default },
197
- style: :normal,
198
- value: '.'),
186
+ Vedeu::Views::Lines.new([
187
+ Vedeu::Views::Line.new(streams: [
188
+ Vedeu::Views::Stream.new(colour: {
189
+ background: :default,
190
+ foreground: :default },
191
+ style: :normal,
192
+ value: 'This is a '),
193
+ Vedeu::Views::Stream.new(value: 'test', style: style),
194
+ Vedeu::Views::Stream.new(colour: {
195
+ background: :default,
196
+ foreground: :default },
197
+ style: :normal,
198
+ value: '.'),
199
199
  ])
200
200
  ])
201
201
  }