vedeu 0.6.71 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/docs/api.md +1 -1
  3. data/lib/vedeu/all.rb +1 -0
  4. data/lib/vedeu/borders/border.rb +66 -55
  5. data/lib/vedeu/borders/caption.rb +10 -20
  6. data/lib/vedeu/borders/dsl.rb +57 -13
  7. data/lib/vedeu/borders/refresh.rb +123 -64
  8. data/lib/vedeu/borders/set_attribute.rb +1 -3
  9. data/lib/vedeu/borders/title.rb +68 -25
  10. data/lib/vedeu/cells/all.rb +23 -0
  11. data/lib/vedeu/cells/border.rb +72 -0
  12. data/lib/vedeu/cells/borders/all.rb +18 -0
  13. data/lib/vedeu/cells/borders/bottom_horizontal.rb +28 -0
  14. data/lib/vedeu/cells/borders/bottom_left.rb +34 -0
  15. data/lib/vedeu/cells/borders/bottom_right.rb +34 -0
  16. data/lib/vedeu/cells/borders/horizontal.rb +28 -0
  17. data/lib/vedeu/cells/borders/left_vertical.rb +28 -0
  18. data/lib/vedeu/cells/borders/right_vertical.rb +28 -0
  19. data/lib/vedeu/cells/borders/top_horizontal.rb +28 -0
  20. data/lib/vedeu/cells/borders/top_left.rb +34 -0
  21. data/lib/vedeu/cells/borders/top_right.rb +34 -0
  22. data/lib/vedeu/cells/borders/vertical.rb +28 -0
  23. data/lib/vedeu/cells/char.rb +24 -0
  24. data/lib/vedeu/cells/clear.rb +29 -0
  25. data/lib/vedeu/cells/empty.rb +78 -0
  26. data/lib/vedeu/cells/escape.rb +24 -0
  27. data/lib/vedeu/cells/html.rb +19 -0
  28. data/lib/vedeu/cells/json.rb +19 -0
  29. data/lib/vedeu/colours/colour.rb +6 -6
  30. data/lib/vedeu/common.rb +9 -0
  31. data/lib/vedeu/cursors/move.rb +2 -3
  32. data/lib/vedeu/editor/insert.rb +1 -1
  33. data/lib/vedeu/editor/item.rb +2 -3
  34. data/lib/vedeu/input/mouse.rb +1 -1
  35. data/lib/vedeu/interfaces/clear.rb +3 -4
  36. data/lib/vedeu/output/compressor.rb +1 -0
  37. data/lib/vedeu/presentation/colour.rb +3 -0
  38. data/lib/vedeu/repositories/defaults.rb +10 -1
  39. data/lib/vedeu/templating/decoder.rb +1 -1
  40. data/lib/vedeu/templating/encoder.rb +1 -1
  41. data/lib/vedeu/templating/template.rb +2 -2
  42. data/lib/vedeu/templating/view_template.rb +1 -1
  43. data/lib/vedeu/terminal/terminal.rb +9 -0
  44. data/lib/vedeu/version.rb +1 -1
  45. data/lib/vedeu/views/html_char.rb +1 -1
  46. data/test/lib/vedeu/application/application_controller_test.rb +2 -2
  47. data/test/lib/vedeu/application/controller_test.rb +4 -4
  48. data/test/lib/vedeu/borders/border_test.rb +10 -2
  49. data/test/lib/vedeu/borders/caption_test.rb +29 -13
  50. data/test/lib/vedeu/borders/dsl_test.rb +44 -25
  51. data/test/lib/vedeu/borders/refresh_test.rb +2 -2
  52. data/test/lib/vedeu/borders/title_test.rb +17 -15
  53. data/test/lib/vedeu/buffers/buffer_test.rb +8 -8
  54. data/test/lib/vedeu/buffers/refresh_test.rb +10 -10
  55. data/test/lib/vedeu/buffers/terminal_test.rb +6 -6
  56. data/test/lib/vedeu/cells/border_test.rb +72 -0
  57. data/test/lib/vedeu/cells/borders/bottom_horizontal_test.rb +22 -0
  58. data/test/lib/vedeu/cells/borders/bottom_left_test.rb +36 -0
  59. data/test/lib/vedeu/cells/borders/bottom_right_test.rb +36 -0
  60. data/test/lib/vedeu/cells/borders/horizontal_test.rb +22 -0
  61. data/test/lib/vedeu/cells/borders/left_vertical_test.rb +22 -0
  62. data/test/lib/vedeu/cells/borders/right_vertical_test.rb +22 -0
  63. data/test/lib/vedeu/cells/borders/top_horizontal_test.rb +22 -0
  64. data/test/lib/vedeu/cells/borders/top_left_test.rb +36 -0
  65. data/test/lib/vedeu/cells/borders/top_right_test.rb +36 -0
  66. data/test/lib/vedeu/cells/borders/vertical_test.rb +22 -0
  67. data/test/lib/vedeu/cells/char_test.rb +22 -0
  68. data/test/lib/vedeu/cells/clear_test.rb +34 -0
  69. data/test/lib/vedeu/cells/empty_test.rb +55 -0
  70. data/test/lib/vedeu/cells/escape_test.rb +13 -0
  71. data/test/lib/vedeu/cells/html_test.rb +13 -0
  72. data/test/lib/vedeu/cells/json_test.rb +13 -0
  73. data/test/lib/vedeu/colours/colour_test.rb +2 -6
  74. data/test/lib/vedeu/colours/translator_test.rb +4 -4
  75. data/test/lib/vedeu/common_test.rb +10 -0
  76. data/test/lib/vedeu/configuration/api_test.rb +24 -24
  77. data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
  78. data/test/lib/vedeu/cursors/dsl_test.rb +16 -16
  79. data/test/lib/vedeu/cursors/reposition_test.rb +2 -2
  80. data/test/lib/vedeu/cursors/repository_test.rb +2 -2
  81. data/test/lib/vedeu/distributed/client_test.rb +2 -2
  82. data/test/lib/vedeu/distributed/server_test.rb +8 -8
  83. data/test/lib/vedeu/distributed/subprocess_test.rb +2 -2
  84. data/test/lib/vedeu/distributed/test_application_test.rb +2 -2
  85. data/test/lib/vedeu/dsl/line_test.rb +2 -2
  86. data/test/lib/vedeu/dsl/presentation_test.rb +4 -4
  87. data/test/lib/vedeu/editor/cursor_test.rb +2 -2
  88. data/test/lib/vedeu/editor/document_test.rb +4 -4
  89. data/test/lib/vedeu/editor/editor_test.rb +20 -20
  90. data/test/lib/vedeu/events/aliases_test.rb +2 -2
  91. data/test/lib/vedeu/events/repository_test.rb +2 -2
  92. data/test/lib/vedeu/geometries/area/area_test.rb +2 -2
  93. data/test/lib/vedeu/geometries/geometry_test.rb +2 -2
  94. data/test/lib/vedeu/geometries/move_test.rb +2 -2
  95. data/test/lib/vedeu/geometries/position_test.rb +2 -2
  96. data/test/lib/vedeu/groups/clear_test.rb +2 -2
  97. data/test/lib/vedeu/groups/group_test.rb +4 -4
  98. data/test/lib/vedeu/groups/refresh_test.rb +2 -2
  99. data/test/lib/vedeu/input/capture_test.rb +42 -40
  100. data/test/lib/vedeu/input/mouse_test.rb +13 -11
  101. data/test/lib/vedeu/input/read_test.rb +10 -10
  102. data/test/lib/vedeu/interfaces/clear_test.rb +15 -6
  103. data/test/lib/vedeu/interfaces/dsl_test.rb +14 -14
  104. data/test/lib/vedeu/interfaces/interface_test.rb +12 -9
  105. data/test/lib/vedeu/logging/debug_test.rb +2 -2
  106. data/test/lib/vedeu/logging/lockless_log_device_test.rb +2 -2
  107. data/test/lib/vedeu/logging/log_test.rb +4 -4
  108. data/test/lib/vedeu/logging/mono_logger_test.rb +8 -8
  109. data/test/lib/vedeu/logging/timer_test.rb +2 -2
  110. data/test/lib/vedeu/menus/menu_test.rb +4 -4
  111. data/test/lib/vedeu/models/cell_test.rb +2 -2
  112. data/test/lib/vedeu/models/focus_test.rb +6 -6
  113. data/test/lib/vedeu/models/toggleable_test.rb +10 -10
  114. data/test/lib/vedeu/null/generic_test.rb +2 -2
  115. data/test/lib/vedeu/output/output_test.rb +8 -8
  116. data/test/lib/vedeu/output/refresh_test.rb +2 -2
  117. data/test/lib/vedeu/output/viewport_test.rb +2 -2
  118. data/test/lib/vedeu/plugins/plugin_test.rb +4 -4
  119. data/test/lib/vedeu/presentation/background_test.rb +2 -2
  120. data/test/lib/vedeu/presentation/foreground_test.rb +2 -2
  121. data/test/lib/vedeu/presentation/style_test.rb +2 -2
  122. data/test/lib/vedeu/renderers/all_test.rb +2 -2
  123. data/test/lib/vedeu/renderers/file_test.rb +6 -6
  124. data/test/lib/vedeu/renderers/terminal_test.rb +2 -2
  125. data/test/lib/vedeu/repositories/collection_test.rb +2 -2
  126. data/test/lib/vedeu/repositories/defaults_test.rb +35 -0
  127. data/test/lib/vedeu/repositories/registerable_test.rb +2 -2
  128. data/test/lib/vedeu/runtime/bootstrap_test.rb +2 -2
  129. data/test/lib/vedeu/runtime/flags_test.rb +2 -2
  130. data/test/lib/vedeu/runtime/launcher_test.rb +4 -4
  131. data/test/lib/vedeu/runtime/main_loop_test.rb +2 -2
  132. data/test/lib/vedeu/runtime/router_test.rb +12 -12
  133. data/test/lib/vedeu/terminal/mode_test.rb +4 -4
  134. data/test/lib/vedeu/terminal/terminal_test.rb +19 -9
  135. data/test/lib/vedeu/views/char_test.rb +2 -2
  136. data/test/lib/vedeu/views/composition_test.rb +2 -2
  137. data/test/lib/vedeu/views/line_test.rb +2 -2
  138. data/test/lib/vedeu/views/stream_test.rb +2 -2
  139. data/test/lib/vedeu/views/view_test.rb +4 -4
  140. data/vedeu.gemspec +1 -1
  141. metadata +57 -4
@@ -8,7 +8,7 @@ module Vedeu
8
8
 
9
9
  # Trigger an event depending on which button was pressed.
10
10
  #
11
- # @param input [String]
11
+ # @param (see #initialize)
12
12
  # @return [void]
13
13
  def self.click(input)
14
14
  new(input).click
@@ -160,10 +160,9 @@ module Vedeu
160
160
  Vedeu.timer("Clearing #{clearing}: '#{name}'".freeze) do
161
161
  @clear ||= Array.new(height) do |iy|
162
162
  Array.new(width) do |ix|
163
- Vedeu::Views::Char.new(value: ' '.freeze,
164
- colour: colour,
165
- name: name,
166
- position: [y + iy, x + ix])
163
+ Vedeu::Cells::Clear.new(colour: colour,
164
+ name: name,
165
+ position: [y + iy, x + ix])
167
166
  end
168
167
  end
169
168
  end
@@ -118,6 +118,7 @@ module Vedeu
118
118
  # @param char [Vedeu::Views::Char]
119
119
  # @return [String]
120
120
  def position_for(char)
121
+ return ''.freeze unless char.position
121
122
  return ''.freeze if char.position.y == @y
122
123
 
123
124
  @y = char.position.y
@@ -18,6 +18,9 @@ module Vedeu
18
18
  elsif self.is_a?(Vedeu::Views::Char) && name
19
19
  Vedeu::Colours::Colour.coerce(interface.colour)
20
20
 
21
+ elsif self.respond_to?(:named_parent) && name
22
+ Vedeu::Colours::Colour.coerce(named_parent.colour)
23
+
21
24
  elsif parent && present?(parent.colour)
22
25
  Vedeu::Colours::Colour.coerce(parent.colour)
23
26
 
@@ -21,11 +21,20 @@ module Vedeu
21
21
  # @return [void] A new instance of the class including this
22
22
  # module.
23
23
  def initialize(attributes = {})
24
- defaults.merge!(attributes).each do |key, value|
24
+ attrs = attributes.to_h.keep_if { |key, _| defaults.key?(key) }
25
+
26
+ defaults.merge!(attrs).each do |key, value|
25
27
  instance_variable_set("@#{key}", value || defaults.fetch(key))
26
28
  end
27
29
  end
28
30
 
31
+ private
32
+
33
+ # @return [Hash<void>]
34
+ def defaults
35
+ {}
36
+ end
37
+
29
38
  end # Defaults
30
39
 
31
40
  end # Repositories
@@ -10,7 +10,7 @@ module Vedeu
10
10
  class Decoder
11
11
 
12
12
  # @param (see #initialize)
13
- # @return [Object]
13
+ # @return (see #process)
14
14
  def self.process(data)
15
15
  new(data).process
16
16
  end
@@ -10,7 +10,7 @@ module Vedeu
10
10
  class Encoder
11
11
 
12
12
  # @param (see #initialize)
13
- # @return [String]
13
+ # @return (see #process)
14
14
  def self.process(data)
15
15
  new(data).process
16
16
  end
@@ -6,8 +6,8 @@ module Vedeu
6
6
  #
7
7
  class Template
8
8
 
9
- # @param (see Vedeu::Templating::Template#new)
10
- # @return [void]
9
+ # @param (see #initialize)
10
+ # @return (see #parse)
11
11
  def self.parse(object, path, options = {})
12
12
  new(object, path, options).parse
13
13
  end
@@ -5,7 +5,7 @@ module Vedeu
5
5
  # Extend Template to provide client application view specific
6
6
  # parsing.
7
7
  #
8
- class ViewTemplate < Template
8
+ class ViewTemplate < Vedeu::Templating::Template
9
9
 
10
10
  include Vedeu::Common
11
11
  include Vedeu::Templating::Helpers
@@ -65,6 +65,15 @@ module Vedeu
65
65
  yield if block_given?
66
66
  end
67
67
 
68
+ # Disables the mouse and shows the cursor. Used by the debugging
69
+ # snippet in {file:docs/debugging.md}.
70
+ #
71
+ # @return [String]
72
+ def debugging!
73
+ output(Vedeu::EscapeSequences::Esc.mouse_x10_off +
74
+ Vedeu::EscapeSequences::Esc.show_cursor)
75
+ end
76
+
68
77
  # Clears the entire terminal space.
69
78
  #
70
79
  # @example
data/lib/vedeu/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # The current version of Vedeu.
4
- VERSION = '0.6.71'.freeze
4
+ VERSION = '0.7.0'.freeze
5
5
 
6
6
  end
@@ -10,7 +10,7 @@ module Vedeu
10
10
  include Vedeu::Common
11
11
 
12
12
  # @param (see #initialize)
13
- # @return [String]
13
+ # @return (see #render)
14
14
  def self.render(char, options = {})
15
15
  new(char, options).render
16
16
  end
@@ -24,10 +24,10 @@ module Vedeu
24
24
 
25
25
  subject { instance.redirect_to(controller, action, params) }
26
26
 
27
- it {
27
+ it do
28
28
  Vedeu.expects(:trigger).with(:_goto_, controller, action, params)
29
29
  subject
30
- }
30
+ end
31
31
 
32
32
  it { instance.must_respond_to(:redirect) }
33
33
  it { instance.must_respond_to(:goto) }
@@ -29,11 +29,11 @@ module Vedeu
29
29
  describe '.controller' do
30
30
  subject { described_model.controller(:some_controller) }
31
31
 
32
- it {
32
+ it do
33
33
  Vedeu::Runtime::Router.expects(:add_controller).
34
34
  with(:some_controller, 'Vedeu::ControllerTestKlass')
35
35
  subject
36
- }
36
+ end
37
37
 
38
38
  it { subject.must_be_instance_of(Hash) }
39
39
  end
@@ -41,13 +41,13 @@ module Vedeu
41
41
  describe '.action' do
42
42
  subject { described_model.action(:some_action, :other_action) }
43
43
 
44
- it {
44
+ it do
45
45
  Vedeu::Runtime::Router.expects(:add_action).
46
46
  with(:some_controller, :some_action)
47
47
  Vedeu::Runtime::Router.expects(:add_action).
48
48
  with(:some_controller, :other_action)
49
49
  subject
50
- }
50
+ end
51
51
 
52
52
  it { subject.must_be_instance_of(Array) }
53
53
  end
@@ -49,8 +49,10 @@ module Vedeu
49
49
  end
50
50
 
51
51
  describe 'accessors' do
52
- it {
52
+ it do
53
53
  instance.must_respond_to(:attributes)
54
+ instance.must_respond_to(:bottom_horizontal)
55
+ instance.must_respond_to(:bottom_horizontal=)
54
56
  instance.must_respond_to(:bottom_left)
55
57
  instance.must_respond_to(:bottom_left=)
56
58
  instance.must_respond_to(:bottom_right)
@@ -73,17 +75,23 @@ module Vedeu
73
75
  instance.must_respond_to(:show_top=)
74
76
  instance.must_respond_to(:title)
75
77
  instance.must_respond_to(:title=)
78
+ instance.must_respond_to(:top_horizontal)
79
+ instance.must_respond_to(:top_horizontal=)
76
80
  instance.must_respond_to(:top_left)
77
81
  instance.must_respond_to(:top_left=)
78
82
  instance.must_respond_to(:top_right)
79
83
  instance.must_respond_to(:top_right=)
84
+ instance.must_respond_to(:left_vertical)
85
+ instance.must_respond_to(:left_vertical=)
86
+ instance.must_respond_to(:right_vertical)
87
+ instance.must_respond_to(:right_vertical=)
80
88
  instance.must_respond_to(:vertical)
81
89
  instance.must_respond_to(:vertical=)
82
90
  instance.must_respond_to(:name)
83
91
  instance.must_respond_to(:enabled)
84
92
  instance.must_respond_to(:enabled=)
85
93
  instance.must_respond_to(:enabled?)
86
- }
94
+ end
87
95
  end
88
96
 
89
97
  describe '#deputy' do
@@ -6,10 +6,11 @@ module Vedeu
6
6
 
7
7
  describe Caption do
8
8
 
9
- let(:described) { Vedeu::Borders::Caption }
10
- let(:instance) { described.new(_value, chars) }
11
- let(:_value) { 'Bismuth' }
12
- let(:chars) {
9
+ let(:described) { Vedeu::Borders::Caption }
10
+ let(:instance) { described.new(_name, _value, horizontal) }
11
+ let(:_name) { 'Vedeu::Borders::Caption' }
12
+ let(:_value) { 'Bismuth' }
13
+ let(:horizontal) {
13
14
  [
14
15
  Vedeu::Views::Char.new(value: '-', position: [4, 1], border: type),
15
16
  Vedeu::Views::Char.new(value: '-', position: [4, 2], border: type),
@@ -31,25 +32,40 @@ module Vedeu
31
32
  context 'when the caption is empty' do
32
33
  let(:_value) {}
33
34
 
34
- it { subject.must_equal(chars) }
35
+ it { subject.must_equal(horizontal) }
35
36
  end
36
37
 
37
38
  context 'when the caption is not empty' do
39
+ let(:border) {
40
+ Vedeu::Borders::Border.new(name: _name)
41
+ }
42
+ let(:geometry) {
43
+ Vedeu::Geometries::Geometry.new(name: _name,
44
+ x: 1,
45
+ xn: 10,
46
+ y: 1,
47
+ yn: 4)
48
+ }
38
49
  let(:expected) {
39
50
  [
40
51
  Vedeu::Views::Char.new(value: '-', position: [4, 1], border: type),
41
- Vedeu::Views::Char.new(value: ' ', position: [4, 2], border: nil),
42
- Vedeu::Views::Char.new(value: 'B', position: [4, 3], border: nil),
43
- Vedeu::Views::Char.new(value: 'i', position: [4, 4], border: nil),
44
- Vedeu::Views::Char.new(value: 's', position: [4, 5], border: nil),
45
- Vedeu::Views::Char.new(value: 'm', position: [4, 6], border: nil),
46
- Vedeu::Views::Char.new(value: 'u', position: [4, 7], border: nil),
47
- Vedeu::Views::Char.new(value: 't', position: [4, 8], border: nil),
48
- Vedeu::Views::Char.new(value: ' ', position: [4, 9], border: nil),
52
+ Vedeu::Cells::Char.new(value: ' ', position: [4, 2]),
53
+ Vedeu::Cells::Char.new(value: 'B', position: [4, 3]),
54
+ Vedeu::Cells::Char.new(value: 'i', position: [4, 4]),
55
+ Vedeu::Cells::Char.new(value: 's', position: [4, 5]),
56
+ Vedeu::Cells::Char.new(value: 'm', position: [4, 6]),
57
+ Vedeu::Cells::Char.new(value: 'u', position: [4, 7]),
58
+ Vedeu::Cells::Char.new(value: 't', position: [4, 8]),
59
+ Vedeu::Cells::Char.new(value: ' ', position: [4, 9]),
49
60
  Vedeu::Views::Char.new(value: '-', position: [4, 10], border: type),
50
61
  ]
51
62
  }
52
63
 
64
+ before do
65
+ Vedeu.borders.stubs(:by_name).returns(border)
66
+ Vedeu.geometries.stubs(:by_name).returns(geometry)
67
+ end
68
+
53
69
  it { subject.must_equal(expected) }
54
70
  end
55
71
  end
@@ -14,26 +14,45 @@ module Vedeu
14
14
  let(:boolean) { true }
15
15
 
16
16
  describe '.border' do
17
- it { described.must_respond_to(:border) }
17
+ let(:_name) { 'Vedeu::Borders::DSL' }
18
+
19
+ after { Vedeu.borders.reset! }
20
+
21
+ subject { described.border(_name) { } }
22
+
23
+ it { subject.must_be_instance_of(Vedeu::Borders::Border) }
24
+
25
+ context 'when the name is not given' do
26
+ let(:_name) {}
27
+
28
+ it { proc { subject}.must_raise(Vedeu::Error::MissingRequired) }
29
+ end
30
+
31
+ context 'when the block is not given' do
32
+ subject { described.border(name) }
33
+
34
+ it { proc { subject}.must_raise(Vedeu::Error::RequiresBlock) }
35
+ end
36
+
18
37
  end
19
38
 
20
39
  describe '#bottom_left' do
21
- let(:char) { 'C' }
40
+ let(:char) { 'C' }
41
+ let(:options) { {} }
22
42
 
23
- subject { instance.bottom_left(char) }
43
+ subject { instance.bottom_left(char, options) }
24
44
 
25
- it { subject.must_be_instance_of(String) }
26
- it { subject.must_equal('C') }
45
+ it { subject.must_be_instance_of(Vedeu::Cells::BottomLeft) }
27
46
  it { instance.must_respond_to(:bottom_left=) }
28
47
  end
29
48
 
30
49
  describe '#bottom_right' do
31
- let(:char) { 'D' }
50
+ let(:char) { 'D' }
51
+ let(:options) { {} }
32
52
 
33
- subject { instance.bottom_right(char) }
53
+ subject { instance.bottom_right(char, options) }
34
54
 
35
- it { subject.must_be_instance_of(String) }
36
- it { subject.must_equal('D') }
55
+ it { subject.must_be_instance_of(Vedeu::Cells::BottomRight) }
37
56
  it { instance.must_respond_to(:bottom_right=) }
38
57
  end
39
58
 
@@ -50,12 +69,12 @@ module Vedeu
50
69
  end
51
70
 
52
71
  describe '#horizontal' do
53
- let(:char) { 'H' }
72
+ let(:char) { 'H' }
73
+ let(:options) { {} }
54
74
 
55
- subject { instance.horizontal(char) }
75
+ subject { instance.horizontal(char, options) }
56
76
 
57
- it { subject.must_be_instance_of(String) }
58
- it { subject.must_equal('H') }
77
+ it { subject.must_be_instance_of(Vedeu::Cells::Horizontal) }
59
78
  it { instance.must_respond_to(:horizontal=) }
60
79
  end
61
80
 
@@ -189,22 +208,22 @@ module Vedeu
189
208
  end
190
209
 
191
210
  describe '#top_left' do
192
- let(:char) { 'A' }
211
+ let(:char) { 'A' }
212
+ let(:options) { {} }
193
213
 
194
- subject { instance.top_left(char) }
214
+ subject { instance.top_left(char, options) }
195
215
 
196
- it { subject.must_be_instance_of(String) }
197
- it { subject.must_equal('A') }
216
+ it { subject.must_be_instance_of(Vedeu::Cells::TopLeft) }
198
217
  it { instance.must_respond_to(:top_left=) }
199
218
  end
200
219
 
201
220
  describe '#top_right' do
202
- let(:char) { 'B' }
221
+ let(:char) { 'B' }
222
+ let(:options) { {} }
203
223
 
204
- subject { instance.top_right(char) }
224
+ subject { instance.top_right(char, options) }
205
225
 
206
- it { subject.must_be_instance_of(String) }
207
- it { subject.must_equal('B') }
226
+ it { subject.must_be_instance_of(Vedeu::Cells::TopRight) }
208
227
  it { instance.must_respond_to(:top_right=) }
209
228
  end
210
229
 
@@ -228,12 +247,12 @@ module Vedeu
228
247
  end
229
248
 
230
249
  describe '#vertical' do
231
- let(:char) { 'V' }
250
+ let(:char) { 'V' }
251
+ let(:options) { {} }
232
252
 
233
- subject { instance.vertical(char) }
253
+ subject { instance.vertical(char, options) }
234
254
 
235
- it { subject.must_be_instance_of(String) }
236
- it { subject.must_equal('V') }
255
+ it { subject.must_be_instance_of(Vedeu::Cells::Vertical) }
237
256
  it { instance.must_respond_to(:vertical=) }
238
257
  end
239
258
 
@@ -59,10 +59,10 @@ module Vedeu
59
59
  context 'when the border is enabled' do
60
60
  let(:enabled) { true }
61
61
 
62
- it {
62
+ it do
63
63
  Vedeu.expects(:render_output)
64
64
  subject
65
- }
65
+ end
66
66
 
67
67
  context 'but the interface/view is not visible' do
68
68
  let(:visible) { false }
@@ -6,10 +6,11 @@ module Vedeu
6
6
 
7
7
  describe Title do
8
8
 
9
- let(:described) { Vedeu::Borders::Title }
10
- let(:instance) { described.new(_value, chars) }
11
- let(:_value) { 'Aluminium' }
12
- let(:chars) {
9
+ let(:described) { Vedeu::Borders::Title }
10
+ let(:instance) { described.new(_name, _value, horizontal) }
11
+ let(:_name) { 'Vedeu::Borders::Title' }
12
+ let(:_value) { 'Aluminium' }
13
+ let(:horizontal) {
13
14
  [
14
15
  Vedeu::Views::Char.new(value: '-', position: [1, 1], border: type),
15
16
  Vedeu::Views::Char.new(value: '-', position: [1, 2], border: type),
@@ -27,31 +28,32 @@ module Vedeu
27
28
 
28
29
  describe '#initialize' do
29
30
  it { instance.must_be_instance_of(described) }
31
+ it { instance.instance_variable_get('@name').must_equal(_name) }
30
32
  it { instance.instance_variable_get('@value').must_equal(_value) }
31
- it { instance.instance_variable_get('@chars').must_equal(chars) }
33
+ it { instance.instance_variable_get('@horizontal').must_equal(horizontal) }
32
34
  end
33
35
 
34
36
  describe '.render' do
35
- subject { described.render(_value, chars) }
37
+ subject { described.render(_name, _value, horizontal) }
36
38
 
37
39
  context 'when the title is empty' do
38
40
  let(:_value) {}
39
41
 
40
- it { subject.must_equal(chars) }
42
+ it { subject.must_equal(horizontal) }
41
43
  end
42
44
 
43
45
  context 'when the title is not empty' do
44
46
  let(:expected) {
45
47
  [
46
48
  Vedeu::Views::Char.new(value: '-', position: [1, 1], border: type),
47
- Vedeu::Views::Char.new(value: ' ', position: [1, 2], border: nil),
48
- Vedeu::Views::Char.new(value: 'A', position: [1, 3], border: nil),
49
- Vedeu::Views::Char.new(value: 'l', position: [1, 4], border: nil),
50
- Vedeu::Views::Char.new(value: 'u', position: [1, 5], border: nil),
51
- Vedeu::Views::Char.new(value: 'm', position: [1, 6], border: nil),
52
- Vedeu::Views::Char.new(value: 'i', position: [1, 7], border: nil),
53
- Vedeu::Views::Char.new(value: 'n', position: [1, 8], border: nil),
54
- Vedeu::Views::Char.new(value: ' ', position: [1, 9], border: nil),
49
+ Vedeu::Cells::Char.new(value: ' ', position: [1, 2]),
50
+ Vedeu::Cells::Char.new(value: 'A', position: [1, 3]),
51
+ Vedeu::Cells::Char.new(value: 'l', position: [1, 4]),
52
+ Vedeu::Cells::Char.new(value: 'u', position: [1, 5]),
53
+ Vedeu::Cells::Char.new(value: 'm', position: [1, 6]),
54
+ Vedeu::Cells::Char.new(value: 'i', position: [1, 7]),
55
+ Vedeu::Cells::Char.new(value: 'n', position: [1, 8]),
56
+ Vedeu::Cells::Char.new(value: ' ', position: [1, 9]),
55
57
  Vedeu::Views::Char.new(value: '-', position: [1, 10], border: type),
56
58
  ]
57
59
  }