vedeu 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vedeu/all.rb +2 -13
  3. data/lib/vedeu/api.rb +9 -9
  4. data/lib/vedeu/application/application_view.rb +3 -5
  5. data/lib/vedeu/bindings/bindings.rb +5 -1
  6. data/lib/vedeu/bindings/focus.rb +0 -5
  7. data/lib/vedeu/bindings/refresh.rb +0 -5
  8. data/lib/vedeu/bindings/system.rb +1 -6
  9. data/lib/vedeu/colours/all.rb +17 -0
  10. data/lib/vedeu/colours/background.rb +32 -28
  11. data/lib/vedeu/colours/backgrounds.rb +13 -9
  12. data/lib/vedeu/colours/colour.rb +106 -102
  13. data/lib/vedeu/colours/foreground.rb +32 -28
  14. data/lib/vedeu/colours/foregrounds.rb +13 -9
  15. data/lib/vedeu/colours/repository.rb +70 -0
  16. data/lib/vedeu/colours/translator.rb +267 -0
  17. data/lib/vedeu/configuration/api.rb +10 -7
  18. data/lib/vedeu/configuration/configuration.rb +2 -1
  19. data/lib/vedeu/dsl/border.rb +15 -2
  20. data/lib/vedeu/dsl/composition.rb +6 -4
  21. data/lib/vedeu/dsl/geometry.rb +14 -7
  22. data/lib/vedeu/dsl/group.rb +2 -2
  23. data/lib/vedeu/dsl/interface.rb +5 -3
  24. data/lib/vedeu/dsl/keymap.rb +9 -7
  25. data/lib/vedeu/dsl/line.rb +7 -4
  26. data/lib/vedeu/dsl/menu.rb +3 -0
  27. data/lib/vedeu/dsl/presentation.rb +20 -10
  28. data/lib/vedeu/dsl/shared.rb +4 -4
  29. data/lib/vedeu/dsl/stream.rb +2 -2
  30. data/lib/vedeu/dsl/text.rb +11 -5
  31. data/lib/vedeu/dsl/use.rb +2 -2
  32. data/lib/vedeu/dsl/view.rb +8 -6
  33. data/lib/vedeu/events/aliases.rb +91 -0
  34. data/lib/vedeu/events/all.rb +15 -0
  35. data/lib/vedeu/events/collection.rb +13 -0
  36. data/lib/vedeu/events/event.rb +244 -239
  37. data/lib/vedeu/events/repository.rb +30 -0
  38. data/lib/vedeu/events/trigger.rb +68 -64
  39. data/lib/vedeu/exceptions.rb +65 -54
  40. data/lib/vedeu/geometry/coordinate.rb +3 -1
  41. data/lib/vedeu/geometry/grid.rb +2 -4
  42. data/lib/vedeu/input/editor/all.rb +2 -1
  43. data/lib/vedeu/input/editor/{virtual_cursor.rb → cursor.rb} +10 -10
  44. data/lib/vedeu/input/editor/document.rb +7 -7
  45. data/lib/vedeu/input/editor/insert.rb +70 -0
  46. data/lib/vedeu/input/editor/line.rb +4 -16
  47. data/lib/vedeu/input/editor/lines.rb +2 -16
  48. data/lib/vedeu/input/input_translator.rb +2 -2
  49. data/lib/vedeu/input/key.rb +2 -2
  50. data/lib/vedeu/internal_api.rb +6 -6
  51. data/lib/vedeu/log/lockless_log_device.rb +0 -74
  52. data/lib/vedeu/models/focus.rb +3 -3
  53. data/lib/vedeu/models/interface.rb +3 -3
  54. data/lib/vedeu/models/menu.rb +2 -2
  55. data/lib/vedeu/models/views/char.rb +1 -1
  56. data/lib/vedeu/models/views/composition.rb +1 -1
  57. data/lib/vedeu/models/views/line.rb +1 -1
  58. data/lib/vedeu/models/views/stream.rb +1 -1
  59. data/lib/vedeu/models/views/view.rb +6 -7
  60. data/lib/vedeu/output/presentation/colour.rb +23 -21
  61. data/lib/vedeu/output/renderers/renderer_options.rb +2 -4
  62. data/lib/vedeu/output/text.rb +1 -1
  63. data/lib/vedeu/output/wordwrap.rb +18 -7
  64. data/lib/vedeu/plugins/plugin.rb +2 -2
  65. data/lib/vedeu/refresh/refresh_buffer.rb +3 -3
  66. data/lib/vedeu/refresh/refresh_group.rb +3 -3
  67. data/lib/vedeu/repositories/repository.rb +7 -6
  68. data/lib/vedeu/runtime/application.rb +1 -1
  69. data/lib/vedeu/runtime/main_loop.rb +3 -3
  70. data/lib/vedeu/runtime/router.rb +14 -11
  71. data/lib/vedeu/templating/helpers.rb +5 -5
  72. data/lib/vedeu/templating/template.rb +4 -4
  73. data/lib/vedeu/templating/view_template.rb +1 -1
  74. data/lib/vedeu/terminal/terminal.rb +2 -2
  75. data/lib/vedeu/version.rb +1 -1
  76. data/test/lib/vedeu/application/application_view_test.rb +1 -1
  77. data/test/lib/vedeu/colours/background_test.rb +93 -89
  78. data/test/lib/vedeu/colours/backgrounds_test.rb +11 -7
  79. data/test/lib/vedeu/colours/colour_test.rb +155 -151
  80. data/test/lib/vedeu/colours/foreground_test.rb +93 -89
  81. data/test/lib/vedeu/colours/foregrounds_test.rb +11 -7
  82. data/test/lib/vedeu/colours/repository_test.rb +97 -0
  83. data/test/lib/vedeu/colours/translator_test.rb +173 -0
  84. data/test/lib/vedeu/configuration/api_test.rb +4 -4
  85. data/test/lib/vedeu/dsl/border_test.rb +12 -0
  86. data/test/lib/vedeu/dsl/composition_test.rb +3 -3
  87. data/test/lib/vedeu/dsl/geometry_test.rb +11 -0
  88. data/test/lib/vedeu/dsl/group_test.rb +2 -2
  89. data/test/lib/vedeu/dsl/interface_test.rb +4 -4
  90. data/test/lib/vedeu/dsl/keymap_test.rb +8 -4
  91. data/test/lib/vedeu/dsl/line_test.rb +6 -3
  92. data/test/lib/vedeu/dsl/menu_test.rb +6 -0
  93. data/test/lib/vedeu/dsl/presentation_test.rb +16 -3
  94. data/test/lib/vedeu/dsl/stream_test.rb +1 -1
  95. data/test/lib/vedeu/dsl/text_test.rb +7 -0
  96. data/test/lib/vedeu/dsl/view_test.rb +3 -3
  97. data/test/lib/vedeu/events/aliases_test.rb +144 -0
  98. data/test/lib/vedeu/events/collection_test.rb +22 -0
  99. data/test/lib/vedeu/events/event_test.rb +84 -80
  100. data/test/lib/vedeu/events/repository_test.rb +28 -0
  101. data/test/lib/vedeu/events/trigger_test.rb +41 -37
  102. data/test/lib/vedeu/geometry/grid_test.rb +4 -4
  103. data/test/lib/vedeu/input/editor/{virtual_cursor_test.rb → cursor_test.rb} +3 -3
  104. data/test/lib/vedeu/input/editor/insert_test.rb +36 -0
  105. data/test/lib/vedeu/input/key_test.rb +1 -1
  106. data/test/lib/vedeu/models/cell_test.rb +1 -1
  107. data/test/lib/vedeu/models/focus_test.rb +4 -2
  108. data/test/lib/vedeu/models/menu_test.rb +1 -1
  109. data/test/lib/vedeu/models/views/char_test.rb +8 -4
  110. data/test/lib/vedeu/models/views/line_test.rb +4 -4
  111. data/test/lib/vedeu/models/views/stream_test.rb +3 -3
  112. data/test/lib/vedeu/models/views/view_test.rb +1 -1
  113. data/test/lib/vedeu/output/html_char_test.rb +4 -2
  114. data/test/lib/vedeu/output/presentation/colour_test.rb +5 -5
  115. data/test/lib/vedeu/output/presentation_test.rb +4 -4
  116. data/test/lib/vedeu/output/renderers/json_test.rb +4 -2
  117. data/test/lib/vedeu/plugins/plugin_test.rb +1 -1
  118. data/test/lib/vedeu/refresh/refresh_buffer_test.rb +1 -1
  119. data/test/lib/vedeu/refresh/refresh_group_test.rb +1 -1
  120. data/test/lib/vedeu/repositories/repository_test.rb +2 -2
  121. data/test/lib/vedeu/runtime/router_test.rb +6 -6
  122. data/test/lib/vedeu/templating/decoder_test.rb +2 -3
  123. data/test/lib/vedeu/templating/encoder_test.rb +2 -3
  124. data/test/lib/vedeu/templating/helpers_test.rb +6 -6
  125. data/test/lib/vedeu/templating/template_test.rb +2 -2
  126. data/test/lib/vedeu/templating/view_template_test.rb +13 -7
  127. data/test/lib/vedeu/terminal/terminal_test.rb +3 -3
  128. metadata +24 -19
  129. data/lib/vedeu/colours/colour_translator.rb +0 -260
  130. data/lib/vedeu/colours/colours.rb +0 -66
  131. data/lib/vedeu/events/event_aliases.rb +0 -87
  132. data/lib/vedeu/events/event_collection.rb +0 -9
  133. data/lib/vedeu/events/events.rb +0 -26
  134. data/test/lib/vedeu/colours/colour_translator_test.rb +0 -169
  135. data/test/lib/vedeu/colours/colours_test.rb +0 -93
  136. data/test/lib/vedeu/events/event_aliases_test.rb +0 -140
  137. data/test/lib/vedeu/events/event_collection_test.rb +0 -18
  138. data/test/lib/vedeu/events/events_test.rb +0 -24
@@ -69,7 +69,8 @@ module Vedeu
69
69
  end
70
70
 
71
71
  it 'raises an exception if the interface does not exist' do
72
- proc { Vedeu::Focus.by_name('not_found') }.must_raise(Vedeu::ModelNotFound)
72
+ proc { Vedeu::Focus.by_name('not_found') }.
73
+ must_raise(Vedeu::Error::ModelNotFound)
73
74
  end
74
75
 
75
76
  context 'API methods' do
@@ -81,7 +82,8 @@ module Vedeu
81
82
  end
82
83
 
83
84
  it 'raises an exception if the interface does not exist' do
84
- proc { Vedeu.focus_by_name('not_found') }.must_raise(Vedeu::ModelNotFound)
85
+ proc { Vedeu.focus_by_name('not_found') }.
86
+ must_raise(Vedeu::Error::ModelNotFound)
85
87
  end
86
88
  end
87
89
  end
@@ -31,7 +31,7 @@ module Vedeu
31
31
  context 'when the block is not given' do
32
32
  subject { described.menu }
33
33
 
34
- it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
34
+ it { proc { subject }.must_raise(Vedeu::Error::InvalidSyntax) }
35
35
  end
36
36
  end
37
37
 
@@ -130,12 +130,16 @@ module Vedeu
130
130
  end
131
131
 
132
132
  context 'when a colour is specified' do
133
- let(:colour) { Vedeu::Colour.new(foreground: '#00ff00',
134
- background: '#005500') }
133
+ let(:colour) {
134
+ Vedeu::Colours::Colour.new(foreground: '#00ff00',
135
+ background: '#005500')
136
+ }
135
137
 
136
138
  context 'and a parent colour is specified' do
137
- let(:parent_colour) { Vedeu::Colour.new(foreground: '#ff0000',
138
- background: '#550000') }
139
+ let(:parent_colour) {
140
+ Vedeu::Colours::Colour.new(foreground: '#ff0000',
141
+ background: '#550000')
142
+ }
139
143
 
140
144
  it { subject.must_equal("\e[38;2;0;255;0m\e[48;2;0;85;0ma") }
141
145
  end
@@ -20,15 +20,15 @@ module Vedeu
20
20
  [
21
21
  Vedeu::Views::Stream.new(value: 'Something interesting ',
22
22
  parent: streams_parent,
23
- colour: Vedeu::Colour.new(foreground: '#ffff00'),
23
+ colour: Vedeu::Colours::Colour.new(foreground: '#ffff00'),
24
24
  style: Vedeu::Style.new('normal')),
25
25
  Vedeu::Views::Stream.new(value: 'on this line ',
26
26
  parent: streams_parent,
27
- colour: Vedeu::Colour.new(foreground: '#00ff00'),
27
+ colour: Vedeu::Colours::Colour.new(foreground: '#00ff00'),
28
28
  style: Vedeu::Style.new('normal')),
29
29
  Vedeu::Views::Stream.new(value: 'would be cool, eh?',
30
30
  parent: streams_parent,
31
- colour: Vedeu::Colour.new(foreground: '#0000ff'),
31
+ colour: Vedeu::Colours::Colour.new(foreground: '#0000ff'),
32
32
  style: Vedeu::Style.new('normal'))
33
33
  ]
34
34
  }
@@ -42,7 +42,7 @@ module Vedeu
42
42
 
43
43
  let(:parent) { Vedeu::Views::View.new(name: 'Vedeu::Line') }
44
44
  let(:colour) {
45
- Vedeu::Colour.new(foreground: '#ff0000', background: '#000000')
45
+ Vedeu::Colours::Colour.new(foreground: '#ff0000', background: '#000000')
46
46
  }
47
47
  let(:style) { Vedeu::Style.new('normal') }
48
48
 
@@ -24,10 +24,10 @@ module Vedeu
24
24
  style: style)
25
25
  }
26
26
  let(:parent_colour) {
27
- Vedeu::Colour.new(background: '#0000ff', foreground: '#ffff00')
27
+ Vedeu::Colours::Colour.new(background: '#0000ff', foreground: '#ffff00')
28
28
  }
29
29
  let(:colour) {
30
- Vedeu::Colour.new(background: '#ff0000', foreground: '#000000')
30
+ Vedeu::Colours::Colour.new(background: '#ff0000', foreground: '#000000')
31
31
  }
32
32
  let(:style) { Vedeu::Style.new('normal') }
33
33
  let(:line_parent) { Vedeu::Views::View.new(name: 'Vedeu::Views::Stream') }
@@ -85,7 +85,7 @@ module Vedeu
85
85
 
86
86
  context 'when different to other' do
87
87
  let(:other) {
88
- described.new(colour: Vedeu::Colour.coerce(background: '#ff0000'))
88
+ described.new(colour: Vedeu::Colours::Colour.coerce(background: '#ff0000'))
89
89
  }
90
90
 
91
91
  it { subject.must_equal(false) }
@@ -78,7 +78,7 @@ module Vedeu
78
78
  context 'when the name is not defined' do
79
79
  let(:_name) {}
80
80
 
81
- it { proc { subject }.must_raise(Vedeu::InvalidSyntax) }
81
+ it { proc { subject }.must_raise(Vedeu::Error::InvalidSyntax) }
82
82
  end
83
83
  end
84
84
 
@@ -43,7 +43,8 @@ module Vedeu
43
43
 
44
44
  context 'when there is a colour' do
45
45
  let(:colour) {
46
- Vedeu::Colour.new(background: '#220022', foreground: '#aadd00')
46
+ Vedeu::Colours::Colour.new(background: '#220022',
47
+ foreground: '#aadd00')
47
48
  }
48
49
 
49
50
  it { subject.must_equal(
@@ -60,7 +61,8 @@ module Vedeu
60
61
  context 'when there is no colour' do
61
62
  context 'when there is a parent colour' do
62
63
  let(:parent_colour) {
63
- Vedeu::Colour.new(background: '#002222', foreground: '#dd2200')
64
+ Vedeu::Colours::Colour.new(background: '#002222',
65
+ foreground: '#dd2200')
64
66
  }
65
67
 
66
68
  it { subject.must_equal(
@@ -54,7 +54,7 @@ module Vedeu
54
54
  describe '#background' do
55
55
  subject { includer.background }
56
56
 
57
- it { subject.must_be_instance_of(Vedeu::Background) }
57
+ it { subject.must_be_instance_of(Vedeu::Colours::Background) }
58
58
 
59
59
  context 'when a colour is not set' do
60
60
  let(:colour) {}
@@ -90,7 +90,7 @@ module Vedeu
90
90
  describe '#foreground' do
91
91
  subject { includer.foreground }
92
92
 
93
- it { subject.must_be_instance_of(Vedeu::Foreground) }
93
+ it { subject.must_be_instance_of(Vedeu::Colours::Foreground) }
94
94
  it { subject.colour.must_equal('#aadd00') }
95
95
 
96
96
  context 'when a colour is not set' do
@@ -127,7 +127,7 @@ module Vedeu
127
127
  describe '#colour' do
128
128
  subject { includer.colour }
129
129
 
130
- it { subject.must_be_instance_of(Vedeu::Colour) }
130
+ it { subject.must_be_instance_of(Vedeu::Colours::Colour) }
131
131
 
132
132
  context 'when a colour is not set' do
133
133
  let(:colour) {}
@@ -153,12 +153,12 @@ module Vedeu
153
153
 
154
154
  describe '#colour=' do
155
155
  let(:colour) {
156
- Vedeu::Colour.new(foreground: '#00ff00', background: '#000000')
156
+ Vedeu::Colours::Colour.new(foreground: '#00ff00', background: '#000000')
157
157
  }
158
158
 
159
159
  subject { includer.colour=(colour) }
160
160
 
161
- it { subject.must_be_instance_of(Vedeu::Colour) }
161
+ it { subject.must_be_instance_of(Vedeu::Colours::Colour) }
162
162
  end
163
163
 
164
164
  end # Colour
@@ -48,15 +48,15 @@ module Vedeu
48
48
  let(:line) {
49
49
  Vedeu::Views::Line.new(value: [],
50
50
  parent: Vedeu::Interface.new,
51
- colour: Vedeu::Colour.new(foreground: '#00ff00',
52
- background: '#000000'),
51
+ colour: Vedeu::Colours::Colour.new(foreground: '#00ff00',
52
+ background: '#000000'),
53
53
  style: Vedeu::Style.new('normal'))
54
54
  }
55
55
  let(:stream) {
56
56
  Vedeu::Views::Stream.new(value: stream_value,
57
57
  parent: line,
58
- colour: Vedeu::Colour.new(foreground: '#ff0000',
59
- background: '#000000'),
58
+ colour: Vedeu::Colours::Colour.new(foreground: '#ff0000',
59
+ background: '#000000'),
60
60
  style: stream_style)
61
61
  }
62
62
  let(:stream_value) { 'Some text' }
@@ -29,7 +29,8 @@ module Vedeu
29
29
 
30
30
  context 'when the output is not empty' do
31
31
  let(:colour) {
32
- Vedeu::Colour.new(foreground: '#ff0000', background: '#ffffff')
32
+ Vedeu::Colours::Colour.new(foreground: '#ff0000',
33
+ background: '#ffffff')
33
34
  }
34
35
  let(:output) {
35
36
  [
@@ -69,7 +70,8 @@ module Vedeu
69
70
  context 'when a parent is available' do
70
71
  let(:parent) {
71
72
  Vedeu::Views::Stream.new(
72
- colour: Vedeu::Colour.coerce(background: '', foreground: '')
73
+ colour: Vedeu::Colours::Colour.coerce(background: '',
74
+ foreground: '')
73
75
  )
74
76
  }
75
77
 
@@ -37,7 +37,7 @@ module Vedeu
37
37
  Kernel.stubs(:require).raises(LoadError)
38
38
  end
39
39
 
40
- it { proc { subject }.must_raise(Vedeu::VedeuError) }
40
+ it { proc { subject }.must_raise(Vedeu::Error::Fatal) }
41
41
  it { instance.enabled.must_equal(false) }
42
42
  end
43
43
 
@@ -19,7 +19,7 @@ module Vedeu
19
19
  context 'when the name is not present' do
20
20
  let(:_name) { '' }
21
21
 
22
- it { proc { subject }.must_raise(Vedeu::MissingRequired) }
22
+ it { proc { subject }.must_raise(Vedeu::Error::MissingRequired) }
23
23
  end
24
24
 
25
25
  # describe '.by_name' do
@@ -19,7 +19,7 @@ module Vedeu
19
19
  context 'when the name is not present' do
20
20
  let(:_name) { '' }
21
21
 
22
- it { proc { subject }.must_raise(Vedeu::MissingRequired) }
22
+ it { proc { subject }.must_raise(Vedeu::Error::MissingRequired) }
23
23
  end
24
24
 
25
25
  context 'when the name is present' do
@@ -147,7 +147,7 @@ module Vedeu
147
147
  context 'when the model cannot be found' do
148
148
  let(:model_name) { 'not_found' }
149
149
 
150
- it { proc { subject }.must_raise(Vedeu::ModelNotFound) }
150
+ it { proc { subject }.must_raise(Vedeu::Error::ModelNotFound) }
151
151
  end
152
152
 
153
153
  context 'when the model is found' do
@@ -247,7 +247,7 @@ module Vedeu
247
247
  context 'when a name attribute is empty or nil' do
248
248
  before { model_instance.name = '' }
249
249
 
250
- it { proc { subject }.must_raise(Vedeu::MissingRequired) }
250
+ it { proc { subject }.must_raise(Vedeu::Error::MissingRequired) }
251
251
  end
252
252
 
253
253
  context 'when a name attributes is provided' do
@@ -26,7 +26,7 @@ module Vedeu
26
26
  subject { described.add_controller(controller, klass) }
27
27
 
28
28
  context 'when a name is not given' do
29
- it { proc { subject }.must_raise(Vedeu::MissingRequired) }
29
+ it { proc { subject }.must_raise(Vedeu::Error::MissingRequired) }
30
30
  end
31
31
 
32
32
  context 'when a name is given' do
@@ -71,13 +71,13 @@ module Vedeu
71
71
  context 'when the controller is not given' do
72
72
  let(:action) { :some_action }
73
73
 
74
- it { proc { subject }.must_raise(Vedeu::MissingRequired) }
74
+ it { proc { subject }.must_raise(Vedeu::Error::MissingRequired) }
75
75
  end
76
76
 
77
77
  context 'when the name is not given' do
78
78
  let(:controller) { :some_controller }
79
79
 
80
- it { proc { subject }.must_raise(Vedeu::MissingRequired) }
80
+ it { proc { subject }.must_raise(Vedeu::Error::MissingRequired) }
81
81
  end
82
82
 
83
83
  context 'when the controller and name is given' do
@@ -155,7 +155,7 @@ module Vedeu
155
155
  described.add_controller(controller, 'Vedeu::SomeController')
156
156
  end
157
157
 
158
- it { proc { subject }.must_raise(Vedeu::ActionNotFound) }
158
+ it { proc { subject }.must_raise(Vedeu::Error::ActionNotFound) }
159
159
  end
160
160
 
161
161
  context 'when the controller klass is not defined' do
@@ -165,12 +165,12 @@ module Vedeu
165
165
  end
166
166
  after { described.reset! }
167
167
 
168
- it { proc { subject }.must_raise(Vedeu::MissingRequired) }
168
+ it { proc { subject }.must_raise(Vedeu::Error::MissingRequired) }
169
169
  end
170
170
  end
171
171
 
172
172
  context 'when the controller is not registered' do
173
- it { proc { subject }.must_raise(Vedeu::ControllerNotFound) }
173
+ it { proc { subject }.must_raise(Vedeu::Error::ControllerNotFound) }
174
174
  end
175
175
  end
176
176
 
@@ -9,11 +9,10 @@ module Vedeu
9
9
  let(:described) { Vedeu::Templating::Decoder }
10
10
  let(:instance) { described.new(data) }
11
11
  let(:data) {
12
- "eJxj4ci3EgpLTUkttbJyzs/JLy1itxJwSEpMzk4vyi/NS8m3EoPKOsHF2Kx4HJLBaj" \
13
- "2VeJTT0gyAgM2KzTUEqDMtvygVXacbXIzNmgOkxcAApInNmjMEAAMcJsQ="
12
+ "{{eJxj4ci3kg5LTUkttbJyzs/JLy0qhjHYrQQckhKTs9OL8kvzUvKt5NGVOcEl2ax4HJLBwp5KPMppaQZAwGbF5hoCNCItvygVpxFucEk2aw6QXgMDkG42a84QAEnkMPA=}}"
14
13
  }
15
14
  let(:expected) {
16
- Vedeu::Colour.new(background: '#ff0000', foreground: '#00ff00')
15
+ Vedeu::Colours::Colour.new(background: '#ff0000', foreground: '#00ff00')
17
16
  }
18
17
 
19
18
  describe '#initialize' do
@@ -9,11 +9,10 @@ module Vedeu
9
9
  let(:described) { Vedeu::Templating::Encoder }
10
10
  let(:instance) { described.new(data) }
11
11
  let(:data) {
12
- Vedeu::Colour.new(background: '#ff0000', foreground: '#00ff00')
12
+ Vedeu::Colours::Colour.new(background: '#ff0000', foreground: '#00ff00')
13
13
  }
14
14
  let(:expected) {
15
- "{{eJxj4ci3EgpLTUkttbJyzs/JLy1itxJwSEpMzk4vyi/NS8m3EoPKOsHF2Kx4HJLBaj" \
16
- "2VeJTT0gyAgM2KzTUEqDMtvygVXacbXIzNmgOkxcAApInNmjMEAAMcJsQ=}}"
15
+ "{{eJxj4ci3kg5LTUkttbJyzs/JLy0qhjHYrQQckhKTs9OL8kvzUvKt5NGVOcEl2ax4HJLBwp5KPMppaQZAwGbF5hoCNCItvygVpxFucEk2aw6QXgMDkG42a84QAEnkMPA=}}"
17
16
  }
18
17
 
19
18
  describe '#initialize' do
@@ -17,7 +17,7 @@ module Vedeu
17
17
 
18
18
  describe '#background' do
19
19
  let(:expected) {
20
- "{{eJxdj00LwjAMhj1Ip7aKXwjeZP4Bz9klKAo7K7t3GmU4V+laP/DPW+tUMJfkTfokb+sNBeOEdmQBkoyuJcDaaJInAV2UxugstYbKBwe+zTMqzMwVKldWK+hX3MLrwAGp3B4PWtlip2BUTeffHgOBbzYOxXTmgwFbbhy5V5r+ydW3xyIRhzUWtTfAz1J7G63S3HNS0Kter1+SAceLzC25uc9xOPyZmhi6Gb+lWcgTfVY6V++vRQIDpz4XOPoTKKIBtqGFLwY7T83nXwE=}}"
20
+ "{{eJx1j08PATEQxR2ki5YQLuJA1hdwnr1MCMmeiXvZIRtrK93Wn/jyqiyJRC+dl9f3m9dqTUF/TQlZgHVKlwJgaTTJo4A2SmN0urGGijsHvs1Sys3EDSpTVisYvHMzr4tyCFxyI7eHvVY2TxQMf59NPyYDgS9aHIrxxB8GbL5yiJ3S9Bex+JgsEnFYYVFzBfwktW/YKMwtIwWdd2z5lAw4nmVmyfn+jsPet+bI0NV4Sj2XRyqRrt7r15HAwKlyA0e/AkXUxSY08JnB1gP9j2kt}}"
21
21
  }
22
22
 
23
23
  subject { instance.background('#000000') { 'background text' } }
@@ -43,7 +43,7 @@ module Vedeu
43
43
  }
44
44
  }
45
45
  let(:expected) {
46
- "{{eJxdj00LwjAMhj1I/WgVP0DwJvMPFI/ZJSgKOyveq0YZzlW61g/889ZuevCUvEmeN0m9qWG8pQM5gG1K9wJgbQ2pi4AeKmtNunOWihcHvs9Syq30ic60MxoGFbcIuuGBndqfT0a7/KBhVHXnvxoDgSWbRGIq5WwmJQO23HjyqA39k6tfjcUiiWos7myAX5UJZ7QL+8xIQ7+aXn8kA443lTny/RCTqFeunFh62ODQytWFvnb+ovKtWGDDq687x2CPIh5iB9r4YbD7BjXvXXU=}}"
46
+ "{{eJx1jzGPwjAMhRlQypEUcboJMYDKH4gY3cW6Eyd1BrGnYFBFaVCacKD784SUMiAx2U/P77Pd7WkYrWlLDmBd0F8NsLSG1FHAEJW1psidpfqfA9+UBVVW+kaX2hkN40fuJ+i6bSKfzNXmsDfaVVsNk9ex76fJQGBDyxIxk3I+l5IBW6w8YqcNvUX8Pk2WiizpsDReAT8pEy7s1/ZakobPR2x5lww4nlXpyPuhZsmw2T21dLGB8FGpI7U4f1rzcSow8qqlcwx4FOkXxtDHewYHNz0LZ6E=}}"
47
47
  }
48
48
 
49
49
  it { subject.must_equal(expected) }
@@ -56,7 +56,7 @@ module Vedeu
56
56
  }
57
57
  }
58
58
  let(:expected) {
59
- "{{eJxdj8sKwjAQRV1IqiaKDxDcSf0B19PNoCh0rbiPdirF2kia+MCfN02rC2eTuTOcOzftjoLZgRKyAIeMHiXAzmiSVwFDlMbo7GgNlW8O/JRnVJila1SurFYwbri114EDjvJ0OWtli0TBtNmufjMGAms2DlsM2GbvkFRp+ke2vxmLRByKRZouXbGovwd+k9rH6JXmlZOCUQPtKsmA413mltzev3E4rE/ODT2Nd+gW8kpVgkq4RPW3IoGBU193jt4eRTTBPvSwYnDwAZI0Xd0=}}"
59
+ "{{eJx1j0sLwjAQhD1IfCQVxZN4UOof8Ly9LIpCz4r3qFspto2kiQ/886apehDMJTtMvtlJs61gtKMjWYBdSrcSYGM0yVxAH6UxOt1bQ+WTAz9kKRVm7gaVKasVjN/c0uvyM7QcuZeH80krWxwVTH6fLb4mA4F1Whw2GLDV1rGJ0vSXXX9NFok4FLMkmbvDomAL/CK1b9gtzSMjBYM3vakkA45XmVlyvr/jsF/vnhq6G5/QKWROVZVKuGr1jyOBLac+6Rx9PIpoiAF0sWKw9wKlIWgJ}}"
60
60
  }
61
61
 
62
62
  it { subject.must_equal(expected) }
@@ -70,7 +70,7 @@ module Vedeu
70
70
  }
71
71
  }
72
72
  let(:expected) {
73
- "{{eJxdj8sKwjAQRV1IfCSKDxDcif5AcSNMN4Oi4FrpPupUirWRNPGBP2+aVhfOJnPvcO5M6k0F44hOZAGihB45wM5oklcBPZTG6ORgDeVvDvyYJpSZwDUqVVYrGFTcyuuGAw7yeDlrZbOTglE1Xf48BgJLdjsVs8DVfM6ArfeOjJWmf3Lz81goCiSOF4sgYGFnD/wmtb+mnZtXSgr6FbQrJAOOd5lacnP/bqe9cvPE0NP4hFYmr86veeEOK38XCmw49U3n6ONRhEPsQBsLBrsfqStfPg==}}"
73
+ "{{eJx1j0sLwjAQhD1IfCSK4kk8KPoHihdhe1kUBc8V71G3UqyNpIkP/POmqXoQzCU7O5mPSbWuoL+lA1mAbUK3HCAymuRZQAelMTrZWUP5kwPfpwllJnCDSpXVCgbv3MLr/DPUXHIn96ejVjY7KBj+Ppt/TQYCS9p6LCaBO9MpA7bcOESsNP1FrL4mC0WRjePZLAhY2NoAv0jtizZz80hJQfedjgrJgONVppac7+/1uFNWGBm6G09oZPLs9hUvXMPy46HAmlMfOkePRxH2sAVNLDLYfgH3e2lq}}"
74
74
  }
75
75
 
76
76
  it { subject.must_equal(expected) }
@@ -79,7 +79,7 @@ module Vedeu
79
79
 
80
80
  describe '#foreground' do
81
81
  let(:expected) {
82
- "{{eJxdj8sKwjAQRV1IqiaKLwR3Un/A9XQzKApdK+6jHaVYG0kTH/jzprEqOJvMneHMvak3FIy3lJAF2KZ0KwDWRpM8C+iiNEanO2uoeHLg+yyl3MxcozJltYJ+xS28Dhywk/vTUSubJwpG1Xb+nTEQ+GbjsMaALTcOOShN/8jqO2ORiEMxnfliUXsD/CK1j9EqzCMjBb0KWpeSAcerzCy5vX/jcPhzmBi6G3+lmcszlSlK4VK9vxYJDJz6OHD0FiiiAbahhSWDnRf8A18c}}"
82
+ "{{eJx1j0sLwjAQhD1IqiaKohfxoNQ/4Hl7WRSFnhXv0a5SrI2kiQ/886bxBYK5ZIfJtzOp1hT015SQBVindCkAlkaTPApoozRGpxtrqLhz4NsspdxM3KAyZbWCwYubeV28h8CRG7k97LWyeaJg+Pts+jEZCHxui8MKAzZfOXanNP1lFx+TRSIOxXjiD4uaK+AnqX3DRmFuGSnovOhlKRlwPMvMkvP9HYe9b9TI0NX4LfVcHqmsUwpX7/nrSGDg1DuBo49AEXWxCQ0sGWw9ADevaUg=}}"
83
83
  }
84
84
 
85
85
  subject { instance.foreground('#000000') { 'foreground text' } }
@@ -91,7 +91,7 @@ module Vedeu
91
91
 
92
92
  describe '#style' do
93
93
  let(:expected) {
94
- "{{eJxdj09PAjEQxT2YItuiqAkJN8In8Pz2MtFowhnCvcuOZkPZMd3WP/HL0y0LB2/zZt5v3sz1jWC+5ZojsG34uwPWwbM9GEzJhuCbKgbu/jT0zjXchqdUiJPoBQ8D95L1KAGV3e0/vMS2FsyG6fOlp2DoxK6WVwrqdZOQd/H8H3m79FRpem852UB/Wp/ziy78OhbcD+51LxU0fVkXGeNKXI0ii9XyLpsXgX9C3jJu7YHPK9M5p59KQ6OkzgmaMkWmfKQJCuoZuj0Cs8Jdcg==}}"
94
+ "{{eJx1j71OAzEQhCkiJzk7EESFKEB5Auq5ZgUKUupE6X25BZ1wbpHP5ke8PD4nlwIp3Yxmv9nd0URwu+WaI7Bt+KsD1sGz3RvMyYbgmyoG7n419M413IbHJMRJ9IK7I/ecfTeIcSIru3t/8xLbWnD/f+zpFCoYOrStFhcKarlJ7Kt4Psu+nEJVmh4qZxvoD+vzaUUXfhwLro/YurcKmj6ti4xpJa5Gkc1qcZWHHwJ/h9wybe2eh8p01+Hd0tA4uWGDpkyRKW9ohoJ6hi7/AKgrZ54=}}"
95
95
  }
96
96
 
97
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(Vedeu::MissingRequired) }
26
+ it { proc { subject }.must_raise(Vedeu::Error::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(Vedeu::MissingRequired) }
34
+ it { proc { subject }.must_raise(Vedeu::Error::MissingRequired) }
35
35
  end
36
36
 
37
37
  context 'when the path exists' do
@@ -60,9 +60,11 @@ module Vedeu
60
60
  end
61
61
 
62
62
  context 'with a background colour directive' do
63
- let(:content) { "This is a <%= background('#ff0000') { 'test' } %>.\n" }
63
+ let(:content) {
64
+ "This is a <%= background('#ff0000') { 'test' } %>.\n"
65
+ }
64
66
  let(:colour) {
65
- Vedeu::Colour.new(background: '#ff0000', foreground: '')
67
+ Vedeu::Colours::Colour.new(background: '#ff0000', foreground: '')
66
68
  }
67
69
 
68
70
  let(:expected) {
@@ -92,7 +94,7 @@ module Vedeu
92
94
  }
93
95
 
94
96
  let(:colour) {
95
- Vedeu::Colour.new(background: '#ff0000', foreground: '')
97
+ Vedeu::Colours::Colour.new(background: '#ff0000', foreground: '')
96
98
  }
97
99
 
98
100
  let(:expected) {
@@ -124,9 +126,11 @@ module Vedeu
124
126
  end
125
127
 
126
128
  context 'with a foreground colour directive' do
127
- let(:content) { "This is a <%= foreground('#00ff00') { 'test' } %>.\n" }
129
+ let(:content) {
130
+ "This is a <%= foreground('#00ff00') { 'test' } %>.\n"
131
+ }
128
132
  let(:colour) {
129
- Vedeu::Colour.new(background: '', foreground: '#00ff00')
133
+ Vedeu::Colours::Colour.new(background: '', foreground: '#00ff00')
130
134
  }
131
135
 
132
136
  let(:expected) {
@@ -151,9 +155,11 @@ module Vedeu
151
155
  end
152
156
 
153
157
  context 'with a colour directive' do
154
- let(:content) { "This is a <%= colour(background: '#003300', foreground: '#aadd00') { 'test' } %>.\n" }
158
+ let(:content) {
159
+ "This is a <%= colour(background: '#003300', foreground: '#aadd00') { 'test' } %>.\n"
160
+ }
155
161
  let(:colour) {
156
- Vedeu::Colour.new(background: '#003300', foreground: '#aadd00')
162
+ Vedeu::Colours::Colour.new(background: '#003300', foreground: '#aadd00')
157
163
  }
158
164
 
159
165
  let(:expected) {